| Index: src/core/SkBitmapDevice.cpp
|
| diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
|
| index fc0e63e9ae0b4ad93ea9806e243e1d6ae6549540..36d46f3abf5337cb04e8f744e6f03009ccea74ed 100644
|
| --- a/src/core/SkBitmapDevice.cpp
|
| +++ b/src/core/SkBitmapDevice.cpp
|
| @@ -14,6 +14,7 @@
|
| #include "SkPath.h"
|
| #include "SkPixelRef.h"
|
| #include "SkPixmap.h"
|
| +#include "SkRasterCanvasLayerAllocator.h"
|
| #include "SkShader.h"
|
| #include "SkSurface.h"
|
| #include "SkXfermode.h"
|
| @@ -128,9 +129,22 @@ void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
|
| fBitmap.lockPixels();
|
| }
|
|
|
| -SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint*) {
|
| +SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint*,
|
| + SkRasterCanvasLayerAllocator* alloc) {
|
| const SkSurfaceProps surfaceProps(this->surfaceProps().flags(), cinfo.fPixelGeometry);
|
| - return SkBitmapDevice::Create(cinfo.fInfo, surfaceProps);
|
| + SkBitmapDevice* dev = nullptr;
|
| + if (alloc) {
|
| + SkBitmap bitmap;
|
| + size_t rowBytes;
|
| + void* layer = alloc->allocateLayer(cinfo.fInfo, &rowBytes);
|
| + if (layer &&
|
| + bitmap.installPixels(cinfo.fInfo, layer, rowBytes)) {
|
| + dev = new SkBitmapDevice(bitmap);
|
| + }
|
| + } else {
|
| + dev = SkBitmapDevice::Create(cinfo.fInfo, surfaceProps);
|
| + }
|
| + return dev;
|
| }
|
|
|
| const SkBitmap& SkBitmapDevice::onAccessBitmap() {
|
|
|