diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-27 00:32:15 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-27 00:32:15 +0000 |
commit | a1b629863d065d0642341aa8805a6deddee5ea72 (patch) | |
tree | 1a924f38baac1d5684e3ed56a37ef31e79329fe3 /webkit/plugins | |
parent | 42bbcfebea014235660d58ab92cd34afa3a3752a (diff) | |
download | chromium_src-a1b629863d065d0642341aa8805a6deddee5ea72.zip chromium_src-a1b629863d065d0642341aa8805a6deddee5ea72.tar.gz chromium_src-a1b629863d065d0642341aa8805a6deddee5ea72.tar.bz2 |
mac: Use ScopedCGContextSaveGState in a few more places
BUG=65894
Review URL: https://chromiumcodereview.appspot.com/10869031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl_mac.mm | 1 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc | 4 |
3 files changed, 5 insertions, 4 deletions
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm index 797d96b..eaf5770 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm +++ b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm @@ -20,6 +20,7 @@ #include "base/utf_string_conversions.h" #include "base/sys_string_conversions.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" +#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" #include "webkit/glue/webkit_glue.h" #include "webkit/plugins/npapi/plugin_instance.h" #include "webkit/plugins/npapi/plugin_lib.h" diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index aa17478..3656926 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -60,6 +60,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "ui/base/range/range.h" +#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" #include "webkit/plugins/plugin_constants.h" #include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/event_conversion.h" @@ -1624,7 +1625,7 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output, if (metafile.InitFromData(mapper.data(), mapper.size())) { // Flip the transform. CGContextRef cgContext = canvas; - CGContextSaveGState(cgContext); + gfx::ScopedCGContextSaveGState save_gstate(cgContext) CGContextTranslateCTM(cgContext, 0, current_print_settings_.printable_area.size.height); CGContextScaleCTM(cgContext, 1.0, -1.0); @@ -1635,7 +1636,6 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output, page_rect.size.height = current_print_settings_.printable_area.size.height; ret = metafile.RenderPage(1, cgContext, page_rect, true, false, true, true); - CGContextRestoreGState(cgContext); } #elif defined(OS_WIN) printing::Metafile* metafile = diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc index 616fde0..d492363 100644 --- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc +++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc @@ -21,6 +21,7 @@ #include "ui/gfx/blit.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" +#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" #include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/gfx_conversion.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" @@ -521,7 +522,7 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas, data_provider, NULL, false, kCGRenderingIntentDefault)); // Flip the transform - CGContextSaveGState(canvas); + gfx::ScopedCGContextSaveGState save_gstate(canvas) float window_height = static_cast<float>(CGBitmapContextGetHeight(canvas)); CGContextTranslateCTM(canvas, 0, window_height); CGContextScaleCTM(canvas, 1.0, -1.0); @@ -554,7 +555,6 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas, // if the is_always_opaque_ flag is set. Must ensure bitmap is still clipped. CGContextDrawImage(canvas, bitmap_rect, image); - CGContextRestoreGState(canvas); #else SkRect sk_plugin_rect = SkRect::MakeXYWH( SkIntToScalar(plugin_rect.origin().x()), |