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 <stddef.h> | 8 #include <stddef.h> |
9 #include <time.h> | 9 #include <time.h> |
10 | 10 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo, | 253 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo, |
254 const SkPaint*) { | 254 const SkPaint*) { |
255 const SkImageInfo& info = cinfo.fInfo; | 255 const SkImageInfo& info = cinfo.fInfo; |
256 const bool do_clear = !info.isOpaque(); | 256 const bool do_clear = !info.isOpaque(); |
257 SkASSERT(info.colorType() == kN32_SkColorType); | 257 SkASSERT(info.colorType() == kN32_SkColorType); |
258 return Create(NULL, info.width(), info.height(), info.isOpaque(), do_clear); | 258 return Create(NULL, info.width(), info.height(), info.isOpaque(), do_clear); |
259 } | 259 } |
260 | 260 |
261 // PlatformCanvas impl | 261 // PlatformCanvas impl |
262 | 262 |
263 SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height, | 263 std::unique_ptr<SkCanvas> CreatePlatformCanvas(CGContextRef ctx, |
264 bool is_opaque, OnFailureType failureType) { | 264 int width, |
| 265 int height, |
| 266 bool is_opaque, |
| 267 OnFailureType failureType) { |
265 const bool do_clear = false; | 268 const bool do_clear = false; |
266 sk_sp<SkBaseDevice> dev( | 269 sk_sp<SkBaseDevice> dev( |
267 BitmapPlatformDevice::Create(ctx, width, height, is_opaque, do_clear)); | 270 BitmapPlatformDevice::Create(ctx, width, height, is_opaque, do_clear)); |
268 return CreateCanvas(dev, failureType); | 271 return CreateCanvas(dev, failureType); |
269 } | 272 } |
270 | 273 |
271 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, | 274 std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width, |
272 uint8_t* data, OnFailureType failureType) { | 275 int height, |
| 276 bool is_opaque, |
| 277 uint8_t* data, |
| 278 OnFailureType failureType) { |
273 sk_sp<SkBaseDevice> dev( | 279 sk_sp<SkBaseDevice> dev( |
274 BitmapPlatformDevice::CreateWithData(data, width, height, is_opaque)); | 280 BitmapPlatformDevice::CreateWithData(data, width, height, is_opaque)); |
275 return CreateCanvas(dev, failureType); | 281 return CreateCanvas(dev, failureType); |
276 } | 282 } |
277 | 283 |
278 } // namespace skia | 284 } // namespace skia |
OLD | NEW |