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::onCreateDevice(const SkImageInfo& info, | 170 SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice( |
171 Usage /*usage*/) { | 171 const CreateInfo& info) { |
172 SkASSERT(info.colorType() == kN32_SkColorType); | 172 SkASSERT(info.fInfo.colorType() == kN32_SkColorType); |
173 return BitmapPlatformDevice::Create(info.width(), info.height(), | 173 return BitmapPlatformDevice::Create(info.fInfo.width(), info.fInfo.height(), |
174 info.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); |
182 // Tell Cairo that we (probably) modified (actually, will modify) its pixel | 182 // Tell Cairo that we (probably) modified (actually, will modify) its pixel |
183 // buffer directly. | 183 // buffer directly. |
184 cairo_surface_mark_dirty(surface); | 184 cairo_surface_mark_dirty(surface); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 width, | 222 width, |
223 height); | 223 height); |
224 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { | 224 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { |
225 cairo_surface_destroy(surf); | 225 cairo_surface_destroy(surf); |
226 return false; | 226 return false; |
227 } | 227 } |
228 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); | 228 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); |
229 } | 229 } |
230 | 230 |
231 } // namespace skia | 231 } // namespace skia |
OLD | NEW |