| OLD | NEW |
| 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/bitmap_platform_device_mac.h" | 5 #include "skia/ext/bitmap_platform_device_mac.h" |
| 6 | 6 |
| 7 #import <ApplicationServices/ApplicationServices.h> | 7 #import <ApplicationServices/ApplicationServices.h> |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 | 9 |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Change the coordinate system to match WebCore's | 44 // Change the coordinate system to match WebCore's |
| 45 CGContextTranslateCTM(context, 0, height); | 45 CGContextTranslateCTM(context, 0, height); |
| 46 CGContextScaleCTM(context, 1.0, -1.0); | 46 CGContextScaleCTM(context, 1.0, -1.0); |
| 47 | 47 |
| 48 return context; | 48 return context; |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 SkDevice* BitmapPlatformDeviceFactory::newDevice(SkCanvas* ignored, |
| 54 SkBitmap::Config config, |
| 55 int width, int height, |
| 56 bool isOpaque, |
| 57 bool isForLayer) { |
| 58 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
| 59 return BitmapPlatformDevice::Create(NULL, width, height, isOpaque); |
| 60 } |
| 61 |
| 53 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( | 62 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( |
| 54 CGContextRef bitmap) | 63 CGContextRef bitmap) |
| 55 : bitmap_context_(bitmap), | 64 : bitmap_context_(bitmap), |
| 56 config_dirty_(true) { // Want to load the config next time. | 65 config_dirty_(true) { // Want to load the config next time. |
| 57 SkASSERT(bitmap_context_); | 66 SkASSERT(bitmap_context_); |
| 58 // Initialize the clip region to the entire bitmap. | 67 // Initialize the clip region to the entire bitmap. |
| 59 | 68 |
| 60 SkIRect rect; | 69 SkIRect rect; |
| 61 rect.set(0, 0, | 70 rect.set(0, 0, |
| 62 CGBitmapContextGetWidth(bitmap_context_), | 71 CGBitmapContextGetWidth(bitmap_context_), |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 CGImageRelease(image); | 236 CGImageRelease(image); |
| 228 | 237 |
| 229 if (created_dc) | 238 if (created_dc) |
| 230 data_->ReleaseBitmapContext(); | 239 data_->ReleaseBitmapContext(); |
| 231 } | 240 } |
| 232 | 241 |
| 233 void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) { | 242 void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) { |
| 234 // Not needed in CoreGraphics | 243 // Not needed in CoreGraphics |
| 235 } | 244 } |
| 236 | 245 |
| 237 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( | 246 SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() { |
| 238 SkBitmap::Config config, int width, int height, bool isOpaque, | 247 return SkNEW(BitmapPlatformDeviceFactory); |
| 239 Usage /*usage*/) { | |
| 240 SkASSERT(config == SkBitmap::kARGB_8888_Config); | |
| 241 return BitmapPlatformDevice::Create(NULL, width, height, isOpaque); | |
| 242 } | 248 } |
| 243 | 249 |
| 244 } // namespace skia | 250 } // namespace skia |
| OLD | NEW |