OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/vector_canvas.h" | 5 #include "skia/ext/vector_canvas.h" |
6 | 6 |
7 #include "skia/ext/vector_platform_device.h" | 7 #include "skia/ext/vector_platform_device.h" |
8 | 8 |
9 namespace skia { | 9 namespace skia { |
10 | 10 |
11 VectorCanvas::VectorCanvas(cairo_t* context, int width, int height) { | 11 VectorCanvas::VectorCanvas(cairo_t* context, int width, int height) { |
12 bool initialized = initialize(context, width, height); | 12 bool initialized = initialize(context, width, height); |
13 | 13 |
14 SkASSERT(initialized); | 14 SkASSERT(initialized); |
15 } | 15 } |
16 | 16 |
17 bool VectorCanvas::initialize(cairo_t* context, int width, int height) { | 17 bool VectorCanvas::initialize(cairo_t* context, int width, int height) { |
18 SkDevice* device = VectorPlatformDeviceFactory::CreateDevice(context, width, | 18 SkDevice* device = VectorPlatformDeviceFactory::CreateDevice(context, width, |
19 height, true); | 19 height, true); |
20 if (!device) | 20 if (!device) |
21 return false; | 21 return false; |
22 | 22 |
23 setDevice(device); | 23 setDevice(device); |
24 device->unref(); // was created with refcount 1, and setDevice also refs | 24 device->unref(); // was created with refcount 1, and setDevice also refs |
25 return true; | 25 return true; |
26 } | 26 } |
27 | 27 |
28 } // namespace skia | 28 } // namespace skia |
OLD | NEW |