diff options
author | Brian Osman <brianosman@google.com> | 2018-10-19 13:02:14 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-10-19 17:40:25 +0000 |
commit | e50cdf0f87f7bd22b9cfc5548d201f67be39f9a6 (patch) | |
tree | ffe106ba844b23b7fe4a11c9f2b9a0954aa3c8a7 /src/image | |
parent | 6bee776e8e641eae8818e37d9094f39f456a2b2c (diff) | |
download | skqp-e50cdf0f87f7bd22b9cfc5548d201f67be39f9a6.tar.gz |
Remove unused dstColorSpace from getROPixels
Bug: skia:
Change-Id: Id5f03f2c82706f5f82c24ff735805c85ad0b069d
Reviewed-on: https://skia-review.googlesource.com/c/163883
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage.cpp | 13 | ||||
-rw-r--r-- | src/image/SkImage_Base.h | 3 | ||||
-rw-r--r-- | src/image/SkImage_GpuBase.cpp | 8 | ||||
-rw-r--r-- | src/image/SkImage_GpuBase.h | 2 | ||||
-rw-r--r-- | src/image/SkImage_Lazy.cpp | 6 | ||||
-rw-r--r-- | src/image/SkImage_Lazy.h | 2 | ||||
-rw-r--r-- | src/image/SkImage_Raster.cpp | 4 |
7 files changed, 11 insertions, 27 deletions
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 6470f82ae7..d809bf7358 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -63,7 +63,7 @@ bool SkImage::scalePixels(const SkPixmap& dst, SkFilterQuality quality, CachingH // can scale more efficiently) we should take advantage of it here. // SkBitmap bm; - if (as_IB(this)->getROPixels(&bm, dst.info().colorSpace(), chint)) { + if (as_IB(this)->getROPixels(&bm, chint)) { SkPixmap pmap; // Note: By calling the pixmap scaler, we never cache the final result, so the chint // is (currently) only being applied to the getROPixels. If we get a request to @@ -99,8 +99,7 @@ sk_sp<SkShader> SkImage::makeShader(SkShader::TileMode tileX, SkShader::TileMode sk_sp<SkData> SkImage::encodeToData(SkEncodedImageFormat type, int quality) const { SkBitmap bm; - SkColorSpace* legacyColorSpace = nullptr; - if (as_IB(this)->getROPixels(&bm, legacyColorSpace)) { + if (as_IB(this)->getROPixels(&bm)) { return SkEncodeBitmap(bm, type, quality); } return nullptr; @@ -111,13 +110,7 @@ sk_sp<SkData> SkImage::encodeToData() const { return encoded; } - SkBitmap bm; - SkPixmap pmap; - SkColorSpace* legacyColorSpace = nullptr; - if (as_IB(this)->getROPixels(&bm, legacyColorSpace) && bm.peekPixels(&pmap)) { - return SkEncodePixmap(pmap, SkEncodedImageFormat::kPNG, 100); - } - return nullptr; + return this->encodeToData(SkEncodedImageFormat::kPNG, 100); } sk_sp<SkData> SkImage::refEncodedData() const { diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h index 7bbd81d05f..c0de6f5d26 100644 --- a/src/image/SkImage_Base.h +++ b/src/image/SkImage_Base.h @@ -67,8 +67,7 @@ public: // return a read-only copy of the pixels. We promise to not modify them, // but only inspect them (or encode them). - virtual bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, - CachingHint = kAllow_CachingHint) const = 0; + virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const = 0; virtual sk_sp<SkImage> onMakeSubset(const SkIRect&) const = 0; diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp index b7067e7516..ff07a5101f 100644 --- a/src/image/SkImage_GpuBase.cpp +++ b/src/image/SkImage_GpuBase.cpp @@ -47,18 +47,12 @@ bool SkImage_GpuBase::ValidateBackendTexture(GrContext* ctx, const GrBackendText ////////////////////////////////////////////////////////////////////////////////////////////////// -bool SkImage_GpuBase::getROPixels(SkBitmap* dst, SkColorSpace*, CachingHint chint) const { +bool SkImage_GpuBase::getROPixels(SkBitmap* dst, CachingHint chint) const { if (!fContext->contextPriv().resourceProvider()) { // DDL TODO: buffer up the readback so it occurs when the DDL is drawn? return false; } - // The SkColorSpace parameter "dstColorSpace" is really just a hint about how/where the bitmap - // will be used. The client doesn't expect that we convert to that color space, it's intended - // for codec-backed images, to drive our decoding heuristic. In theory we *could* read directly - // into that color space (to save the client some effort in whatever they're about to do), but - // that would make our use of the bitmap cache incorrect (or much less efficient, assuming we - // rolled the dstColorSpace into the key). const auto desc = SkBitmapCacheDesc::Make(this); if (SkBitmapCache::Find(desc, dst)) { SkASSERT(dst->isImmutable()); diff --git a/src/image/SkImage_GpuBase.h b/src/image/SkImage_GpuBase.h index 7828a9546d..3e8ab2d202 100644 --- a/src/image/SkImage_GpuBase.h +++ b/src/image/SkImage_GpuBase.h @@ -23,7 +23,7 @@ public: GrContext* context() const final { return fContext.get(); } - bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, CachingHint) const final; + bool getROPixels(SkBitmap*, CachingHint) const final; sk_sp<SkImage> onMakeSubset(const SkIRect& subset) const final; bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB, diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp index 5c8b627805..04b8510420 100644 --- a/src/image/SkImage_Lazy.cpp +++ b/src/image/SkImage_Lazy.cpp @@ -248,7 +248,6 @@ bool SkImage_Lazy::lockAsBitmap(SkBitmap* bitmap, SkImage::CachingHint chint, bool SkImage_Lazy::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB, int srcX, int srcY, CachingHint chint) const { - SkColorSpace* dstColorSpace = dstInfo.colorSpace(); SkBitmap bm; if (kDisallow_CachingHint == chint) { if (this->lockAsBitmapOnlyIfAlreadyCached(&bm, dstInfo)) { @@ -264,7 +263,7 @@ bool SkImage_Lazy::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, siz } } - if (this->getROPixels(&bm, dstColorSpace, chint)) { + if (this->getROPixels(&bm, chint)) { return bm.readPixels(dstInfo, dstPixels, dstRB, srcX, srcY); } return false; @@ -275,8 +274,7 @@ sk_sp<SkData> SkImage_Lazy::onRefEncoded() const { return generator->refEncodedData(); } -bool SkImage_Lazy::getROPixels(SkBitmap* bitmap, SkColorSpace* dstColorSpace, - CachingHint chint) const { +bool SkImage_Lazy::getROPixels(SkBitmap* bitmap, CachingHint chint) const { return this->lockAsBitmap(bitmap, chint, fInfo); } diff --git a/src/image/SkImage_Lazy.h b/src/image/SkImage_Lazy.h index 5c30ee390a..739b5b50ab 100644 --- a/src/image/SkImage_Lazy.h +++ b/src/image/SkImage_Lazy.h @@ -54,7 +54,7 @@ public: #endif sk_sp<SkData> onRefEncoded() const override; sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; - bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, CachingHint) const override; + bool getROPixels(SkBitmap*, CachingHint) const override; bool onIsLazyGenerated() const override { return true; } sk_sp<SkImage> onMakeColorSpace(sk_sp<SkColorSpace>) const override; diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index a3d6c77f6f..db67d3e40c 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -87,7 +87,7 @@ public: SkScalar scaleAdjust[2]) const override; #endif - bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, CachingHint) const override; + bool getROPixels(SkBitmap*, CachingHint) const override; sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } @@ -165,7 +165,7 @@ bool SkImage_Raster::onPeekPixels(SkPixmap* pm) const { return fBitmap.peekPixels(pm); } -bool SkImage_Raster::getROPixels(SkBitmap* dst, SkColorSpace* dstColorSpace, CachingHint) const { +bool SkImage_Raster::getROPixels(SkBitmap* dst, CachingHint) const { *dst = fBitmap; return true; } |