diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 06:01:16 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 06:01:16 +0000 |
commit | 75b6805083c906bb17192a738b311bd21791e9f8 (patch) | |
tree | bce38efec20d50a7ef55a694f58036ae365d5e0a /ui/base/x/x11_util.cc | |
parent | 2aa8b71eb688aa13a4f745027bcd4bb726bf6663 (diff) | |
download | chromium_src-75b6805083c906bb17192a738b311bd21791e9f8.zip chromium_src-75b6805083c906bb17192a738b311bd21791e9f8.tar.gz chromium_src-75b6805083c906bb17192a738b311bd21791e9f8.tar.bz2 |
Cross-platform CL to remove app/win/win_util.h&cc and related work.
See Issue 70141 for the full move details; see my inline review comments.
Changes significantly different from or beyond those prescribed by the bug:
*Consolidated a lot of GrabWindowSnapshot code.
*Moved EnsureRectIsVisibleInRect to views::internal namespace for test access.
*Moved app/win/win_util_unittest.cc to views/window/window_win_unittest.h
*Named ui/base/message_box_win.h instead of ui/base/message_box.h
*Made WindowWin::GetWindowTitleFont static; needed in static contexts.
*Denoted WindowWin::FrameTypeChanged as a Window override, moved code.
*Moved TestGrabWindowSnapshot into new file: chrome/browser/ui/window_snapshot/window_snapshot_mac_unittest.mm
BUG=70141
TEST=none
Review URL: http://codereview.chromium.org/6386009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/x/x11_util.cc')
-rw-r--r-- | ui/base/x/x11_util.cc | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc index f7222fc..1232bc8 100644 --- a/ui/base/x/x11_util.cc +++ b/ui/base/x/x11_util.cc @@ -687,54 +687,6 @@ bool GetWindowManagerName(std::string* wm_name) { return !got_error && result; } -static cairo_status_t SnapshotCallback( - void *closure, const unsigned char *data, unsigned int length) { - std::vector<unsigned char>* png_representation = - static_cast<std::vector<unsigned char>*>(closure); - - size_t old_size = png_representation->size(); - png_representation->resize(old_size + length); - memcpy(&(*png_representation)[old_size], data, length); - return CAIRO_STATUS_SUCCESS; -} - -void GrabWindowSnapshot(GtkWindow* gtk_window, - std::vector<unsigned char>* png_representation) { - GdkWindow* gdk_window = GTK_WIDGET(gtk_window)->window; - Display* display = GDK_WINDOW_XDISPLAY(gdk_window); - XID win = GDK_WINDOW_XID(gdk_window); - XWindowAttributes attr; - if (XGetWindowAttributes(display, win, &attr) == 0) { - LOG(ERROR) << "Couldn't get window attributes"; - return; - } - XImage* image = XGetImage( - display, win, 0, 0, attr.width, attr.height, AllPlanes, ZPixmap); - if (!image) { - LOG(ERROR) << "Couldn't get image"; - return; - } - if (image->depth != 24) { - LOG(ERROR)<< "Unsupported image depth " << image->depth; - return; - } - cairo_surface_t* surface = - cairo_image_surface_create_for_data( - reinterpret_cast<unsigned char*>(image->data), - CAIRO_FORMAT_RGB24, - image->width, - image->height, - image->bytes_per_line); - - if (!surface) { - LOG(ERROR) << "Unable to create Cairo surface from XImage data"; - return; - } - cairo_surface_write_to_png_stream( - surface, SnapshotCallback, png_representation); - cairo_surface_destroy(surface); -} - bool ChangeWindowDesktop(XID window, XID destination) { int desktop; if (!GetWindowDesktop(destination, &desktop)) |