diff options
author | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-10 19:57:15 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-10 19:57:15 +0000 |
commit | 3b798343ad6244041f094ab1c7929cddef451945 (patch) | |
tree | f95ab6f60499c493016870931161e879a86e2e6f /skia/ext/bitmap_platform_device_android.cc | |
parent | b27ccd4d945890566a5897d7dc903ebd67c76948 (diff) | |
download | chromium_src-3b798343ad6244041f094ab1c7929cddef451945.zip chromium_src-3b798343ad6244041f094ab1c7929cddef451945.tar.gz chromium_src-3b798343ad6244041f094ab1c7929cddef451945.tar.bz2 |
Introduce PlatformBitmap, which is a minimal helper class that wraps an SkBitmap
and a PlatformSurface. This is used to replace the PlatformCanvas that was being
passed to BackingStore to return pixels.
The problem to solve is that PlatformCanvas is an extension of SkCanvas, and
SkCanvas is losing the ability to have its backend specified after its
constructor (for performance reasons).
The BackingStore interface only needs to return a copy of its pixels, and offer
a platform-specific way to draw into it (i.e. BitBlt). The PlatformSurface is
sufficient for this, so the larger infrastructure of PlatformCanvas/PlatformDevice
is not required.
Review URL: https://codereview.chromium.org/11031055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161163 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/bitmap_platform_device_android.cc')
-rw-r--r-- | skia/ext/bitmap_platform_device_android.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/skia/ext/bitmap_platform_device_android.cc b/skia/ext/bitmap_platform_device_android.cc index f49b6a8..6a71fb2 100644 --- a/skia/ext/bitmap_platform_device_android.cc +++ b/skia/ext/bitmap_platform_device_android.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "skia/ext/bitmap_platform_device_android.h" +#include "skia/ext/platform_canvas.h" namespace skia { @@ -71,4 +72,18 @@ void BitmapPlatformDevice::DrawToNativeContext( SkASSERT(false); } +// Port of PlatformBitmap to android + +PlatformBitmap::~PlatformBitmap() {} + +bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) { + bitmap_.setConfig(SkBitmap::kARGB_8888_Config, width, height); + if (!bitmap_.allocPixels()) + return false; + + bitmap_.setIsOpaque(is_opaque); + surface_ = bitmap_.getPixels(); + return true; +} + } // namespace skia |