diff options
-rw-r--r-- | src/core/SkSpecialImage.cpp | 140 | ||||
-rw-r--r-- | src/core/SkSpecialImage.h | 44 | ||||
-rw-r--r-- | src/core/SkSpecialSurface.cpp | 59 | ||||
-rw-r--r-- | src/core/SkSpecialSurface.h | 20 | ||||
-rw-r--r-- | tests/SpecialImageTest.cpp | 6 | ||||
-rw-r--r-- | tests/SpecialSurfaceTest.cpp | 8 |
6 files changed, 219 insertions, 58 deletions
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp index 4fed2ac24a..50117b2e83 100644 --- a/src/core/SkSpecialImage.cpp +++ b/src/core/SkSpecialImage.cpp @@ -12,7 +12,9 @@ /////////////////////////////////////////////////////////////////////////////// class SkSpecialImage_Base : public SkSpecialImage { public: - SkSpecialImage_Base(const SkIRect& subset) : INHERITED(subset) { } + SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID) + : INHERITED(proxy, subset, uniqueID) { + } virtual ~SkSpecialImage_Base() { } virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0; @@ -21,6 +23,9 @@ public: virtual GrTexture* onPeekTexture() const { return nullptr; } + // Delete this entry point ASAP (see skbug.com/4965) + virtual bool getBitmap(SkBitmap* result) const = 0; + virtual SkSpecialSurface* onNewSurface(const SkImageInfo& info) const { return nullptr; } private: @@ -48,22 +53,70 @@ SkSpecialSurface* SkSpecialImage::newSurface(const SkImageInfo& info) const { return as_IB(this)->onNewSurface(info); } +#if SK_SUPPORT_GPU +#include "SkGr.h" +#include "SkGrPixelRef.h" +#endif + +SkSpecialImage* SkSpecialImage::internal_fromBM(SkImageFilter::Proxy* proxy, + const SkBitmap& src) { + // Need to test offset case! (see skbug.com/4967) + if (src.getTexture()) { + return SkSpecialImage::NewFromGpu(proxy, + src.bounds(), + src.getGenerationID(), + src.getTexture()); + } + + return SkSpecialImage::NewFromRaster(proxy, src.bounds(), src); +} + +bool SkSpecialImage::internal_getBM(SkBitmap* result) { + const SkSpecialImage_Base* ib = as_IB(this); + + // TODO: need to test offset case! (see skbug.com/4967) + return ib->getBitmap(result); +} + +SkImageFilter::Proxy* SkSpecialImage::internal_getProxy() { + SkASSERT(fProxy); + return fProxy; +} + /////////////////////////////////////////////////////////////////////////////// #include "SkImage.h" #if SK_SUPPORT_GPU -#include "SkGr.h" #include "SkGrPriv.h" #endif class SkSpecialImage_Image : public SkSpecialImage_Base { public: - SkSpecialImage_Image(const SkIRect& subset, const SkImage* image) - : INHERITED(subset) + SkSpecialImage_Image(SkImageFilter::Proxy* proxy, const SkIRect& subset, const SkImage* image) + : INHERITED(proxy, subset, image->uniqueID()) , fImage(SkRef(image)) { } ~SkSpecialImage_Image() override { } + bool isOpaque() const override { return fImage->isOpaque(); } + + size_t getSize() const override { +#if SK_SUPPORT_GPU + if (fImage->getTexture()) { + return fImage->getTexture()->gpuMemorySize(); + } else +#endif + { + SkImageInfo info; + size_t rowBytes; + + if (fImage->peekPixels(&info, &rowBytes)) { + return info.height() * rowBytes; + } + } + return 0; + } + void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const override { SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset().height()); @@ -77,6 +130,10 @@ public: GrTexture* onPeekTexture() const override { return fImage->getTexture(); } + bool getBitmap(SkBitmap* result) const override { + return false; + } + SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { #if SK_SUPPORT_GPU GrTexture* texture = fImage->getTexture(); @@ -84,10 +141,10 @@ public: GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); desc.fFlags = kRenderTarget_GrSurfaceFlag; - return SkSpecialSurface::NewRenderTarget(texture->getContext(), desc); + return SkSpecialSurface::NewRenderTarget(this->proxy(), texture->getContext(), desc); } #endif - return SkSpecialSurface::NewRaster(info, nullptr); + return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); } private: @@ -107,7 +164,7 @@ static bool rect_fits(const SkIRect& rect, int width, int height) { SkSpecialImage* SkSpecialImage::NewFromImage(const SkIRect& subset, const SkImage* image) { SkASSERT(rect_fits(subset, image->width(), image->height())); - return new SkSpecialImage_Image(subset, image); + return new SkSpecialImage_Image(nullptr, subset, image); } /////////////////////////////////////////////////////////////////////////////// @@ -117,8 +174,8 @@ SkSpecialImage* SkSpecialImage::NewFromImage(const SkIRect& subset, const SkImag class SkSpecialImage_Raster : public SkSpecialImage_Base { public: - SkSpecialImage_Raster(const SkIRect& subset, const SkBitmap& bm) - : INHERITED(subset) + SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, const SkIRect& subset, const SkBitmap& bm) + : INHERITED(proxy, subset, bm.getGenerationID()) , fBitmap(bm) { if (bm.pixelRef()->isPreLocked()) { // we only preemptively lock if there is no chance of triggering something expensive @@ -129,6 +186,10 @@ public: ~SkSpecialImage_Raster() override { } + bool isOpaque() const override { return fBitmap.isOpaque(); } + + size_t getSize() const override { return fBitmap.getSize(); } + void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const override { SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset().height()); @@ -152,8 +213,13 @@ public: return false; } + bool getBitmap(SkBitmap* result) const override { + *result = fBitmap; + return true; + } + SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { - return SkSpecialSurface::NewRaster(info, nullptr); + return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); } private: @@ -162,10 +228,12 @@ private: typedef SkSpecialImage_Base INHERITED; }; -SkSpecialImage* SkSpecialImage::NewFromRaster(const SkIRect& subset, const SkBitmap& bm) { +SkSpecialImage* SkSpecialImage::NewFromRaster(SkImageFilter::Proxy* proxy, + const SkIRect& subset, + const SkBitmap& bm) { SkASSERT(nullptr == bm.getTexture()); SkASSERT(rect_fits(subset, bm.width(), bm.height())); - return new SkSpecialImage_Raster(subset, bm); + return new SkSpecialImage_Raster(proxy, subset, bm); } #if SK_SUPPORT_GPU @@ -173,23 +241,30 @@ SkSpecialImage* SkSpecialImage::NewFromRaster(const SkIRect& subset, const SkBit #include "GrTexture.h" class SkSpecialImage_Gpu : public SkSpecialImage_Base { -public: - SkSpecialImage_Gpu(const SkIRect& subset, GrTexture* tex) - : INHERITED(subset) - , fTexture(SkRef(tex)) { +public: + SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset, + uint32_t uniqueID, GrTexture* tex, SkAlphaType at) + : INHERITED(proxy, subset, uniqueID) + , fTexture(SkRef(tex)) + , fAlphaType(at) { } ~SkSpecialImage_Gpu() override { } + bool isOpaque() const override { + return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_SkAlphaType; + } + + size_t getSize() const override { return fTexture->gpuMemorySize(); } + void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const override { SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset().height()); SkBitmap bm; - static const bool kUnknownOpacity = false; GrWrapTextureInBitmap(fTexture, - fTexture->width(), fTexture->height(), kUnknownOpacity, &bm); + fTexture->width(), fTexture->height(), this->isOpaque(), &bm); canvas->drawBitmapRect(bm, this->subset(), dst, paint, SkCanvas::kStrict_SrcRectConstraint); @@ -197,27 +272,48 @@ public: GrTexture* onPeekTexture() const override { return fTexture; } + bool getBitmap(SkBitmap* result) const override { + const SkImageInfo info = GrMakeInfoFromTexture(fTexture, + this->width(), this->height(), + this->isOpaque()); + if (!result->setInfo(info)) { + return false; + } + + result->setPixelRef(new SkGrPixelRef(info, fTexture))->unref(); + return true; + } + SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); desc.fFlags = kRenderTarget_GrSurfaceFlag; - return SkSpecialSurface::NewRenderTarget(fTexture->getContext(), desc); + return SkSpecialSurface::NewRenderTarget(this->proxy(), fTexture->getContext(), desc); } private: SkAutoTUnref<GrTexture> fTexture; + const SkAlphaType fAlphaType; typedef SkSpecialImage_Base INHERITED; }; -SkSpecialImage* SkSpecialImage::NewFromGpu(const SkIRect& subset, GrTexture* tex) { +SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, + const SkIRect& subset, + uint32_t uniqueID, + GrTexture* tex, + SkAlphaType at) { SkASSERT(rect_fits(subset, tex->width(), tex->height())); - return new SkSpecialImage_Gpu(subset, tex); + return new SkSpecialImage_Gpu(proxy, subset, uniqueID, tex, at); } #else -SkSpecialImage* SkSpecialImage::NewFromGpu(const SkIRect& subset, GrTexture* tex) { +SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, + const SkIRect& subset, + uint32_t uniqueID, + GrTexture* tex, + SkAlphaType at) { return nullptr; } diff --git a/src/core/SkSpecialImage.h b/src/core/SkSpecialImage.h index 38225482fb..8dd4a92e1c 100644 --- a/src/core/SkSpecialImage.h +++ b/src/core/SkSpecialImage.h @@ -8,8 +8,12 @@ #ifndef SkSpecialImage_DEFINED #define SkSpecialImage_DEFINED +#include "SkNextID.h" #include "SkRefCnt.h" +// remove this when internal_getProxy goes away (see skbug.com/4965) +#include "SkImageFilter.h" + class GrTexture; class SkBitmap; class SkCanvas; @@ -18,6 +22,10 @@ struct SkImageInfo; class SkPaint; class SkSpecialSurface; +enum { + kNeedNewImageUniqueID_SpecialImage = 0 +}; + /** * This is a restricted form of SkImage solely intended for internal use. It * differs from SkImage in that: @@ -33,6 +41,9 @@ class SkSpecialImage : public SkRefCnt { public: int width() const { return fSubset.width(); } int height() const { return fSubset.height(); } + uint32_t uniqueID() const { return fUniqueID; } + virtual bool isOpaque() const { return false; } + virtual size_t getSize() const = 0; /** * Draw this SpecialImage into the canvas. @@ -40,18 +51,34 @@ public: void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const; static SkSpecialImage* NewFromImage(const SkIRect& subset, const SkImage*); - static SkSpecialImage* NewFromRaster(const SkIRect& subset, const SkBitmap&); - static SkSpecialImage* NewFromGpu(const SkIRect& subset, GrTexture*); + static SkSpecialImage* NewFromRaster(SkImageFilter::Proxy*, + const SkIRect& subset, + const SkBitmap&); + static SkSpecialImage* NewFromGpu(SkImageFilter::Proxy*, + const SkIRect& subset, + uint32_t uniqueID, + GrTexture*, + SkAlphaType at = kPremul_SkAlphaType); /** * Create a new surface with a backend that is compatible with this image. */ SkSpecialSurface* newSurface(const SkImageInfo&) const; + // These three internal methods will go away (see skbug.com/4965) + bool internal_getBM(SkBitmap* result); + static SkSpecialImage* internal_fromBM(SkImageFilter::Proxy*, const SkBitmap&); + SkImageFilter::Proxy* internal_getProxy(); + protected: - SkSpecialImage(const SkIRect& subset) : fSubset(subset) { } + SkSpecialImage(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID) + : fSubset(subset) + , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::ImageID() + : uniqueID) + , fProxy(proxy) { + } - // The following 3 are for testing and shouldn't be used. + // The following 3 are for testing and shouldn't be used. (see skbug.com/4965) friend class TestingSpecialImageAccess; friend class TestingSpecialSurfaceAccess; const SkIRect& subset() const { return fSubset; } @@ -74,8 +101,15 @@ protected: */ GrTexture* peekTexture() const; + // TODO: remove this ASAP (see skbug.com/4965) + SkImageFilter::Proxy* proxy() const { return fProxy; } + private: - const SkIRect fSubset; + const SkIRect fSubset; + const uint32_t fUniqueID; + + // TODO: remove this ASAP (see skbug.com/4965) + SkImageFilter::Proxy* fProxy; typedef SkRefCnt INHERITED; }; diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp index 548552cc93..429baddadd 100644 --- a/src/core/SkSpecialSurface.cpp +++ b/src/core/SkSpecialSurface.cpp @@ -13,8 +13,9 @@ /////////////////////////////////////////////////////////////////////////////// class SkSpecialSurface_Base : public SkSpecialSurface { public: - SkSpecialSurface_Base(const SkIRect& subset, const SkSurfaceProps* props) - : INHERITED(subset, props) + SkSpecialSurface_Base(SkImageFilter::Proxy* proxy, + const SkIRect& subset, const SkSurfaceProps* props) + : INHERITED(proxy, subset, props) , fCanvas(nullptr) { } @@ -40,9 +41,12 @@ static SkSpecialSurface_Base* as_SB(SkSpecialSurface* surface) { return static_cast<SkSpecialSurface_Base*>(surface); } -SkSpecialSurface::SkSpecialSurface(const SkIRect& subset, const SkSurfaceProps* props) +SkSpecialSurface::SkSpecialSurface(SkImageFilter::Proxy* proxy, + const SkIRect& subset, + const SkSurfaceProps* props) : fProps(SkSurfacePropsCopyOrDefault(props)) - , fSubset(subset) { + , fSubset(subset) + , fProxy(proxy) { SkASSERT(fSubset.width() > 0); SkASSERT(fSubset.height() > 0); } @@ -62,8 +66,11 @@ SkSpecialImage* SkSpecialSurface::newImageSnapshot() { class SkSpecialSurface_Raster : public SkSpecialSurface_Base { public: - SkSpecialSurface_Raster(SkPixelRef* pr, const SkIRect& subset, const SkSurfaceProps* props) - : INHERITED(subset, props) { + SkSpecialSurface_Raster(SkImageFilter::Proxy* proxy, + SkPixelRef* pr, + const SkIRect& subset, + const SkSurfaceProps* props) + : INHERITED(proxy, subset, props) { const SkImageInfo& info = pr->info(); fBitmap.setInfo(info, info.minRowBytes()); @@ -75,7 +82,7 @@ public: ~SkSpecialSurface_Raster() override { } SkSpecialImage* onNewImageSnapshot() override { - return SkSpecialImage::NewFromRaster(this->subset(), fBitmap); + return SkSpecialImage::NewFromRaster(this->proxy(), this->subset(), fBitmap); } private: @@ -84,12 +91,14 @@ private: typedef SkSpecialSurface_Base INHERITED; }; -SkSpecialSurface* SkSpecialSurface::NewFromBitmap(const SkIRect& subset, SkBitmap& bm, +SkSpecialSurface* SkSpecialSurface::NewFromBitmap(SkImageFilter::Proxy* proxy, + const SkIRect& subset, SkBitmap& bm, const SkSurfaceProps* props) { - return new SkSpecialSurface_Raster(bm.pixelRef(), subset, props); + return new SkSpecialSurface_Raster(proxy, bm.pixelRef(), subset, props); } -SkSpecialSurface* SkSpecialSurface::NewRaster(const SkImageInfo& info, +SkSpecialSurface* SkSpecialSurface::NewRaster(SkImageFilter::Proxy* proxy, + const SkImageInfo& info, const SkSurfaceProps* props) { SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, 0, nullptr)); if (nullptr == pr.get()) { @@ -98,7 +107,7 @@ SkSpecialSurface* SkSpecialSurface::NewRaster(const SkImageInfo& info, const SkIRect subset = SkIRect::MakeWH(pr->info().width(), pr->info().height()); - return new SkSpecialSurface_Raster(pr, subset, props); + return new SkSpecialSurface_Raster(proxy, pr, subset, props); } #if SK_SUPPORT_GPU @@ -108,8 +117,11 @@ SkSpecialSurface* SkSpecialSurface::NewRaster(const SkImageInfo& info, class SkSpecialSurface_Gpu : public SkSpecialSurface_Base { public: - SkSpecialSurface_Gpu(GrTexture* texture, const SkIRect& subset, const SkSurfaceProps* props) - : INHERITED(subset, props) + SkSpecialSurface_Gpu(SkImageFilter::Proxy* proxy, + GrTexture* texture, + const SkIRect& subset, + const SkSurfaceProps* props) + : INHERITED(proxy, subset, props) , fTexture(SkRef(texture)) { SkASSERT(fTexture->asRenderTarget()); @@ -126,7 +138,8 @@ public: ~SkSpecialSurface_Gpu() override { } SkSpecialImage* onNewImageSnapshot() override { - return SkSpecialImage::NewFromGpu(this->subset(), fTexture); + return SkSpecialImage::NewFromGpu(this->proxy(), this->subset(), + kNeedNewImageUniqueID_SpecialImage, fTexture); } private: @@ -135,16 +148,19 @@ private: typedef SkSpecialSurface_Base INHERITED; }; -SkSpecialSurface* SkSpecialSurface::NewFromTexture(const SkIRect& subset, GrTexture* texture, +SkSpecialSurface* SkSpecialSurface::NewFromTexture(SkImageFilter::Proxy* proxy, + const SkIRect& subset, + GrTexture* texture, const SkSurfaceProps* props) { if (!texture->asRenderTarget()) { return nullptr; } - return new SkSpecialSurface_Gpu(texture, subset, props); + return new SkSpecialSurface_Gpu(proxy, texture, subset, props); } -SkSpecialSurface* SkSpecialSurface::NewRenderTarget(GrContext* context, +SkSpecialSurface* SkSpecialSurface::NewRenderTarget(SkImageFilter::Proxy* proxy, + GrContext* context, const GrSurfaceDesc& desc, const SkSurfaceProps* props) { if (!context || !SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag)) { @@ -158,17 +174,20 @@ SkSpecialSurface* SkSpecialSurface::NewRenderTarget(GrContext* context, const SkIRect subset = SkIRect::MakeWH(desc.fWidth, desc.fHeight); - return new SkSpecialSurface_Gpu(temp, subset, props); + return new SkSpecialSurface_Gpu(proxy, temp, subset, props); } #else -SkSpecialSurface* SkSpecialSurface::NewFromTexture(const SkIRect& subset, GrTexture*, +SkSpecialSurface* SkSpecialSurface::NewFromTexture(SkImageFilter::Proxy* proxy, + const SkIRect& subset, + GrTexture*, const SkSurfaceProps*) { return nullptr; } -SkSpecialSurface* SkSpecialSurface::NewRenderTarget(GrContext* context, +SkSpecialSurface* SkSpecialSurface::NewRenderTarget(SkImageFilter::Proxy* proxy, + GrContext* context, const GrSurfaceDesc& desc, const SkSurfaceProps* props) { return nullptr; diff --git a/src/core/SkSpecialSurface.h b/src/core/SkSpecialSurface.h index 216ef3f41e..546ec0c303 100644 --- a/src/core/SkSpecialSurface.h +++ b/src/core/SkSpecialSurface.h @@ -53,20 +53,23 @@ public: /** * Use an existing (renderTarget-capable) GrTexture as the backing store. */ - static SkSpecialSurface* NewFromTexture(const SkIRect& subset, GrTexture*, + static SkSpecialSurface* NewFromTexture(SkImageFilter::Proxy* proxy, + const SkIRect& subset, GrTexture*, const SkSurfaceProps* = nullptr); /** * Allocate a new GPU-backed SkSpecialSurface. If the requested surface cannot * be created, nullptr will be returned. */ - static SkSpecialSurface* NewRenderTarget(GrContext*, const GrSurfaceDesc&, + static SkSpecialSurface* NewRenderTarget(SkImageFilter::Proxy* proxy, + GrContext*, const GrSurfaceDesc&, const SkSurfaceProps* = nullptr); /** * Use and existing SkBitmap as the backing store. */ - static SkSpecialSurface* NewFromBitmap(const SkIRect& subset, SkBitmap& bm, + static SkSpecialSurface* NewFromBitmap(SkImageFilter::Proxy* proxy, + const SkIRect& subset, SkBitmap& bm, const SkSurfaceProps* = nullptr); /** @@ -76,19 +79,26 @@ public: * If the requested surface cannot be created, or the request is not a * supported configuration, nullptr will be returned. */ - static SkSpecialSurface* NewRaster(const SkImageInfo&, const SkSurfaceProps* = nullptr); + static SkSpecialSurface* NewRaster(SkImageFilter::Proxy* proxy, + const SkImageInfo&, const SkSurfaceProps* = nullptr); protected: - SkSpecialSurface(const SkIRect& subset, const SkSurfaceProps*); + SkSpecialSurface(SkImageFilter::Proxy*, const SkIRect& subset, const SkSurfaceProps*); // For testing only friend class TestingSpecialSurfaceAccess; const SkIRect& subset() const { return fSubset; } + // TODO: remove this ASAP (see skbug.com/4965) + SkImageFilter::Proxy* proxy() const { return fProxy; } + private: const SkSurfaceProps fProps; const SkIRect fSubset; + // TODO: remove this ASAP (see skbug.com/4965) + SkImageFilter::Proxy* fProxy; + typedef SkRefCnt INHERITED; }; diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp index bc770a0ddc..049453d302 100644 --- a/tests/SpecialImageTest.cpp +++ b/tests/SpecialImageTest.cpp @@ -110,7 +110,7 @@ DEF_TEST(SpecialImage_Raster, reporter) { const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); - SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromRaster(subset, bm)); + SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromRaster(nullptr, subset, bm)); test_image(img, reporter, true, false); } @@ -143,7 +143,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, context) { const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); - SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(subset, texture)); + SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(nullptr, subset, + kNeedNewImageUniqueID_SpecialImage, + texture)); test_image(img, reporter, false, true); } diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp index b1cbf68082..580d2ddc87 100644 --- a/tests/SpecialSurfaceTest.cpp +++ b/tests/SpecialSurfaceTest.cpp @@ -59,7 +59,7 @@ static void test_surface(SkSpecialSurface* surf, skiatest::Reporter* reporter, i DEF_TEST(SpecialSurface_Raster, reporter) { SkImageInfo info = SkImageInfo::MakeN32(kSmallerSize, kSmallerSize, kOpaque_SkAlphaType); - SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewRaster(info)); + SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewRaster(nullptr, info)); test_surface(surf, reporter, 0); } @@ -71,7 +71,7 @@ DEF_TEST(SpecialSurface_Raster2, reporter) { const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); - SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewFromBitmap(subset, bm)); + SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewFromBitmap(nullptr, subset, bm)); test_surface(surf, reporter, kPad); @@ -87,7 +87,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, context) { desc.fWidth = kSmallerSize; desc.fHeight = kSmallerSize; - SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewRenderTarget(context, desc)); + SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewRenderTarget(nullptr, context, desc)); test_surface(surf, reporter, 0); } @@ -105,7 +105,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu2, reporter, context) { const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); - SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewFromTexture(subset, temp)); + SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewFromTexture(nullptr, subset, temp)); test_surface(surf, reporter, kPad); |