Index: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc |
=================================================================== |
--- webkit/plugins/ppapi/ppb_graphics_2d_impl.cc (revision 81254) |
+++ webkit/plugins/ppapi/ppb_graphics_2d_impl.cc (working copy) |
@@ -28,6 +28,10 @@ |
#include "base/mac/scoped_cftyperef.h" |
#endif |
+#if defined(OS_MACOSX) && defined(USE_SKIA) |
+#include "skia/ext/skia_utils_mac.h" |
+#endif |
+ |
namespace webkit { |
namespace ppapi { |
@@ -512,11 +516,17 @@ |
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, |
data_provider, NULL, false, kCGRenderingIntentDefault)); |
+#if defined(USE_SKIA) |
+ gfx::SkiaBitLocker bitLocker(canvas); |
+ CGContextRef cgContext = bitLocker.cgContext(); |
stuartmorgan
2011/04/12 17:35:51
Same question here; why use CG?
_cary
2011/04/12 21:03:55
Done.
|
+#else |
+ CGContextRef cgContext = canvas; |
+#endif |
// Flip the transform |
- CGContextSaveGState(canvas); |
- float window_height = static_cast<float>(CGBitmapContextGetHeight(canvas)); |
- CGContextTranslateCTM(canvas, 0, window_height); |
- CGContextScaleCTM(canvas, 1.0, -1.0); |
+ CGContextSaveGState(cgContext); |
+ float window_height = static_cast<float>(CGBitmapContextGetHeight(cgContext)); |
+ CGContextTranslateCTM(cgContext, 0, window_height); |
+ CGContextScaleCTM(cgContext, 1.0, -1.0); |
// To avoid painting outside the plugin boundaries and clip instead of |
// scaling, CGContextDrawImage() must draw the full image using |bitmap_rect| |
@@ -536,13 +546,13 @@ |
bounds.size.width = plugin_rect.width(); |
bounds.size.height = plugin_rect.height(); |
- CGContextClipToRect(canvas, bounds); |
+ CGContextClipToRect(cgContext, bounds); |
// TODO(brettw) bug 56673: do a direct memcpy instead of going through CG |
// if the is_always_opaque_ flag is set. Must ensure bitmap is still clipped. |
- CGContextDrawImage(canvas, bitmap_rect, image); |
- CGContextRestoreGState(canvas); |
+ CGContextDrawImage(cgContext, bitmap_rect, image); |
+ CGContextRestoreGState(cgContext); |
#else |
SkPaint paint; |
if (is_always_opaque_) { |