| Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc
|
| ===================================================================
|
| --- webkit/plugins/ppapi/ppapi_plugin_instance.cc (revision 85477)
|
| +++ webkit/plugins/ppapi/ppapi_plugin_instance.cc (working copy)
|
| @@ -78,6 +78,10 @@
|
| #include "ui/gfx/gdi_util.h"
|
| #endif
|
|
|
| +#if defined(OS_MACOSX) && defined(USE_SKIA)
|
| +#include "skia/ext/skia_utils_mac.h"
|
| +#endif
|
| +
|
| using WebKit::WebBindings;
|
| using WebKit::WebCanvas;
|
| using WebKit::WebCursorInfo;
|
| @@ -1246,18 +1250,24 @@
|
| // Create a PDF metafile and render from there into the passed in context.
|
| if (metafile.InitFromData(buffer->mapped_buffer(), buffer->size())) {
|
| // Flip the transform.
|
| - CGContextSaveGState(canvas);
|
| - CGContextTranslateCTM(canvas, 0,
|
| +#if defined(USE_SKIA)
|
| + gfx::SkiaBitLocker bit_locker(canvas);
|
| + CGContextRef cgContext = bit_locker.cgContext();
|
| +#else
|
| + CGContextRef cgContext = canvas;
|
| +#endif
|
| + CGContextSaveGState(cgContext);
|
| + CGContextTranslateCTM(cgContext, 0,
|
| current_print_settings_.printable_area.size.height);
|
| - CGContextScaleCTM(canvas, 1.0, -1.0);
|
| + CGContextScaleCTM(cgContext, 1.0, -1.0);
|
| CGRect page_rect;
|
| page_rect.origin.x = current_print_settings_.printable_area.point.x;
|
| page_rect.origin.y = current_print_settings_.printable_area.point.y;
|
| page_rect.size.width = current_print_settings_.printable_area.size.width;
|
| page_rect.size.height = current_print_settings_.printable_area.size.height;
|
|
|
| - ret = metafile.RenderPage(1, canvas, page_rect, true, false, true, true);
|
| - CGContextRestoreGState(canvas);
|
| + ret = metafile.RenderPage(1, cgContext, page_rect, true, false, true, true);
|
| + CGContextRestoreGState(cgContext);
|
| }
|
| #elif defined(OS_WIN)
|
| // On Windows, we now need to render the PDF to the DC that backs the
|
| @@ -1333,16 +1343,16 @@
|
| draw_to_canvas = false;
|
| }
|
| #endif // defined(OS_WIN)
|
| -#if defined(OS_MACOSX)
|
| +#if defined(OS_MACOSX) && !defined(USE_SKIA)
|
| draw_to_canvas = false;
|
| DrawSkBitmapToCanvas(*bitmap, canvas, dest_rect_gfx,
|
| current_print_settings_.printable_area.size.height);
|
| // See comments in the header file.
|
| last_printed_page_ = image;
|
| -#else // defined(OS_MACOSX)
|
| +#else // defined(OS_MACOSX) && !defined(USE_SKIA)
|
| if (draw_to_canvas)
|
| canvas->drawBitmapRect(*bitmap, &src_rect, dest_rect);
|
| -#endif // defined(OS_MACOSX)
|
| +#endif // defined(OS_MACOSX) && !defined(USE_SKIA)
|
| return true;
|
| }
|
|
|
| @@ -1395,7 +1405,7 @@
|
| }
|
| #endif // OS_WIN
|
|
|
| -#if defined(OS_MACOSX)
|
| +#if defined(OS_MACOSX) && !defined(USE_SKIA)
|
| void PluginInstance::DrawSkBitmapToCanvas(
|
| const SkBitmap& bitmap, WebKit::WebCanvas* canvas,
|
| const gfx::Rect& dest_rect,
|
| @@ -1428,7 +1438,7 @@
|
| CGContextDrawImage(canvas, bounds, image);
|
| CGContextRestoreGState(canvas);
|
| }
|
| -#endif // defined(OS_MACOSX)
|
| +#endif // defined(OS_MACOSX) && !defined(USE_SKIA)
|
|
|
| PPB_Graphics2D_Impl* PluginInstance::bound_graphics_2d() const {
|
| if (bound_graphics_.get() == NULL)
|
|
|