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

Side by Side Diff: skia/ext/bitmap_platform_device_mac.cc

Issue 6046009: Move base/mac_util.h to base/mac and use the base::mac namespace.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_server_mac.cc ('k') | webkit/plugins/npapi/plugin_list_mac.mm » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/bitmap_platform_device_mac.h" 5 #include "skia/ext/bitmap_platform_device_mac.h"
6 6
7 #include <time.h> 7 #include <time.h>
8 8
9 #include "base/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
11 #include "skia/ext/bitmap_platform_device_data.h" 11 #include "skia/ext/bitmap_platform_device_data.h"
12 #include "skia/ext/skia_utils_mac.h" 12 #include "skia/ext/skia_utils_mac.h"
13 #include "third_party/skia/include/core/SkMatrix.h" 13 #include "third_party/skia/include/core/SkMatrix.h"
14 #include "third_party/skia/include/core/SkRegion.h" 14 #include "third_party/skia/include/core/SkRegion.h"
15 #include "third_party/skia/include/core/SkTypes.h" 15 #include "third_party/skia/include/core/SkTypes.h"
16 #include "third_party/skia/include/core/SkUtils.h" 16 #include "third_party/skia/include/core/SkUtils.h"
17 17
18 namespace skia { 18 namespace skia {
19 19
20 namespace { 20 namespace {
21 21
22 static CGContextRef CGContextForData(void* data, int width, int height) { 22 static CGContextRef CGContextForData(void* data, int width, int height) {
23 #define HAS_ARGB_SHIFTS(a, r, g, b) \ 23 #define HAS_ARGB_SHIFTS(a, r, g, b) \
24 (SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \ 24 (SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \
25 && SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b)) 25 && SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b))
26 #if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0) 26 #if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0)
27 // Allocate a bitmap context with 4 components per pixel (BGRA). Apple 27 // Allocate a bitmap context with 4 components per pixel (BGRA). Apple
28 // recommends these flags for improved CG performance. 28 // recommends these flags for improved CG performance.
29 CGContextRef context = 29 CGContextRef context =
30 CGBitmapContextCreate(data, width, height, 8, width * 4, 30 CGBitmapContextCreate(data, width, height, 8, width * 4,
31 mac_util::GetSystemColorSpace(), 31 base::mac::GetSystemColorSpace(),
32 kCGImageAlphaPremultipliedFirst | 32 kCGImageAlphaPremultipliedFirst |
33 kCGBitmapByteOrder32Host); 33 kCGBitmapByteOrder32Host);
34 #else 34 #else
35 #error We require that Skia's and CoreGraphics's recommended \ 35 #error We require that Skia's and CoreGraphics's recommended \
36 image memory layout match. 36 image memory layout match.
37 #endif 37 #endif
38 #undef HAS_ARGB_SHIFTS 38 #undef HAS_ARGB_SHIFTS
39 39
40 if (!context) 40 if (!context)
41 return NULL; 41 return NULL;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 SkAutoLockPixels lock(bitmap); 254 SkAutoLockPixels lock(bitmap);
255 uint32_t* data = bitmap.getAddr32(0, 0); 255 uint32_t* data = bitmap.getAddr32(0, 0);
256 return static_cast<SkColor>(data[x + y * width()]); 256 return static_cast<SkColor>(data[x + y * width()]);
257 } 257 }
258 258
259 void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) { 259 void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) {
260 // Not needed in CoreGraphics 260 // Not needed in CoreGraphics
261 } 261 }
262 262
263 } // namespace skia 263 } // namespace skia
OLDNEW
« no previous file with comments | « net/proxy/proxy_server_mac.cc ('k') | webkit/plugins/npapi/plugin_list_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698