Index: skia/ext/bitmap_platform_device_linux.cc |
=================================================================== |
--- skia/ext/bitmap_platform_device_linux.cc (revision 160846) |
+++ skia/ext/bitmap_platform_device_linux.cc (working copy) |
@@ -3,8 +3,8 @@ |
// found in the LICENSE file. |
#include "skia/ext/bitmap_platform_device_linux.h" |
- |
#include "skia/ext/bitmap_platform_device_data.h" |
+#include "skia/ext/platform_canvas.h" |
#if defined(OS_OPENBSD) |
#include <cairo.h> |
@@ -176,4 +176,28 @@ |
data_->SetMatrixClip(transform, region); |
} |
+// Port of PlatformBitmap to linux |
+ |
+PlatformBitmap::~PlatformBitmap() { |
+ cairo_destroy(surface_); |
+} |
+ |
+bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) { |
+ cairo_surface_t* surf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, |
+ width, height); |
+ if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) { |
+ cairo_surface_destroy(surf); |
+ return false; |
+ } |
+ |
+ bitmap_.setConfig(SkBitmap::kARGB_8888_Config, width, height, |
+ cairo_image_surface_get_stride(surf)); |
+ bitmap_.setPixels(cairo_image_surface_get_data(surf)); |
+ bitmap_.setIsOpaque(is_opaque); |
+ |
+ surface_ = cairo_create(surf); |
+ cairo_surface_destroy(surf); |
+ return true; |
+} |
+ |
} // namespace skia |