OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_cairo.h" | 5 #include "skia/ext/bitmap_platform_device_cairo.h" |
6 #include "skia/ext/platform_canvas.h" | 6 #include "skia/ext/platform_canvas.h" |
7 | 7 |
8 #if defined(OS_OPENBSD) | 8 #if defined(OS_OPENBSD) |
9 #include <cairo.h> | 9 #include <cairo.h> |
10 #else | 10 #else |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 cairo_(cairo), | 160 cairo_(cairo), |
161 config_dirty_(true), | 161 config_dirty_(true), |
162 transform_(SkMatrix::I()) { // Want to load the config next time. | 162 transform_(SkMatrix::I()) { // Want to load the config next time. |
163 SetPlatformDevice(this, this); | 163 SetPlatformDevice(this, this); |
164 } | 164 } |
165 | 165 |
166 BitmapPlatformDevice::~BitmapPlatformDevice() { | 166 BitmapPlatformDevice::~BitmapPlatformDevice() { |
167 cairo_destroy(cairo_); | 167 cairo_destroy(cairo_); |
168 } | 168 } |
169 | 169 |
170 SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice( | |
171 const CreateInfo& info) { | |
172 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); | |
173 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), | |
174 info.fInfo.isOpaque()); | |
175 } | |
176 | |
177 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& info, | 170 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& info, |
178 const SkPaint*) { | 171 const SkPaint*) { |
179 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); | 172 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); |
180 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), | 173 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), |
181 info.fInfo.isOpaque()); | 174 info.fInfo.isOpaque()); |
182 } | 175 } |
183 | 176 |
184 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { | 177 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { |
185 LoadConfig(); | 178 LoadConfig(); |
186 cairo_surface_t* surface = cairo_get_target(cairo_); | 179 cairo_surface_t* surface = cairo_get_target(cairo_); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 width, | 216 width, |
224 height); | 217 height); |
225 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { | 218 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { |
226 cairo_surface_destroy(surf); | 219 cairo_surface_destroy(surf); |
227 return false; | 220 return false; |
228 } | 221 } |
229 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); | 222 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); |
230 } | 223 } |
231 | 224 |
232 } // namespace skia | 225 } // namespace skia |
OLD | NEW |