| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
| 6 | 6 |
| 7 // If this gets included after the gtk headers, then a bunch of compiler | 7 // If this gets included after the gtk headers, then a bunch of compiler |
| 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts | 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts |
| 9 // badly with net::URLRequestStatus::Status. | 9 // badly with net::URLRequestStatus::Status. |
| 10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 BackingStore* RenderWidgetHostViewGtk::AllocBackingStore( | 1025 BackingStore* RenderWidgetHostViewGtk::AllocBackingStore( |
| 1026 const gfx::Size& size) { | 1026 const gfx::Size& size) { |
| 1027 gint depth = gdk_visual_get_depth(gtk_widget_get_visual(view_.get())); | 1027 gint depth = gdk_visual_get_depth(gtk_widget_get_visual(view_.get())); |
| 1028 return new BackingStoreGtk(host_, size, | 1028 return new BackingStoreGtk(host_, size, |
| 1029 ui::GetVisualFromGtkWidget(view_.get()), | 1029 ui::GetVisualFromGtkWidget(view_.get()), |
| 1030 depth); | 1030 depth); |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 // NOTE: |output| is initialized with the size of the view and |size| is | 1033 // NOTE: |output| is initialized with the size of |src_subrect|, and |dst_size| |
| 1034 // ignored on GTK. | 1034 // is ignored on GTK. |
| 1035 void RenderWidgetHostViewGtk::CopyFromCompositingSurface( | 1035 void RenderWidgetHostViewGtk::CopyFromCompositingSurface( |
| 1036 const gfx::Size& /* size */, | 1036 const gfx::Rect& src_subrect, |
| 1037 const gfx::Size& /* dst_size */, |
| 1037 const base::Callback<void(bool)>& callback, | 1038 const base::Callback<void(bool)>& callback, |
| 1038 skia::PlatformCanvas* output) { | 1039 skia::PlatformCanvas* output) { |
| 1039 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 1040 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 1040 | 1041 |
| 1041 const gfx::Rect bounds = GetViewBounds(); | 1042 const gfx::Rect bounds = GetViewBounds(); |
| 1042 XImage* image = XGetImage(ui::GetXDisplay(), ui::GetX11RootWindow(), | 1043 XImage* image = XGetImage(ui::GetXDisplay(), ui::GetX11RootWindow(), |
| 1043 bounds.x(), bounds.y(), | 1044 bounds.x() + src_subrect.x(), |
| 1044 bounds.width(), bounds.height(), | 1045 bounds.y() + src_subrect.y(), |
| 1046 src_subrect.width(), |
| 1047 src_subrect.height(), |
| 1045 AllPlanes, ZPixmap); | 1048 AllPlanes, ZPixmap); |
| 1046 if (!image) | 1049 if (!image) |
| 1047 return; | 1050 return; |
| 1048 | 1051 |
| 1049 if (!output->initialize(bounds.width(), bounds.height(), true)) { | 1052 if (!output->initialize(src_subrect.width(), src_subrect.height(), true)) { |
| 1050 XFree(image); | 1053 XFree(image); |
| 1051 return; | 1054 return; |
| 1052 } | 1055 } |
| 1053 | 1056 |
| 1054 const SkBitmap& bitmap = output->getTopDevice()->accessBitmap(true); | 1057 const SkBitmap& bitmap = output->getTopDevice()->accessBitmap(true); |
| 1055 const size_t bitmap_size = bitmap.getSize(); | 1058 const size_t bitmap_size = bitmap.getSize(); |
| 1056 DCHECK_EQ(bitmap_size, | 1059 DCHECK_EQ(bitmap_size, |
| 1057 static_cast<size_t>(image->height * image->bytes_per_line)); | 1060 static_cast<size_t>(image->height * image->bytes_per_line)); |
| 1058 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); | 1061 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); |
| 1059 memcpy(pixels, image->data, bitmap_size); | 1062 memcpy(pixels, image->data, bitmap_size); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 this)); | 1547 this)); |
| 1545 } | 1548 } |
| 1546 BrowserAccessibilityGtk* root = | 1549 BrowserAccessibilityGtk* root = |
| 1547 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); | 1550 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); |
| 1548 | 1551 |
| 1549 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); | 1552 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); |
| 1550 return root->GetAtkObject(); | 1553 return root->GetAtkObject(); |
| 1551 } | 1554 } |
| 1552 | 1555 |
| 1553 } // namespace content | 1556 } // namespace content |
| OLD | NEW |