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

Side by Side Diff: skia/ext/skia_utils_mac.mm

Issue 7130001: Make infobar background gray (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 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
« no previous file with comments | « skia/ext/skia_utils_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "skia/ext/skia_utils_mac.h" 5 #include "skia/ext/skia_utils_mac.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 180
181 // Converts ARGB to CGColorRef. 181 // Converts ARGB to CGColorRef.
182 CGColorRef SkColorToCGColorRef(SkColor color) { 182 CGColorRef SkColorToCGColorRef(SkColor color) {
183 return CGColorCreateGenericRGB(SkColorGetR(color) / 255.0, 183 return CGColorCreateGenericRGB(SkColorGetR(color) / 255.0,
184 SkColorGetG(color) / 255.0, 184 SkColorGetG(color) / 255.0,
185 SkColorGetB(color) / 255.0, 185 SkColorGetB(color) / 255.0,
186 SkColorGetA(color) / 255.0); 186 SkColorGetA(color) / 255.0);
187 } 187 }
188 188
189 // Converts ARGB to NSColor.
190 NSColor* SkColorToCalibratedNSColor(SkColor color) {
191 return [NSColor colorWithCalibratedRed:SkColorGetR(color) / 255.0
192 green:SkColorGetG(color) / 255.0
193 blue:SkColorGetB(color) / 255.0
194 alpha:SkColorGetA(color) / 255.0];
195 }
196
189 SkBitmap CGImageToSkBitmap(CGImageRef image) { 197 SkBitmap CGImageToSkBitmap(CGImageRef image) {
190 if (!image) 198 if (!image)
191 return SkBitmap(); 199 return SkBitmap();
192 200
193 int width = CGImageGetWidth(image); 201 int width = CGImageGetWidth(image);
194 int height = CGImageGetHeight(image); 202 int height = CGImageGetHeight(image);
195 203
196 scoped_ptr<SkDevice> device( 204 scoped_ptr<SkDevice> device(
197 skia::BitmapPlatformDevice::Create(NULL, width, height, false)); 205 skia::BitmapPlatformDevice::Create(NULL, width, height, false));
198 206
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 345
338 // Apply content matrix. 346 // Apply content matrix.
339 const SkMatrix& skMatrix = canvas_->getTotalMatrix(); 347 const SkMatrix& skMatrix = canvas_->getTotalMatrix();
340 CGAffineTransform affine = SkMatrixToCGAffineTransform(skMatrix); 348 CGAffineTransform affine = SkMatrixToCGAffineTransform(skMatrix);
341 CGContextConcatCTM(cgContext_, affine); 349 CGContextConcatCTM(cgContext_, affine);
342 350
343 return cgContext_; 351 return cgContext_;
344 } 352 }
345 353
346 } // namespace gfx 354 } // namespace gfx
OLDNEW
« no previous file with comments | « skia/ext/skia_utils_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698