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

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

Issue 12032003: Merge 175108 (for crbug.com/171096) (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 years, 11 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
===================================================================
--- chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm (revision 177864)
+++ chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm (working copy)
@@ -196,13 +196,25 @@
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,
+ 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