| 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 std::unique_ptr<SkCanvas> CreatePlatformCanvas(CGContextRef ctx, | 263 SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height, |
| 264 int width, | 264 bool is_opaque, OnFailureType failureType) { |
| 265 int height, | |
| 266 bool is_opaque, | |
| 267 OnFailureType failureType) { | |
| 268 const bool do_clear = false; | 265 const bool do_clear = false; |
| 269 sk_sp<SkBaseDevice> dev( | 266 sk_sp<SkBaseDevice> dev( |
| 270 BitmapPlatformDevice::Create(ctx, width, height, is_opaque, do_clear)); | 267 BitmapPlatformDevice::Create(ctx, width, height, is_opaque, do_clear)); |
| 271 return CreateCanvas(dev, failureType); | 268 return CreateCanvas(dev, failureType); |
| 272 } | 269 } |
| 273 | 270 |
| 274 std::unique_ptr<SkCanvas> CreatePlatformCanvas(int width, | 271 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, |
| 275 int height, | 272 uint8_t* data, OnFailureType failureType) { |
| 276 bool is_opaque, | |
| 277 uint8_t* data, | |
| 278 OnFailureType failureType) { | |
| 279 sk_sp<SkBaseDevice> dev( | 273 sk_sp<SkBaseDevice> dev( |
| 280 BitmapPlatformDevice::CreateWithData(data, width, height, is_opaque)); | 274 BitmapPlatformDevice::CreateWithData(data, width, height, is_opaque)); |
| 281 return CreateCanvas(dev, failureType); | 275 return CreateCanvas(dev, failureType); |
| 282 } | 276 } |
| 283 | 277 |
| 284 } // namespace skia | 278 } // namespace skia |
| OLD | NEW |