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 22 matching lines...) Expand all Loading... |
33 SkASSERT(dst); | 33 SkASSERT(dst); |
34 if (!surface) { | 34 if (!surface) { |
35 return false; | 35 return false; |
36 } | 36 } |
37 SkImageInfo info | 37 SkImageInfo info |
38 = SkImageInfo::MakeN32Premul(cairo_image_surface_get_width(surface), | 38 = SkImageInfo::MakeN32Premul(cairo_image_surface_get_width(surface), |
39 cairo_image_surface_get_height(surface)); | 39 cairo_image_surface_get_height(surface)); |
40 return dst->installPixels(info, | 40 return dst->installPixels(info, |
41 cairo_image_surface_get_data(surface), | 41 cairo_image_surface_get_data(surface), |
42 cairo_image_surface_get_stride(surface), | 42 cairo_image_surface_get_stride(surface), |
| 43 NULL, |
43 &CairoSurfaceReleaseProc, | 44 &CairoSurfaceReleaseProc, |
44 static_cast<void*>(surface)); | 45 static_cast<void*>(surface)); |
45 } | 46 } |
46 | 47 |
47 void LoadMatrixToContext(cairo_t* context, const SkMatrix& matrix) { | 48 void LoadMatrixToContext(cairo_t* context, const SkMatrix& matrix) { |
48 cairo_matrix_t cairo_matrix; | 49 cairo_matrix_t cairo_matrix; |
49 cairo_matrix_init(&cairo_matrix, | 50 cairo_matrix_init(&cairo_matrix, |
50 SkScalarToFloat(matrix.getScaleX()), | 51 SkScalarToFloat(matrix.getScaleX()), |
51 SkScalarToFloat(matrix.getSkewY()), | 52 SkScalarToFloat(matrix.getSkewY()), |
52 SkScalarToFloat(matrix.getSkewX()), | 53 SkScalarToFloat(matrix.getSkewX()), |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 width, | 222 width, |
222 height); | 223 height); |
223 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { | 224 if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { |
224 cairo_surface_destroy(surf); | 225 cairo_surface_destroy(surf); |
225 return false; | 226 return false; |
226 } | 227 } |
227 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); | 228 return InstallCairoSurfacePixels(&bitmap_, surf, is_opaque); |
228 } | 229 } |
229 | 230 |
230 } // namespace skia | 231 } // namespace skia |
OLD | NEW |