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( | 170 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& info, |
171 const CreateInfo& info) { | 171 const SkPaint*) { |
172 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); | 172 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); |
173 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), | 173 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), |
174 info.fInfo.isOpaque()); | 174 info.fInfo.isOpaque()); |
175 } | 175 } |
176 | 176 |
177 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { | 177 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { |
178 LoadConfig(); | 178 LoadConfig(); |
179 cairo_surface_t* surface = cairo_get_target(cairo_); | 179 cairo_surface_t* surface = cairo_get_target(cairo_); |
180 // Tell cairo to flush anything it has pending. | 180 // Tell cairo to flush anything it has pending. |
181 cairo_surface_flush(surface); | 181 cairo_surface_flush(surface); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 width, | 216 width, |
217 height); | 217 height); |
218 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { | 218 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { |
219 cairo_surface_destroy(surf); | 219 cairo_surface_destroy(surf); |
220 return false; | 220 return false; |
221 } | 221 } |
222 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); | 222 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); |
223 } | 223 } |
224 | 224 |
225 } // namespace skia | 225 } // namespace skia |
OLD | NEW |