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& info, |
| 178 const SkPaint*) { |
| 179 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); |
| 180 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), |
| 181 info.fInfo.isOpaque()); |
| 182 } |
| 183 |
177 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { | 184 cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { |
178 LoadConfig(); | 185 LoadConfig(); |
179 cairo_surface_t* surface = cairo_get_target(cairo_); | 186 cairo_surface_t* surface = cairo_get_target(cairo_); |
180 // Tell cairo to flush anything it has pending. | 187 // Tell cairo to flush anything it has pending. |
181 cairo_surface_flush(surface); | 188 cairo_surface_flush(surface); |
182 // Tell Cairo that we (probably) modified (actually, will modify) its pixel | 189 // Tell Cairo that we (probably) modified (actually, will modify) its pixel |
183 // buffer directly. | 190 // buffer directly. |
184 cairo_surface_mark_dirty(surface); | 191 cairo_surface_mark_dirty(surface); |
185 return cairo_; | 192 return cairo_; |
186 } | 193 } |
(...skipping 29 matching lines...) Expand all Loading... |
216 width, | 223 width, |
217 height); | 224 height); |
218 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { | 225 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { |
219 cairo_surface_destroy(surf); | 226 cairo_surface_destroy(surf); |
220 return false; | 227 return false; |
221 } | 228 } |
222 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); | 229 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); |
223 } | 230 } |
224 | 231 |
225 } // namespace skia | 232 } // namespace skia |
OLD | NEW |