From fa47f1d6f6b26628080b5277f40dbcfafa571db1 Mon Sep 17 00:00:00 2001
From: "thakis@chromium.org"
 <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 19 Aug 2009 20:47:26 +0000
Subject: Add progress disks to os x download items. Some more spacing tweaks.
 Still not done.

BUG=18902
TEST=download something, note that a green disk appears, and disappears after some flashing after the download is done.

Review URL: http://codereview.chromium.org/174048

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23740 0039d316-1c4b-4281-b951-d872f2087c98
---
 skia/ext/canvas_paint_mac.h | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

(limited to 'skia/ext/canvas_paint_mac.h')

diff --git a/skia/ext/canvas_paint_mac.h b/skia/ext/canvas_paint_mac.h
index 9f4ae84..c72c79e 100644
--- a/skia/ext/canvas_paint_mac.h
+++ b/skia/ext/canvas_paint_mac.h
@@ -42,13 +42,22 @@ class CanvasPaintT : public T {
       CGImageRef image = CGBitmapContextCreateImage(context_);
       CGRect destRect = NSRectToCGRect(rectangle_);
 
-      CGContextRef context =
+      CGContextRef destinationContext =
           (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-      CGContextSaveGState(context);
+      CGContextSaveGState(destinationContext);
       CGContextSetBlendMode(
-          context, composite_alpha_ ? kCGBlendModeNormal : kCGBlendModeCopy);
-      CGContextDrawImage(context, destRect, image);
-      CGContextRestoreGState(context);
+          destinationContext,
+          composite_alpha_ ? kCGBlendModeNormal : kCGBlendModeCopy);
+
+      if ([[NSGraphicsContext currentContext] isFlipped]) {
+        // Mirror context on the target's rect middle scanline.
+        CGContextTranslateCTM(destinationContext, 0.0, NSMidY(rectangle_));
+        CGContextScaleCTM(destinationContext, 1.0, -1.0);
+        CGContextTranslateCTM(destinationContext, 0.0, -NSMidY(rectangle_));
+      }
+
+      CGContextDrawImage(destinationContext, destRect, image);
+      CGContextRestoreGState(destinationContext);
 
       CFRelease(image);
     }
-- 
cgit v1.1