| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, | 121 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, |
| 122 bool is_opaque) { | 122 bool is_opaque) { |
| 123 // This initializes the bitmap to all zeros. | 123 // This initializes the bitmap to all zeros. |
| 124 cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, | 124 cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, |
| 125 width, height); | 125 width, height); |
| 126 | 126 |
| 127 BitmapPlatformDevice* device = Create(width, height, is_opaque, surface); | 127 BitmapPlatformDevice* device = Create(width, height, is_opaque, surface); |
| 128 | 128 |
| 129 #ifndef NDEBUG | 129 #ifndef NDEBUG |
| 130 if (device && is_opaque) // Fill with bright bluish green | 130 if (device && is_opaque) // Fill with bright bluish green |
| 131 device->eraseColor(SkColorSetARGB(255, 0, 255, 128)); | 131 SkCanvas(device).drawColor(0xFF00FF80); |
| 132 #endif | 132 #endif |
| 133 | 133 |
| 134 return device; | 134 return device; |
| 135 } | 135 } |
| 136 | 136 |
| 137 BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width, | 137 BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width, |
| 138 int height, | 138 int height, |
| 139 bool is_opaque) { | 139 bool is_opaque) { |
| 140 // The Linux port always constructs initialized bitmaps, so there is no extra | 140 // The Linux port always constructs initialized bitmaps, so there is no extra |
| 141 // work to perform here. | 141 // work to perform here. |
| (...skipping 80 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 |