diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/image/SkImage.cpp | 4 | ||||
-rw-r--r-- | src/image/SkImage_Base.h | 1 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 7 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.h | 1 | ||||
-rw-r--r-- | src/image/SkImage_Lazy.cpp | 3 | ||||
-rw-r--r-- | src/image/SkImage_Raster.cpp | 3 |
6 files changed, 18 insertions, 1 deletions
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 7b90d6e7ed..4eebef7eae 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -74,6 +74,10 @@ bool SkImage::scalePixels(const SkPixmap& dst, SkFilterQuality quality, CachingH /////////////////////////////////////////////////////////////////////////////////////////////////// +SkColorType SkImage::colorType() const { + return as_IB(this)->onColorType(); +} + SkAlphaType SkImage::alphaType() const { return as_IB(this)->onAlphaType(); } diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h index 903cd826be..b3bbbc4080 100644 --- a/src/image/SkImage_Base.h +++ b/src/image/SkImage_Base.h @@ -35,6 +35,7 @@ public: // Implementors: if you can not return the value, return an invalid ImageInfo with w=0 & h=0 // & unknown color space. virtual SkImageInfo onImageInfo() const = 0; + virtual SkColorType onColorType() const = 0; virtual SkAlphaType onAlphaType() const = 0; virtual bool onPeekPixels(SkPixmap*) const { return false; } diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 7c842f69c0..38f38c91ed 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -60,11 +60,16 @@ SkImage_Gpu::~SkImage_Gpu() { } SkImageInfo SkImage_Gpu::onImageInfo() const { + return SkImageInfo::Make(fProxy->width(), fProxy->height(), this->onColorType(), fAlphaType, + fColorSpace); +} + +SkColorType SkImage_Gpu::onColorType() const { SkColorType ct; if (!GrPixelConfigToColorType(fProxy->config(), &ct)) { ct = kUnknown_SkColorType; } - return SkImageInfo::Make(fProxy->width(), fProxy->height(), ct, fAlphaType, fColorSpace); + return ct; } bool SkImage_Gpu::getROPixels(SkBitmap* dst, SkColorSpace*, CachingHint chint) const { diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h index 24a8c78869..3c536a4013 100644 --- a/src/image/SkImage_Gpu.h +++ b/src/image/SkImage_Gpu.h @@ -28,6 +28,7 @@ public: ~SkImage_Gpu() override; SkImageInfo onImageInfo() const override; + SkColorType onColorType() const override; SkAlphaType onAlphaType() const override { return fAlphaType; } bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, CachingHint) const override; diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp index 4adf4e8368..4c12b81a26 100644 --- a/src/image/SkImage_Lazy.cpp +++ b/src/image/SkImage_Lazy.cpp @@ -70,6 +70,9 @@ public: SkImageInfo onImageInfo() const override { return fInfo; } + SkColorType onColorType() const override { + return kUnknown_SkColorType; + } SkAlphaType onAlphaType() const override { return fInfo.alphaType(); } diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index 3ed3a8aea4..688f71c673 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -77,6 +77,9 @@ public: SkImageInfo onImageInfo() const override { return fBitmap.info(); } + SkColorType onColorType() const override { + return fBitmap.colorType(); + } SkAlphaType onAlphaType() const override { return fBitmap.alphaType(); } |