| Index: src/core/SkCanvas.cpp
|
| diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
|
| index 08b09e8e2b6e970b06d93c0449b9af8859573173..6f4e88da863496e2d161a01a98948731612b36cc 100644
|
| --- a/src/core/SkCanvas.cpp
|
| +++ b/src/core/SkCanvas.cpp
|
| @@ -832,6 +832,26 @@ int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
|
| return this->internalSaveLayer(bounds, paint, flags, false);
|
| }
|
|
|
| +static SkBaseDevice* createCompatibleDevice(SkCanvas* canvas,
|
| + SkBitmap::Config config,
|
| + int width, int height,
|
| + bool isOpaque) {
|
| + SkBaseDevice* device = canvas->getDevice();
|
| + if (device) {
|
| + return device->createCompatibleDevice(config, width, height, isOpaque);
|
| + } else {
|
| + return NULL;
|
| + }
|
| +}
|
| +
|
| +#ifdef SK_SUPPORT_LEGACY_CANVAS_CREATECOMPATIBLEDEVICE
|
| +SkBaseDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
|
| + int width, int height,
|
| + bool isOpaque) {
|
| + return createCompatibleDevice(this, config, width, height, isOpaque);
|
| +}
|
| +#endif
|
| +
|
| int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
|
| SaveFlags flags, bool justForImageFilter) {
|
| // do this before we create the layer. We don't call the public save() since
|
| @@ -864,8 +884,8 @@ int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
|
|
|
| SkBaseDevice* device;
|
| if (paint && paint->getImageFilter()) {
|
| - device = this->createCompatibleDevice(config, ir.width(), ir.height(),
|
| - isOpaque);
|
| + device = createCompatibleDevice(this, config, ir.width(), ir.height(),
|
| + isOpaque);
|
| } else {
|
| device = this->createLayerDevice(config, ir.width(), ir.height(),
|
| isOpaque);
|
| @@ -964,6 +984,15 @@ bool SkCanvas::isDrawingToLayer() const {
|
| return fSaveLayerCount > 0;
|
| }
|
|
|
| +SkSurface* SkCanvas::newSurface(const SkImageInfo& info) {
|
| + return this->onNewSurface(info);
|
| +}
|
| +
|
| +SkSurface* SkCanvas::onNewSurface(const SkImageInfo& info) {
|
| + SkBaseDevice* dev = this->getDevice();
|
| + return dev ? dev->newSurface(info) : NULL;
|
| +}
|
| +
|
| /////////////////////////////////////////////////////////////////////////////
|
|
|
| // can't draw it if its empty, or its too big for a fixed-point width or height
|
| @@ -1548,17 +1577,6 @@ SkBaseDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
|
| }
|
| }
|
|
|
| -SkBaseDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
|
| - int width, int height,
|
| - bool isOpaque) {
|
| - SkBaseDevice* device = this->getDevice();
|
| - if (device) {
|
| - return device->createCompatibleDevice(config, width, height, isOpaque);
|
| - } else {
|
| - return NULL;
|
| - }
|
| -}
|
| -
|
| GrContext* SkCanvas::getGrContext() {
|
| #if SK_SUPPORT_GPU
|
| SkBaseDevice* device = this->getTopDevice();
|
|
|