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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SkCanvas(device).drawColor(0xFF00FF80); | 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, | |
138 int height, | |
139 bool is_opaque) { | |
140 // The Linux port always constructs initialized bitmaps, so there is no extra | |
141 // work to perform here. | |
142 return Create(width, height, is_opaque); | |
143 } | |
144 | |
145 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, | 137 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, |
146 bool is_opaque, | 138 bool is_opaque, |
147 uint8_t* data) { | 139 uint8_t* data) { |
148 cairo_surface_t* surface = cairo_image_surface_create_for_data( | 140 cairo_surface_t* surface = cairo_image_surface_create_for_data( |
149 data, CAIRO_FORMAT_ARGB32, width, height, | 141 data, CAIRO_FORMAT_ARGB32, width, height, |
150 cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width)); | 142 cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width)); |
151 | 143 |
152 return Create(width, height, is_opaque, surface); | 144 return Create(width, height, is_opaque, surface); |
153 } | 145 } |
154 | 146 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // PlatformCanvas impl | 186 // PlatformCanvas impl |
195 | 187 |
196 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, | 188 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque, |
197 uint8_t* data, OnFailureType failureType) { | 189 uint8_t* data, OnFailureType failureType) { |
198 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( | 190 skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef( |
199 BitmapPlatformDevice::Create(width, height, is_opaque, data)); | 191 BitmapPlatformDevice::Create(width, height, is_opaque, data)); |
200 return CreateCanvas(dev, failureType); | 192 return CreateCanvas(dev, failureType); |
201 } | 193 } |
202 | 194 |
203 } // namespace skia | 195 } // namespace skia |
OLD | NEW |