| 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/platform_canvas.h" | 5 #include "skia/ext/platform_canvas.h" |
| 6 | 6 |
| 7 #include "skia/ext/bitmap_platform_device.h" | 7 #include "skia/ext/bitmap_platform_device.h" |
| 8 #include "third_party/skia/include/core/SkTypes.h" | 8 #include "third_party/skia/include/core/SkTypes.h" |
| 9 | 9 |
| 10 namespace skia { | 10 namespace skia { |
| 11 | 11 |
| 12 PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) { | 12 PlatformCanvas::PlatformCanvas(int width, int height, bool is_opaque) { |
| 13 setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref(); |
| 13 initialize(width, height, is_opaque); | 14 initialize(width, height, is_opaque); |
| 14 } | 15 } |
| 15 | 16 |
| 16 PlatformCanvas::PlatformCanvas(int width, | 17 PlatformCanvas::PlatformCanvas(int width, |
| 17 int height, | 18 int height, |
| 18 bool is_opaque, | 19 bool is_opaque, |
| 19 CGContextRef context) { | 20 CGContextRef context) { |
| 21 setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref(); |
| 20 initialize(context, width, height, is_opaque); | 22 initialize(context, width, height, is_opaque); |
| 21 } | 23 } |
| 22 | 24 |
| 23 PlatformCanvas::PlatformCanvas(int width, | 25 PlatformCanvas::PlatformCanvas(int width, |
| 24 int height, | 26 int height, |
| 25 bool is_opaque, | 27 bool is_opaque, |
| 26 uint8_t* data) { | 28 uint8_t* data) { |
| 29 setDeviceFactory(SkNEW(BitmapPlatformDeviceFactory))->unref(); |
| 27 initialize(width, height, is_opaque, data); | 30 initialize(width, height, is_opaque, data); |
| 28 } | 31 } |
| 29 | 32 |
| 30 PlatformCanvas::~PlatformCanvas() { | 33 PlatformCanvas::~PlatformCanvas() { |
| 31 } | 34 } |
| 32 | 35 |
| 33 bool PlatformCanvas::initialize(int width, | 36 bool PlatformCanvas::initialize(int width, |
| 34 int height, | 37 int height, |
| 35 bool is_opaque, | 38 bool is_opaque, |
| 36 uint8_t* data) { | 39 uint8_t* data) { |
| 37 return initializeWithDevice(BitmapPlatformDevice::CreateWithData( | 40 return initializeWithDevice(BitmapPlatformDevice::CreateWithData( |
| 38 data, width, height, is_opaque)); | 41 data, width, height, is_opaque)); |
| 39 } | 42 } |
| 40 | 43 |
| 41 bool PlatformCanvas::initialize(CGContextRef context, | 44 bool PlatformCanvas::initialize(CGContextRef context, |
| 42 int width, | 45 int width, |
| 43 int height, | 46 int height, |
| 44 bool is_opaque) { | 47 bool is_opaque) { |
| 45 return initializeWithDevice(BitmapPlatformDevice::Create( | 48 return initializeWithDevice(BitmapPlatformDevice::Create( |
| 46 context, width, height, is_opaque)); | 49 context, width, height, is_opaque)); |
| 47 } | 50 } |
| 48 | 51 |
| 49 } // namespace skia | 52 } // namespace skia |
| OLD | NEW |