| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (context) | 173 if (context) |
| 174 CGContextRelease(context); | 174 CGContextRelease(context); |
| 175 | 175 |
| 176 return rv; | 176 return rv; |
| 177 } | 177 } |
| 178 | 178 |
| 179 // The device will own the bitmap, which corresponds to also owning the pixel | 179 // The device will own the bitmap, which corresponds to also owning the pixel |
| 180 // data. Therefore, we do not transfer ownership to the SkDevice's bitmap. | 180 // data. Therefore, we do not transfer ownership to the SkDevice's bitmap. |
| 181 BitmapPlatformDevice::BitmapPlatformDevice( | 181 BitmapPlatformDevice::BitmapPlatformDevice( |
| 182 BitmapPlatformDeviceData* data, const SkBitmap& bitmap) | 182 BitmapPlatformDeviceData* data, const SkBitmap& bitmap) |
| 183 : SkDevice(bitmap), | 183 : PlatformDevice(bitmap), |
| 184 data_(data) { | 184 data_(data) { |
| 185 SetPlatformDevice(this, this); | |
| 186 } | 185 } |
| 187 | 186 |
| 188 BitmapPlatformDevice::~BitmapPlatformDevice() { | 187 BitmapPlatformDevice::~BitmapPlatformDevice() { |
| 189 data_->unref(); | 188 data_->unref(); |
| 190 } | 189 } |
| 191 | 190 |
| 192 CGContextRef BitmapPlatformDevice::GetBitmapContext() { | 191 CGContextRef BitmapPlatformDevice::GetBitmapContext() { |
| 193 data_->LoadConfig(); | 192 data_->LoadConfig(); |
| 194 return data_->bitmap_context(); | 193 return data_->bitmap_context(); |
| 195 } | 194 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 235 } |
| 237 | 236 |
| 238 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( | 237 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( |
| 239 SkBitmap::Config config, int width, int height, bool isOpaque, | 238 SkBitmap::Config config, int width, int height, bool isOpaque, |
| 240 Usage /*usage*/) { | 239 Usage /*usage*/) { |
| 241 SkASSERT(config == SkBitmap::kARGB_8888_Config); | 240 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
| 242 return BitmapPlatformDevice::Create(NULL, width, height, isOpaque); | 241 return BitmapPlatformDevice::Create(NULL, width, height, isOpaque); |
| 243 } | 242 } |
| 244 | 243 |
| 245 } // namespace skia | 244 } // namespace skia |
| OLD | NEW |