Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Unified Diff: src/core/SkBitmapDevice.cpp

Issue 2309483002: WIP RasterCanvasLayerAllocator experiment 2
Patch Set: support initial data? Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkBitmapDevice.cpp
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 4f8074d3a672ea0df255a09cc540b5c726e552fa..2690ad39fb1bb79d74309fcdfdd26c3f898ce634 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -16,6 +16,7 @@
#include "SkPath.h"
#include "SkPixelRef.h"
#include "SkPixmap.h"
+#include "SkRasterCanvasLayerAllocator.h"
#include "SkRasterClip.h"
#include "SkShader.h"
#include "SkSpecialImage.h"
@@ -134,8 +135,17 @@ void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
this->privateResize(fBitmap.info().width(), fBitmap.info().height());
}
-SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint*) {
+SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint*,
+ SkRasterCanvasLayerAllocator* allocator) {
+SkDebugf("SkBitmapDevice::onCreateDevice(%lx)", allocator);
const SkSurfaceProps surfaceProps(this->surfaceProps().flags(), cinfo.fPixelGeometry);
+ if (allocator) {
+ SkBitmap bitmap;
+ size_t rowBytes;
+ void* pixels = allocator->allocateLayer(cinfo.fInfo, &rowBytes);
+ bitmap.installPixels(cinfo.fInfo, pixels, rowBytes);
+ return new SkBitmapDevice(bitmap, surfaceProps);
+ }
return SkBitmapDevice::Create(cinfo.fInfo, surfaceProps);
}

Powered by Google App Engine
This is Rietveld 408576698