summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 16:22:08 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 16:22:08 +0000
commit0f163d26d5c24846b3bed5925a0f75e5d28c7643 (patch)
tree84d8af51bb227f0604bff5b24d8a71545fdfe3fe /chrome
parentdfdcdab1133d41ae12a7fbde3f1d9e8894ad410e (diff)
downloadchromium_src-0f163d26d5c24846b3bed5925a0f75e5d28c7643.zip
chromium_src-0f163d26d5c24846b3bed5925a0f75e5d28c7643.tar.gz
chromium_src-0f163d26d5c24846b3bed5925a0f75e5d28c7643.tar.bz2
[Mac] Adapt browser-action image-drawing to ignore flipped.
Changed drawing to use -drawInRect: rather than -drawAtPoint: so that the neverFlipped: flag can be passed. BUG=38943 TEST=Browser actions draw upright in both toolbar and overflow popup. Review URL: http://codereview.chromium.org/2685001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49262 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cocoa/extensions/browser_action_button.mm21
1 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/cocoa/extensions/browser_action_button.mm b/chrome/browser/cocoa/extensions/browser_action_button.mm
index 8f1150a..946f872 100644
--- a/chrome/browser/cocoa/extensions/browser_action_button.mm
+++ b/chrome/browser/cocoa/extensions/browser_action_button.mm
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/cocoa/extensions/extension_action_context_menu.h"
+#import "chrome/browser/cocoa/image_utils.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_action.h"
@@ -303,16 +304,16 @@ class ExtensionImageTrackerBridge : public NotificationObserver,
[[self cell] setIconShadow];
NSImage* actionImage = [self image];
- // Never draw within a flipped coordinate system.
- // TODO(andybons): Figure out why |flipped| can be yes in certain cases.
- // http://crbug.com/38943
- [actionImage setFlipped:NO];
- CGFloat xPos = std::floor((NSWidth(bounds) - [actionImage size].width) / 2);
- CGFloat yPos = std::floor((NSHeight(bounds) - [actionImage size].height) / 2);
- [actionImage drawAtPoint:NSMakePoint(xPos, yPos)
- fromRect:NSZeroRect
- operation:NSCompositeSourceOver
- fraction:1.0];
+ const NSSize imageSize = [actionImage size];
+ const NSRect imageRect =
+ NSMakeRect(std::floor((NSWidth(bounds) - imageSize.width) / 2.0),
+ std::floor((NSHeight(bounds) - imageSize.height) / 2.0),
+ imageSize.width, imageSize.height);
+ [actionImage drawInRect:imageRect
+ fromRect:NSZeroRect
+ operation:NSCompositeSourceOver
+ fraction:1.0
+ neverFlipped:YES];
bounds.origin.y += kShadowOffset - kBrowserActionBadgeOriginYOffset;
bounds.origin.x -= kShadowOffset;