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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 ui::GetVisualFromGtkWidget(view_.get()), | 1031 ui::GetVisualFromGtkWidget(view_.get()), |
1032 depth); | 1032 depth); |
1033 } | 1033 } |
1034 | 1034 |
1035 // NOTE: |output| is initialized with the size of |src_subrect|, and |dst_size| | 1035 // NOTE: |output| is initialized with the size of |src_subrect|, and |dst_size| |
1036 // is ignored on GTK. | 1036 // is ignored on GTK. |
1037 void RenderWidgetHostViewGtk::CopyFromCompositingSurface( | 1037 void RenderWidgetHostViewGtk::CopyFromCompositingSurface( |
1038 const gfx::Rect& src_subrect, | 1038 const gfx::Rect& src_subrect, |
1039 const gfx::Size& /* dst_size */, | 1039 const gfx::Size& /* dst_size */, |
1040 const base::Callback<void(bool)>& callback, | 1040 const base::Callback<void(bool)>& callback, |
1041 skia::PlatformCanvas* output) { | 1041 skia::PlatformBitmap* output) { |
1042 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 1042 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
1043 | 1043 |
1044 const gfx::Rect bounds = GetViewBounds(); | 1044 const gfx::Rect bounds = GetViewBounds(); |
1045 ui::XScopedImage image(XGetImage(ui::GetXDisplay(), ui::GetX11RootWindow(), | 1045 ui::XScopedImage image(XGetImage(ui::GetXDisplay(), ui::GetX11RootWindow(), |
1046 bounds.x() + src_subrect.x(), | 1046 bounds.x() + src_subrect.x(), |
1047 bounds.y() + src_subrect.y(), | 1047 bounds.y() + src_subrect.y(), |
1048 src_subrect.width(), | 1048 src_subrect.width(), |
1049 src_subrect.height(), | 1049 src_subrect.height(), |
1050 AllPlanes, ZPixmap)); | 1050 AllPlanes, ZPixmap)); |
1051 if (!image.get()) | 1051 if (!image.get()) |
1052 return; | 1052 return; |
1053 | 1053 |
1054 if (!output->initialize(src_subrect.width(), src_subrect.height(), true)) | 1054 if (!output->Allocate(src_subrect.width(), src_subrect.height(), true)) |
1055 return; | 1055 return; |
1056 | 1056 |
1057 const SkBitmap& bitmap = output->getTopDevice()->accessBitmap(true); | 1057 const SkBitmap& bitmap = output->GetBitmap(); |
1058 const size_t bitmap_size = bitmap.getSize(); | 1058 const size_t bitmap_size = bitmap.getSize(); |
1059 DCHECK_EQ(bitmap_size, | 1059 DCHECK_EQ(bitmap_size, |
1060 static_cast<size_t>(image->height * image->bytes_per_line)); | 1060 static_cast<size_t>(image->height * image->bytes_per_line)); |
1061 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); | 1061 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); |
1062 memcpy(pixels, image->data, bitmap_size); | 1062 memcpy(pixels, image->data, bitmap_size); |
1063 | 1063 |
1064 scoped_callback_runner.Release(); | 1064 scoped_callback_runner.Release(); |
1065 callback.Run(true); | 1065 callback.Run(true); |
1066 } | 1066 } |
1067 | 1067 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 this)); | 1551 this)); |
1552 } | 1552 } |
1553 BrowserAccessibilityGtk* root = | 1553 BrowserAccessibilityGtk* root = |
1554 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); | 1554 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); |
1555 | 1555 |
1556 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); | 1556 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); |
1557 return root->GetAtkObject(); | 1557 return root->GetAtkObject(); |
1558 } | 1558 } |
1559 | 1559 |
1560 } // namespace content | 1560 } // namespace content |
OLD | NEW |