Index: skia/ext/skia_utils_mac.mm |
diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm |
index 6781a93f120df52c358ec6de5eccb60d97817190..d6394602985f3ed98b8c191181314e255fff8576 100644 |
--- a/skia/ext/skia_utils_mac.mm |
+++ b/skia/ext/skia_utils_mac.mm |
@@ -14,7 +14,6 @@ |
#include "skia/ext/bitmap_platform_device_mac.h" |
#include "third_party/skia/include/core/SkRegion.h" |
#include "third_party/skia/include/utils/mac/SkCGUtils.h" |
-#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
// 10.6 API that we use if available. |
#if !defined(MAC_OS_X_VERSION_10_6) || \ |
@@ -76,7 +75,8 @@ SkBitmap NSImageOrNSImageRepToSkBitmap( |
DCHECK(context); |
// Save the current graphics context so that we can restore it later. |
- gfx::ScopedNSGraphicsContextSaveGState scoped_g_state; |
+ NSGraphicsContext* old_context = [NSGraphicsContext currentContext]; |
+ [NSGraphicsContext saveGraphicsState]; |
// Dummy context that we will draw into. |
NSGraphicsContext* context_cocoa = |
@@ -110,6 +110,10 @@ SkBitmap NSImageOrNSImageRepToSkBitmap( |
} |
} |
+ [NSGraphicsContext restoreGraphicsState]; |
+ if (!old_context && base::mac::IsOSLeopardOrEarlier()) |
Robert Sesek
2012/03/05 15:49:46
Remove this condition; it's logic that would only
Nico
2012/03/05 15:58:35
Why's that? -currentContext could return nil, coul
Robert Sesek
2012/03/05 17:23:58
Because we're in a drawing context. The scoper is
Nico
2012/03/05 17:33:00
I don't understand, can you expand a bit? Why is -
Robert Sesek
2012/03/05 17:40:04
DAMN YOU RIETEVELD. I thought this was in |-drawRe
|
+ [NSGraphicsContext setCurrentContext:nil]; |
+ |
return bitmap; |
} |