OLD | NEW |
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_util.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // Change the coordinate system to match WebCore's | 43 // Change the coordinate system to match WebCore's |
44 CGContextTranslateCTM(context, 0, height); | 44 CGContextTranslateCTM(context, 0, height); |
45 CGContextScaleCTM(context, 1.0, -1.0); | 45 CGContextScaleCTM(context, 1.0, -1.0); |
46 | 46 |
47 return context; | 47 return context; |
48 } | 48 } |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 | 51 |
| 52 SkDevice* SkBitmapPlatformDeviceFactory::newDevice(SkBitmap::Config config, |
| 53 int width, int height, |
| 54 bool isOpaque, |
| 55 bool isForLayer) { |
| 56 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
| 57 return BitmapPlatformDevice::Create(NULL, width, height, isOpaque); |
| 58 } |
| 59 |
52 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( | 60 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( |
53 CGContextRef bitmap) | 61 CGContextRef bitmap) |
54 : bitmap_context_(bitmap), | 62 : bitmap_context_(bitmap), |
55 config_dirty_(true) { // Want to load the config next time. | 63 config_dirty_(true) { // Want to load the config next time. |
56 SkASSERT(bitmap_context_); | 64 SkASSERT(bitmap_context_); |
57 // Initialize the clip region to the entire bitmap. | 65 // Initialize the clip region to the entire bitmap. |
58 | 66 |
59 SkIRect rect; | 67 SkIRect rect; |
60 rect.set(0, 0, | 68 rect.set(0, 0, |
61 CGBitmapContextGetWidth(bitmap_context_), | 69 CGBitmapContextGetWidth(bitmap_context_), |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 SkAutoLockPixels lock(bitmap); | 254 SkAutoLockPixels lock(bitmap); |
247 uint32_t* data = bitmap.getAddr32(0, 0); | 255 uint32_t* data = bitmap.getAddr32(0, 0); |
248 return static_cast<SkColor>(data[x + y * width()]); | 256 return static_cast<SkColor>(data[x + y * width()]); |
249 } | 257 } |
250 | 258 |
251 void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) { | 259 void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) { |
252 // Not needed in CoreGraphics | 260 // Not needed in CoreGraphics |
253 } | 261 } |
254 | 262 |
255 } // namespace skia | 263 } // namespace skia |
OLD | NEW |