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

Unified Diff: ui/base/clipboard/clipboard_mac.mm

Issue 7572031: Always call the class methods to save/restore contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reword Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/clipboard/clipboard_mac.mm
diff --git a/ui/base/clipboard/clipboard_mac.mm b/ui/base/clipboard/clipboard_mac.mm
index 9f65e79e7c3f2e26c73d4ca72268a6d58c6f2a7f..bc8efede1c52d7e4cf793aa3e64ffec446a54a83 100644
--- a/ui/base/clipboard/clipboard_mac.mm
+++ b/ui/base/clipboard/clipboard_mac.mm
@@ -16,6 +16,7 @@
#import "third_party/mozilla/NSPasteboard+Utils.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/canvas_skia.h"
+#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
#include "ui/gfx/size.h"
namespace ui {
@@ -248,6 +249,7 @@ SkBitmap Clipboard::ReadImage(Buffer buffer) const {
scoped_nsobject<NSImage> image(
[[NSImage alloc] initWithPasteboard:GetPasteboard()]);
if (image.get()) {
+ gfx::ScopedNSGraphicsContextSaveGState scoped_state;
[image setFlipped:YES];
int width = [image size].width;
int height = [image size].height;
@@ -262,7 +264,6 @@ SkBitmap Clipboard::ReadImage(Buffer buffer) const {
fromRect:NSZeroRect
operation:NSCompositeCopy
fraction:1.0];
- [NSGraphicsContext restoreGraphicsState];
return canvas.ExtractBitmap();
}
return SkBitmap();

Powered by Google App Engine
This is Rietveld 408576698