| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/webplugin_delegate_proxy.h" | 5 #include "content/renderer/webplugin_delegate_proxy.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 // may project outside the image, so intersect their rects. | 843 // may project outside the image, so intersect their rects. |
| 844 gfx::Rect content_rect = rect.Intersect(full_content_rect); | 844 gfx::Rect content_rect = rect.Intersect(full_content_rect); |
| 845 | 845 |
| 846 #if defined(OS_MACOSX) | 846 #if defined(OS_MACOSX) |
| 847 const unsigned char* page_bytes = static_cast<const unsigned char*>( | 847 const unsigned char* page_bytes = static_cast<const unsigned char*>( |
| 848 CGBitmapContextGetData(context)); | 848 CGBitmapContextGetData(context)); |
| 849 int page_stride = CGBitmapContextGetBytesPerRow(context); | 849 int page_stride = CGBitmapContextGetBytesPerRow(context); |
| 850 int page_start_x = content_rect.x() - context_offset_x; | 850 int page_start_x = content_rect.x() - context_offset_x; |
| 851 int page_start_y = content_rect.y() - context_offset_y; | 851 int page_start_y = content_rect.y() - context_offset_y; |
| 852 | 852 |
| 853 CGContextRef bg_context = | 853 CGContextRef bg_context = skia::platform_util::GetBitmapContext( |
| 854 background_store_canvas_->getTopPlatformDevice().GetBitmapContext(); | 854 &background_store_canvas_->getTopDevice()); |
| 855 |
| 855 DCHECK_EQ(CGBitmapContextGetBitsPerPixel(context), | 856 DCHECK_EQ(CGBitmapContextGetBitsPerPixel(context), |
| 856 CGBitmapContextGetBitsPerPixel(bg_context)); | 857 CGBitmapContextGetBitsPerPixel(bg_context)); |
| 857 const unsigned char* bg_bytes = static_cast<const unsigned char*>( | 858 const unsigned char* bg_bytes = static_cast<const unsigned char*>( |
| 858 CGBitmapContextGetData(bg_context)); | 859 CGBitmapContextGetData(bg_context)); |
| 859 int full_bg_width = CGBitmapContextGetWidth(bg_context); | 860 int full_bg_width = CGBitmapContextGetWidth(bg_context); |
| 860 int full_bg_height = CGBitmapContextGetHeight(bg_context); | 861 int full_bg_height = CGBitmapContextGetHeight(bg_context); |
| 861 int bg_stride = CGBitmapContextGetBytesPerRow(bg_context); | 862 int bg_stride = CGBitmapContextGetBytesPerRow(bg_context); |
| 862 int bg_last_row = CGBitmapContextGetHeight(bg_context) - 1; | 863 int bg_last_row = CGBitmapContextGetHeight(bg_context) - 1; |
| 863 | 864 |
| 864 int bytes_per_pixel = CGBitmapContextGetBitsPerPixel(context) / 8; | 865 int bytes_per_pixel = CGBitmapContextGetBitsPerPixel(context) / 8; |
| 865 #else | 866 #else |
| 866 cairo_surface_flush(page_surface); | 867 cairo_surface_flush(page_surface); |
| 867 const unsigned char* page_bytes = cairo_image_surface_get_data(page_surface); | 868 const unsigned char* page_bytes = cairo_image_surface_get_data(page_surface); |
| 868 int page_stride = cairo_image_surface_get_stride(page_surface); | 869 int page_stride = cairo_image_surface_get_stride(page_surface); |
| 869 int page_start_x = static_cast<int>(page_x_double); | 870 int page_start_x = static_cast<int>(page_x_double); |
| 870 int page_start_y = static_cast<int>(page_y_double); | 871 int page_start_y = static_cast<int>(page_y_double); |
| 871 | 872 |
| 872 skia::PlatformDevice& device = | 873 SkDevice& device = background_store_canvas_->getTopDevice(); |
| 873 background_store_canvas_->getTopPlatformDevice(); | 874 cairo_surface_t* bg_surface = |
| 874 cairo_surface_t* bg_surface = cairo_get_target(device.BeginPlatformPaint()); | 875 cairo_get_target(skia::platform_util::BeginPlatformPaint(&device)); |
| 875 DCHECK_EQ(cairo_surface_get_type(bg_surface), CAIRO_SURFACE_TYPE_IMAGE); | 876 DCHECK_EQ(cairo_surface_get_type(bg_surface), CAIRO_SURFACE_TYPE_IMAGE); |
| 876 DCHECK_EQ(cairo_image_surface_get_format(bg_surface), CAIRO_FORMAT_ARGB32); | 877 DCHECK_EQ(cairo_image_surface_get_format(bg_surface), CAIRO_FORMAT_ARGB32); |
| 877 cairo_surface_flush(bg_surface); | 878 cairo_surface_flush(bg_surface); |
| 878 const unsigned char* bg_bytes = cairo_image_surface_get_data(bg_surface); | 879 const unsigned char* bg_bytes = cairo_image_surface_get_data(bg_surface); |
| 879 int full_bg_width = cairo_image_surface_get_width(bg_surface); | 880 int full_bg_width = cairo_image_surface_get_width(bg_surface); |
| 880 int full_bg_height = cairo_image_surface_get_height(bg_surface); | 881 int full_bg_height = cairo_image_surface_get_height(bg_surface); |
| 881 int bg_stride = cairo_image_surface_get_stride(bg_surface); | 882 int bg_stride = cairo_image_surface_get_stride(bg_surface); |
| 882 | 883 |
| 883 int bytes_per_pixel = 4; // ARGB32 = 4 bytes per pixel. | 884 int bytes_per_pixel = 4; // ARGB32 = 4 bytes per pixel. |
| 884 #endif | 885 #endif |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 } | 1365 } |
| 1365 #endif | 1366 #endif |
| 1366 | 1367 |
| 1367 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1368 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
| 1368 int resource_id) { | 1369 int resource_id) { |
| 1369 if (!plugin_) | 1370 if (!plugin_) |
| 1370 return; | 1371 return; |
| 1371 | 1372 |
| 1372 plugin_->URLRedirectResponse(allow, resource_id); | 1373 plugin_->URLRedirectResponse(allow, resource_id); |
| 1373 } | 1374 } |
| OLD | NEW |