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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 11748026: mac: Attempt to fix a startup perf regression caused by r174778 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 2e93810ae3ca9ff23498d133f984c7b163759a30..ef3997d2ecb0104d0bd6ade5d0070c88a94d2f98 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -196,13 +196,25 @@ NSImage* ApplyMask(NSImage* image, NSImage* mask) {
const int kYOffset = 10;
CGFloat width = size.width;
CGFloat height = size.height;
+
// In some themes, the tab background image is narrower than the
// new tab button, so tile the background image.
- NSDrawThreePartImage(
- NSMakeRect(0, -([image size].height - height - kYOffset),
- width, [image size].height),
- nil, image, nil, /*vertical=*/NO, NSCompositeCopy,
- 1.0, /*flipped=*/NO);
+ CGFloat x = 0;
+ // The floor() is to make sure images with odd widths don't draw to the
+ // same pixel twice on retina displays. (Using NSDrawThreePartImage()
+ // caused a startup perf regression, so that cannot be used.)
+ CGFloat tileWidth = floor(std::min(width, [image size].width));
+ while (x < width) {
+ [image drawAtPoint:NSMakePoint(x, 0)
+ fromRect:NSMakeRect(0,
+ [image size].height - height - kYOffset,
sail 2013/01/04 01:23:32 could cache this above as well
Nico 2013/01/04 01:29:51 That hopefully isn't necessary (because a) the com
+ tileWidth,
+ height)
+ operation:NSCompositeCopy
+ fraction:1.0];
+ x += tileWidth;
+ }
+
[mask drawAtPoint:NSZeroPoint
fromRect:NSMakeRect(0, 0, width, height)
operation:NSCompositeDestinationIn
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698