OLD | NEW |
---|---|
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 for (ui::ScaleFactor scale_factor : ui::GetSupportedScaleFactors()) { | 165 for (ui::ScaleFactor scale_factor : ui::GetSupportedScaleFactors()) { |
166 float scale = GetScaleFactorScale(scale_factor); | 166 float scale = GetScaleFactorScale(scale_factor); |
167 NSBitmapImageRep *bmpImageRep = [[NSBitmapImageRep alloc] | 167 NSBitmapImageRep *bmpImageRep = [[NSBitmapImageRep alloc] |
168 initWithBitmapDataPlanes:NULL | 168 initWithBitmapDataPlanes:NULL |
169 pixelsWide:size.width * scale | 169 pixelsWide:size.width * scale |
170 pixelsHigh:size.height * scale | 170 pixelsHigh:size.height * scale |
171 bitsPerSample:8 | 171 bitsPerSample:8 |
172 samplesPerPixel:4 | 172 samplesPerPixel:4 |
173 hasAlpha:YES | 173 hasAlpha:YES |
174 isPlanar:NO | 174 isPlanar:NO |
175 colorSpaceName:NSCalibratedRGBColorSpace | 175 colorSpaceName:NSDeviceRGBColorSpace |
sail
2013/01/04 22:03:35
Does this help because it now matches the destinat
Nico
2013/01/04 22:05:55
I don't know if it helps. Resource images are load
sail
2013/01/04 23:51:33
ok, sounds like best practice would be to create a
| |
176 bitmapFormat:NSAlphaFirstBitmapFormat | |
sail
2013/01/04 22:03:35
Does this help because it prevents a format conver
Nico
2013/01/04 22:05:55
I think this is the default, I omitted this part f
| |
177 bytesPerRow:0 | 176 bytesPerRow:0 |
178 bitsPerPixel:0]; | 177 bitsPerPixel:0]; |
179 [bmpImageRep setSize:size]; | 178 [bmpImageRep setSize:size]; |
180 [NSGraphicsContext setCurrentContext: | 179 [NSGraphicsContext setCurrentContext: |
181 [NSGraphicsContext graphicsContextWithBitmapImageRep:bmpImageRep]]; | 180 [NSGraphicsContext graphicsContextWithBitmapImageRep:bmpImageRep]]; |
182 drawingHandler(size); | 181 drawingHandler(size); |
183 [result addRepresentation:bmpImageRep]; | 182 [result addRepresentation:bmpImageRep]; |
184 } | 183 } |
185 [NSGraphicsContext restoreGraphicsState]; | 184 [NSGraphicsContext restoreGraphicsState]; |
186 | 185 |
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2233 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { | 2232 NSView* GetSheetParentViewForWebContents(WebContents* web_contents) { |
2234 // View hierarchy of the contents view: | 2233 // View hierarchy of the contents view: |
2235 // NSView -- switchView, same for all tabs | 2234 // NSView -- switchView, same for all tabs |
2236 // +- NSView -- TabContentsController's view | 2235 // +- NSView -- TabContentsController's view |
2237 // +- TabContentsViewCocoa | 2236 // +- TabContentsViewCocoa |
2238 // | 2237 // |
2239 // Changing it? Do not forget to modify | 2238 // Changing it? Do not forget to modify |
2240 // -[TabStripController swapInTabAtIndex:] too. | 2239 // -[TabStripController swapInTabAtIndex:] too. |
2241 return [web_contents->GetNativeView() superview]; | 2240 return [web_contents->GetNativeView() superview]; |
2242 } | 2241 } |
OLD | NEW |