Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: content/renderer/webplugin_delegate_proxy.cc

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix Linux/Mac compiles. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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::BeginPlatformPaint(
854 background_store_canvas_->getTopPlatformDevice().GetBitmapContext(); 854 background_store_canvas_.get());
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 cairo_surface_t* bg_surface =cairo_get_target(skia::BeginPlatformPaint(
873 background_store_canvas_->getTopPlatformDevice(); 874 background_store_canvas_.get()));
874 cairo_surface_t* bg_surface = cairo_get_target(device.BeginPlatformPaint());
875 DCHECK_EQ(cairo_surface_get_type(bg_surface), CAIRO_SURFACE_TYPE_IMAGE); 875 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); 876 DCHECK_EQ(cairo_image_surface_get_format(bg_surface), CAIRO_FORMAT_ARGB32);
877 cairo_surface_flush(bg_surface); 877 cairo_surface_flush(bg_surface);
878 const unsigned char* bg_bytes = cairo_image_surface_get_data(bg_surface); 878 const unsigned char* bg_bytes = cairo_image_surface_get_data(bg_surface);
879 int full_bg_width = cairo_image_surface_get_width(bg_surface); 879 int full_bg_width = cairo_image_surface_get_width(bg_surface);
880 int full_bg_height = cairo_image_surface_get_height(bg_surface); 880 int full_bg_height = cairo_image_surface_get_height(bg_surface);
881 int bg_stride = cairo_image_surface_get_stride(bg_surface); 881 int bg_stride = cairo_image_surface_get_stride(bg_surface);
882 882
883 int bytes_per_pixel = 4; // ARGB32 = 4 bytes per pixel. 883 int bytes_per_pixel = 4; // ARGB32 = 4 bytes per pixel.
884 #endif 884 #endif
(...skipping 13 matching lines...) Expand all
898 for (int row = 0; row < damage_height; ++row) { 898 for (int row = 0; row < damage_height; ++row) {
899 int page_offset = page_stride * (page_start_y + row) + page_x_byte_offset; 899 int page_offset = page_stride * (page_start_y + row) + page_x_byte_offset;
900 int bg_y = bg_start_y + row; 900 int bg_y = bg_start_y + row;
901 #if defined(OS_MACOSX) 901 #if defined(OS_MACOSX)
902 // The background buffer is upside down relative to the content. 902 // The background buffer is upside down relative to the content.
903 bg_y = bg_last_row - bg_y; 903 bg_y = bg_last_row - bg_y;
904 #endif 904 #endif
905 int bg_offset = bg_stride * bg_y + bg_x_byte_offset; 905 int bg_offset = bg_stride * bg_y + bg_x_byte_offset;
906 if (memcmp(page_bytes + page_offset, 906 if (memcmp(page_bytes + page_offset,
907 bg_bytes + bg_offset, 907 bg_bytes + bg_offset,
908 damage_width * bytes_per_pixel) != 0) 908 damage_width * bytes_per_pixel) != 0) {
909 skia::EndPlatformPaint(background_store_canvas_.get());
jamesr 2011/05/19 22:20:52 it seems that here and in other spots that it'd be
Jeff Timanus 2011/05/24 16:50:28 I added ScopedPlatformPaint to skia\ext\platform_c
909 return true; 910 return true;
911 }
910 } 912 }
913 skia::EndPlatformPaint(background_store_canvas_.get());
911 #endif 914 #endif
912 915
913 return false; 916 return false;
914 } 917 }
915 918
916 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { 919 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() {
917 if (npobject_) 920 if (npobject_)
918 return WebBindings::retainObject(npobject_); 921 return WebBindings::retainObject(npobject_);
919 922
920 int route_id = MSG_ROUTING_NONE; 923 int route_id = MSG_ROUTING_NONE;
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 } 1367 }
1365 #endif 1368 #endif
1366 1369
1367 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, 1370 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow,
1368 int resource_id) { 1371 int resource_id) {
1369 if (!plugin_) 1372 if (!plugin_)
1370 return; 1373 return;
1371 1374
1372 plugin_->URLRedirectResponse(allow, resource_id); 1375 plugin_->URLRedirectResponse(allow, resource_id);
1373 } 1376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698