diff options
author | Robert Phillips <robertphillips@google.com> | 2017-03-17 17:11:37 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-17 17:44:01 +0000 |
commit | 31249bb2df023868e4585f14519bf17c835f8700 (patch) | |
tree | 2490cadaa74df7ffad4b41fdf33b8be4bae91bb4 /src/image | |
parent | b2082afc1d2076576327d9d1de5fbec6b13403fe (diff) |
Revert "Revert "Remove budgeted parameter from SkSurface::makeImageSnapshot""
This reverts commit 9e9188f84b15a25e27f63d5f8de3ccd393d9a173.
Reason for revert: Android-side fix has landed
Original change's description:
> Revert "Remove budgeted parameter from SkSurface::makeImageSnapshot"
>
> This reverts commit b64bcbdc3a5aa7b9e3ff216e4617ddc1db9260b5.
>
> Reason for revert:
>
> Android build failed as shown below.
>
> frameworks/base/libs/hwui/VkLayer.cpp:32:41: error: too many arguments to function call, expected 0, have 1
> mImage = surface->makeImageSnapshot(SkBudgeted::kNo);
>
> Original change's description:
> > Remove budgeted parameter from SkSurface::makeImageSnapshot
> >
> > This unused feature complicates MDB.
> >
> > Chrome compiles locally for me with this CL.
> >
> > Change-Id: I611e464885fb984030eace43ead42cf39d0e7f72
> > Reviewed-on: https://skia-review.googlesource.com/9734
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Robert Phillips <robertphillips@google.com>
> >
>
> TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Change-Id: Iae6e313c15b2352bd0d4fc7b5629de0a51ac398e
> Reviewed-on: https://skia-review.googlesource.com/9788
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
>
TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org,liyuqian@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: If07d1b5db6e6c618d37445a0cf127780ed243a92
Reviewed-on: https://skia-review.googlesource.com/9843
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 6 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.h | 8 | ||||
-rw-r--r-- | src/image/SkSurface.cpp | 6 | ||||
-rw-r--r-- | src/image/SkSurface_Base.h | 8 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 11 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.h | 2 | ||||
-rw-r--r-- | src/image/SkSurface_Raster.cpp | 6 |
7 files changed, 16 insertions, 31 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index b8d9dea951..20abd88345 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -65,12 +65,6 @@ SkImage_Gpu::~SkImage_Gpu() { } } -extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { - if (image->isTextureBacked()) { - ((SkImage_Gpu*)image)->applyBudgetDecision(); - } -} - SkImageInfo SkImage_Gpu::onImageInfo() const { SkColorType ct; if (!GrPixelConfigToColorType(fProxy->config(), &ct)) { diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h index b3a165d079..53c38dc278 100644 --- a/src/image/SkImage_Gpu.h +++ b/src/image/SkImage_Gpu.h @@ -29,14 +29,6 @@ public: SkImageInfo onImageInfo() const override; SkAlphaType onAlphaType() const override { return fAlphaType; } - void applyBudgetDecision() const { - if (SkBudgeted::kYes == fBudgeted) { - fProxy->priv().makeBudgeted(); - } else { - fProxy->priv().makeUnbudgeted(); - } - } - bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, CachingHint) const override; GrTexture* asTextureRef(GrContext*, const GrSamplerParams&, SkColorSpace*, sk_sp<SkColorSpace>*, SkScalar scaleAdjust[2]) const override; diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index 08f79aea28..55aab3e992 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -71,7 +71,7 @@ SkSurface_Base::~SkSurface_Base() { } void SkSurface_Base::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) { - auto image = this->makeImageSnapshot(SkBudgeted::kYes); + auto image = this->makeImageSnapshot(); if (image) { canvas->drawImage(image, x, y, paint); } @@ -153,8 +153,8 @@ SkCanvas* SkSurface::getCanvas() { return asSB(this)->getCachedCanvas(); } -sk_sp<SkImage> SkSurface::makeImageSnapshot(SkBudgeted budgeted) { - return asSB(this)->refCachedImage(budgeted); +sk_sp<SkImage> SkSurface::makeImageSnapshot() { + return asSB(this)->refCachedImage(); } sk_sp<SkSurface> SkSurface::makeSurface(const SkImageInfo& info) { diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h index 33aeee2dd6..1b0f9ff975 100644 --- a/src/image/SkSurface_Base.h +++ b/src/image/SkSurface_Base.h @@ -43,7 +43,7 @@ public: * must faithfully represent the current contents, even if the surface * is changed after this called (e.g. it is drawn to via its canvas). */ - virtual sk_sp<SkImage> onNewImageSnapshot(SkBudgeted) = 0; + virtual sk_sp<SkImage> onNewImageSnapshot() = 0; /** * Default implementation: @@ -81,7 +81,7 @@ public: virtual void onPrepareForExternalIO() {} inline SkCanvas* getCachedCanvas(); - inline sk_sp<SkImage> refCachedImage(SkBudgeted); + inline sk_sp<SkImage> refCachedImage(); bool hasCachedImage() const { return fCachedImage != nullptr; } @@ -114,12 +114,12 @@ SkCanvas* SkSurface_Base::getCachedCanvas() { return fCachedCanvas.get(); } -sk_sp<SkImage> SkSurface_Base::refCachedImage(SkBudgeted budgeted) { +sk_sp<SkImage> SkSurface_Base::refCachedImage() { if (fCachedImage) { return fCachedImage; } - fCachedImage = this->onNewImageSnapshot(budgeted); + fCachedImage = this->onNewImageSnapshot(); SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); return fCachedImage; diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 0bd34f8150..b610c9c9a1 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -83,7 +83,7 @@ sk_sp<SkSurface> SkSurface_Gpu::onNewSurface(const SkImageInfo& info) { origin, &this->props()); } -sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted) { +sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot() { GrRenderTargetContext* rtc = fDevice->accessRenderTargetContext(); if (!rtc) { return nullptr; @@ -102,7 +102,7 @@ sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted) { copyCtx = ctx->contextPriv().makeDeferredSurfaceContext(desc, SkBackingFit::kExact, - budgeted); + srcProxy->isBudgeted()); if (!copyCtx) { return nullptr; } @@ -122,7 +122,7 @@ sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted) { if (tex) { image = sk_make_sp<SkImage_Gpu>(kNeedNewImageUniqueID, info.alphaType(), sk_ref_sp(tex), - sk_ref_sp(info.colorSpace()), budgeted); + sk_ref_sp(info.colorSpace()), srcProxy->isBudgeted()); } return image; } @@ -137,14 +137,13 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { } // are we sharing our render target with the image? Note this call should never create a new // image because onCopyOnWrite is only called when there is a cached image. - sk_sp<SkImage> image(this->refCachedImage(SkBudgeted::kNo)); + sk_sp<SkImage> image(this->refCachedImage()); SkASSERT(image); // MDB TODO: this is unfortunate. The snapping of an Image_Gpu from a surface currently - // funnels down to a GrTexture. Once Image_Gpus are proxy-backed we should be able to + // funnels down to a GrTexture. Once Image_Gpus are proxy-backed we should be able to // compare proxy uniqueIDs. if (rt->asTexture()->getTextureHandle() == image->getTextureHandle(false)) { fDevice->replaceRenderTargetContext(SkSurface::kRetain_ContentChangeMode == mode); - SkTextureImageApplyBudgetedDecision(image.get()); } else if (kDiscard_ContentChangeMode == mode) { this->SkSurface_Gpu::onDiscard(); } diff --git a/src/image/SkSurface_Gpu.h b/src/image/SkSurface_Gpu.h index a625473639..5b92eebe3a 100644 --- a/src/image/SkSurface_Gpu.h +++ b/src/image/SkSurface_Gpu.h @@ -23,7 +23,7 @@ public: bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) override; SkCanvas* onNewCanvas() override; sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override; - sk_sp<SkImage> onNewImageSnapshot(SkBudgeted) override; + sk_sp<SkImage> onNewImageSnapshot() override; void onCopyOnWrite(ContentChangeMode) override; void onDiscard() override; void onPrepareForExternalIO() override; diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp index 47e0dbed33..4fae0f03c0 100644 --- a/src/image/SkSurface_Raster.cpp +++ b/src/image/SkSurface_Raster.cpp @@ -24,7 +24,7 @@ public: SkCanvas* onNewCanvas() override; sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override; - sk_sp<SkImage> onNewImageSnapshot(SkBudgeted) override; + sk_sp<SkImage> onNewImageSnapshot() override; void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) override; void onCopyOnWrite(ContentChangeMode) override; void onRestoreBackingMutability() override; @@ -130,7 +130,7 @@ void SkSurface_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, canvas->drawBitmap(fBitmap, x, y, paint); } -sk_sp<SkImage> SkSurface_Raster::onNewImageSnapshot(SkBudgeted) { +sk_sp<SkImage> SkSurface_Raster::onNewImageSnapshot() { SkCopyPixelsMode cpm = kIfMutable_SkCopyPixelsMode; if (fWeOwnThePixels) { // SkImage_raster requires these pixels are immutable for its full lifetime. @@ -156,7 +156,7 @@ void SkSurface_Raster::onRestoreBackingMutability() { void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) { // are we sharing pixelrefs with the image? - sk_sp<SkImage> cached(this->refCachedImage(SkBudgeted::kNo)); + sk_sp<SkImage> cached(this->refCachedImage()); SkASSERT(cached); if (SkBitmapImageGetPixelRef(cached.get()) == fBitmap.pixelRef()) { SkASSERT(fWeOwnThePixels); |