OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 CGContextRelease(context); | 139 CGContextRelease(context); |
140 | 140 |
141 return rv; | 141 return rv; |
142 } | 142 } |
143 | 143 |
144 BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width, | 144 BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width, |
145 int height, | 145 int height, |
146 bool is_opaque) { | 146 bool is_opaque) { |
147 BitmapPlatformDevice* device = Create(NULL, width, height, is_opaque); | 147 BitmapPlatformDevice* device = Create(NULL, width, height, is_opaque); |
148 if (!is_opaque) | 148 if (!is_opaque) |
149 device->accessBitmap(true).eraseARGB(0, 0, 0, 0); | 149 device->clear(0); |
150 return device; | 150 return device; |
151 } | 151 } |
152 | 152 |
153 BitmapPlatformDevice* BitmapPlatformDevice::CreateWithData(uint8_t* data, | 153 BitmapPlatformDevice* BitmapPlatformDevice::CreateWithData(uint8_t* data, |
154 int width, | 154 int width, |
155 int height, | 155 int height, |
156 bool is_opaque) { | 156 bool is_opaque) { |
157 CGContextRef context = NULL; | 157 CGContextRef context = NULL; |
158 if (data) | 158 if (data) |
159 context = CGContextForData(data, width, height); | 159 context = CGContextForData(data, width, height); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 if (!is_opaque) | 283 if (!is_opaque) |
284 bitmap_.eraseColor(0); | 284 bitmap_.eraseColor(0); |
285 | 285 |
286 surface_ = CGContextForData(bitmap_.getPixels(), bitmap_.width(), | 286 surface_ = CGContextForData(bitmap_.getPixels(), bitmap_.width(), |
287 bitmap_.height()); | 287 bitmap_.height()); |
288 return true; | 288 return true; |
289 } | 289 } |
290 | 290 |
291 } // namespace skia | 291 } // namespace skia |
OLD | NEW |