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,36 @@ |
data_->SetMatrixClip(transform, region); |
} |
+// Port of PlatformBitmap to linux |
+ |
+PlatformBitmap::~PlatformBitmap() { |
+ cairo_destroy(surface_); |
+} |
+ |
+bool PlatformBitmap::Allocate(int width, int height, bool isOpaque) { |
+ cairo_surface_t* cairo_surf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, |
+ width, height); |
brettw
2012/10/09 20:40:12
Check indenting.
reed1
2012/10/09 21:06:43
Done.
|
+ if (cairo_surface_status(cairo_surf) != CAIRO_STATUS_SUCCESS) { |
+ cairo_surface_destroy(cairo_surf); |
+ return false; |
+ } |
+ |
+ bitmap_.setConfig(SkBitmap::kARGB_8888_Config, width, height, |
+ cairo_image_surface_get_stride(cairo_surf)); |
+ bitmap_.setPixels(cairo_image_surface_get_data(cairo_surf)); |
+ bitmap_.setIsOpaque(isOpaque); |
+ |
+ surface_ = cairo_create(cairo_surf); |
+ cairo_surface_destroy(cairo_surf); |
+ return true; |
+} |
+ |
+PlatformSurface PlatformBitmap::LockSurface() { |
+ return surface_; |
+} |
+ |
+void PlatformBitmap::UnlockSurface() { |
+ // nothing to do for our surface. It will be released in our destructor |
brettw
2012/10/09 20:40:12
Check indenting.
reed1
2012/10/09 21:06:43
Done.
|
+} |
+ |
} // namespace skia |