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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 326143002: Remove ui::GetImageScale (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac build Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <limits> 10 #include <limits>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Creates an NSImage with size |size| and bitmap image representations for both 142 // Creates an NSImage with size |size| and bitmap image representations for both
143 // 1x and 2x scale factors. |drawingHandler| is called once for every scale 143 // 1x and 2x scale factors. |drawingHandler| is called once for every scale
144 // factor. This is similar to -[NSImage imageWithSize:flipped:drawingHandler:], 144 // factor. This is similar to -[NSImage imageWithSize:flipped:drawingHandler:],
145 // but this function always evaluates drawingHandler eagerly, and it works on 145 // but this function always evaluates drawingHandler eagerly, and it works on
146 // 10.6 and 10.7. 146 // 10.6 and 10.7.
147 NSImage* CreateImageWithSize(NSSize size, 147 NSImage* CreateImageWithSize(NSSize size,
148 void (^drawingHandler)(NSSize)) { 148 void (^drawingHandler)(NSSize)) {
149 base::scoped_nsobject<NSImage> result([[NSImage alloc] initWithSize:size]); 149 base::scoped_nsobject<NSImage> result([[NSImage alloc] initWithSize:size]);
150 [NSGraphicsContext saveGraphicsState]; 150 [NSGraphicsContext saveGraphicsState];
151 for (ui::ScaleFactor scale_factor : ui::GetSupportedScaleFactors()) { 151 for (ui::ScaleFactor scale_factor : ui::GetSupportedScaleFactors()) {
152 float scale = GetImageScale(scale_factor); 152 float scale = GetScaleForScaleFactor(scale_factor);
153 NSBitmapImageRep *bmpImageRep = [[[NSBitmapImageRep alloc] 153 NSBitmapImageRep *bmpImageRep = [[[NSBitmapImageRep alloc]
154 initWithBitmapDataPlanes:NULL 154 initWithBitmapDataPlanes:NULL
155 pixelsWide:size.width * scale 155 pixelsWide:size.width * scale
156 pixelsHigh:size.height * scale 156 pixelsHigh:size.height * scale
157 bitsPerSample:8 157 bitsPerSample:8
158 samplesPerPixel:4 158 samplesPerPixel:4
159 hasAlpha:YES 159 hasAlpha:YES
160 isPlanar:NO 160 isPlanar:NO
161 colorSpaceName:NSDeviceRGBColorSpace 161 colorSpaceName:NSDeviceRGBColorSpace
162 bytesPerRow:0 162 bytesPerRow:0
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { 2229 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) {
2230 // View hierarchy of the contents view: 2230 // View hierarchy of the contents view:
2231 // NSView -- switchView, same for all tabs 2231 // NSView -- switchView, same for all tabs
2232 // +- NSView -- TabContentsController's view 2232 // +- NSView -- TabContentsController's view
2233 // +- TabContentsViewCocoa 2233 // +- TabContentsViewCocoa
2234 // 2234 //
2235 // Changing it? Do not forget to modify 2235 // Changing it? Do not forget to modify
2236 // -[TabStripController swapInTabAtIndex:] too. 2236 // -[TabStripController swapInTabAtIndex:] too.
2237 return [web_contents->GetNativeView() superview]; 2237 return [web_contents->GetNativeView() superview];
2238 } 2238 }
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_util.cc ('k') | chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698