| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_linux.h" | 5 #include "skia/ext/platform_canvas_linux.h" |
| 6 | 6 |
| 7 #include "skia/ext/platform_device_linux.h" | 7 #include "skia/ext/platform_device_linux.h" |
| 8 #include "skia/ext/bitmap_platform_device_linux.h" | 8 #include "skia/ext/bitmap_platform_device_linux.h" |
| 9 #include "SkTypes.h" | 9 #include "SkTypes.h" |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 SkDevice* device = | 46 SkDevice* device = |
| 47 BitmapPlatformDeviceLinux::Create(width, height, is_opaque, data); | 47 BitmapPlatformDeviceLinux::Create(width, height, is_opaque, data); |
| 48 if (!device) | 48 if (!device) |
| 49 return false; | 49 return false; |
| 50 | 50 |
| 51 setDevice(device); | 51 setDevice(device); |
| 52 device->unref(); // was created with refcount 1, and setDevice also refs | 52 device->unref(); // was created with refcount 1, and setDevice also refs |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 cairo_surface_t* PlatformCanvasLinux::beginPlatformPaint() { |
| 57 return getTopPlatformDevice().beginPlatformPaint(); |
| 58 } |
| 59 |
| 56 PlatformDeviceLinux& PlatformCanvasLinux::getTopPlatformDevice() const { | 60 PlatformDeviceLinux& PlatformCanvasLinux::getTopPlatformDevice() const { |
| 57 // All of our devices should be our special PlatformDevice. | 61 // All of our devices should be our special PlatformDevice. |
| 58 SkCanvas::LayerIter iter(const_cast<PlatformCanvasLinux*>(this), false); | 62 SkCanvas::LayerIter iter(const_cast<PlatformCanvasLinux*>(this), false); |
| 59 return *static_cast<PlatformDeviceLinux*>(iter.device()); | 63 return *static_cast<PlatformDeviceLinux*>(iter.device()); |
| 60 } | 64 } |
| 61 | 65 |
| 62 SkDevice* PlatformCanvasLinux::createDevice(SkBitmap::Config config, | 66 SkDevice* PlatformCanvasLinux::createDevice(SkBitmap::Config config, |
| 63 int width, | 67 int width, |
| 64 int height, | 68 int height, |
| 65 bool is_opaque, bool isForLayer) { | 69 bool is_opaque, bool isForLayer) { |
| 66 SkASSERT(config == SkBitmap::kARGB_8888_Config); | 70 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
| 67 return createPlatformDevice(width, height, is_opaque); | 71 return createPlatformDevice(width, height, is_opaque); |
| 68 } | 72 } |
| 69 | 73 |
| 70 SkDevice* PlatformCanvasLinux::createPlatformDevice(int width, | 74 SkDevice* PlatformCanvasLinux::createPlatformDevice(int width, |
| 71 int height, | 75 int height, |
| 72 bool is_opaque) { | 76 bool is_opaque) { |
| 73 return BitmapPlatformDeviceLinux::Create(width, height, is_opaque); | 77 return BitmapPlatformDeviceLinux::Create(width, height, is_opaque); |
| 74 } | 78 } |
| 75 | 79 |
| 76 // static | 80 // static |
| 77 size_t PlatformCanvasLinux::StrideForWidth(unsigned width) { | 81 size_t PlatformCanvasLinux::StrideForWidth(unsigned width) { |
| 78 return cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width); | 82 return cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width); |
| 79 } | 83 } |
| 80 | 84 |
| 81 } // namespace skia | 85 } // namespace skia |
| OLD | NEW |