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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 cairo_destroy(cairo_); | 167 cairo_destroy(cairo_); |
168 } | 168 } |
169 | 169 |
170 SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice( | 170 SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice( |
171 const CreateInfo& info) { | 171 const CreateInfo& info) { |
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 SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const CreateInfo& cinfo, | |
178 const SkPaint*) { | |
179 // until skia lands its new virtual for this method | |
180 return onCreateCompatibleDevice(cinfo); | |
181 } | |
182 | |
183 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { | 177 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { |
184 LoadConfig(); | 178 LoadConfig(); |
185 cairo_surface_t* surface = cairo_get_target(cairo_); | 179 cairo_surface_t* surface = cairo_get_target(cairo_); |
186 // Tell cairo to flush anything it has pending. | 180 // Tell cairo to flush anything it has pending. |
187 cairo_surface_flush(surface); | 181 cairo_surface_flush(surface); |
188 // Tell Cairo that we (probably) modified (actually, will modify) its pixel | 182 // Tell Cairo that we (probably) modified (actually, will modify) its pixel |
189 // buffer directly. | 183 // buffer directly. |
190 cairo_surface_mark_dirty(surface); | 184 cairo_surface_mark_dirty(surface); |
191 return cairo_; | 185 return cairo_; |
192 } | 186 } |
(...skipping 29 matching lines...) Expand all Loading... |
222 width, | 216 width, |
223 height); | 217 height); |
224 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { | 218 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { |
225 cairo_surface_destroy(surf); | 219 cairo_surface_destroy(surf); |
226 return false; | 220 return false; |
227 } | 221 } |
228 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); | 222 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); |
229 } | 223 } |
230 | 224 |
231 } // namespace skia | 225 } // namespace skia |
OLD | NEW |