Add getColorSpace to GrTextureProducer
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2150113002 Review-Url: https://codereview.chromium.org/2150113002
This commit is contained in:
parent
6e21efd842
commit
428036621e
@ -41,6 +41,10 @@ void GrBitmapTextureAdjuster::didCacheCopy(const GrUniqueKey& copyKey) {
|
|||||||
GrInstallBitmapUniqueKeyInvalidator(copyKey, fBmp->pixelRef());
|
GrInstallBitmapUniqueKeyInvalidator(copyKey, fBmp->pixelRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkColorSpace* GrBitmapTextureAdjuster::getColorSpace() {
|
||||||
|
return fBmp->colorSpace();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// SkImage's don't have a way of communicating whether they're alpha-only. So we fallback to
|
// SkImage's don't have a way of communicating whether they're alpha-only. So we fallback to
|
||||||
@ -67,6 +71,10 @@ void GrImageTextureAdjuster::didCacheCopy(const GrUniqueKey& copyKey) {
|
|||||||
// We don't currently have a mechanism for notifications on Images!
|
// We don't currently have a mechanism for notifications on Images!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkColorSpace* GrImageTextureAdjuster::getColorSpace() {
|
||||||
|
return fImageBase->onImageInfo().colorSpace();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
GrBitmapTextureMaker::GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap)
|
GrBitmapTextureMaker::GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap)
|
||||||
@ -114,6 +122,10 @@ void GrBitmapTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
|
|||||||
GrInstallBitmapUniqueKeyInvalidator(copyKey, fBitmap.pixelRef());
|
GrInstallBitmapUniqueKeyInvalidator(copyKey, fBitmap.pixelRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkColorSpace* GrBitmapTextureMaker::getColorSpace() {
|
||||||
|
return fBitmap.colorSpace();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
static bool cacher_is_alpha_only(const SkImageCacherator& cacher) {
|
static bool cacher_is_alpha_only(const SkImageCacherator& cacher) {
|
||||||
return kAlpha_8_SkColorType == cacher.info().colorType();
|
return kAlpha_8_SkColorType == cacher.info().colorType();
|
||||||
@ -148,3 +160,7 @@ void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
|
|||||||
as_IB(fClient)->notifyAddedToCache();
|
as_IB(fClient)->notifyAddedToCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkColorSpace* GrImageTextureMaker::getColorSpace() {
|
||||||
|
return fCacher->info().colorSpace();
|
||||||
|
}
|
||||||
|
@ -21,6 +21,9 @@ class GrBitmapTextureAdjuster : public GrTextureAdjuster {
|
|||||||
public:
|
public:
|
||||||
explicit GrBitmapTextureAdjuster(const SkBitmap* bmp);
|
explicit GrBitmapTextureAdjuster(const SkBitmap* bmp);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SkColorSpace* getColorSpace() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override;
|
void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override;
|
||||||
|
|
||||||
@ -37,6 +40,9 @@ class GrImageTextureAdjuster : public GrTextureAdjuster {
|
|||||||
public:
|
public:
|
||||||
explicit GrImageTextureAdjuster(const SkImage_Base* img);
|
explicit GrImageTextureAdjuster(const SkImage_Base* img);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SkColorSpace* getColorSpace() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override;
|
void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override;
|
||||||
|
|
||||||
@ -61,6 +67,8 @@ protected:
|
|||||||
|
|
||||||
void didCacheCopy(const GrUniqueKey& copyKey) override;
|
void didCacheCopy(const GrUniqueKey& copyKey) override;
|
||||||
|
|
||||||
|
SkColorSpace* getColorSpace() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const SkBitmap fBitmap;
|
const SkBitmap fBitmap;
|
||||||
GrUniqueKey fOriginalKey;
|
GrUniqueKey fOriginalKey;
|
||||||
@ -84,6 +92,8 @@ protected:
|
|||||||
void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) override;
|
void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) override;
|
||||||
void didCacheCopy(const GrUniqueKey& copyKey) override;
|
void didCacheCopy(const GrUniqueKey& copyKey) override;
|
||||||
|
|
||||||
|
SkColorSpace* getColorSpace() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkImageCacherator* fCacher;
|
SkImageCacherator* fCacher;
|
||||||
const SkImage* fClient;
|
const SkImage* fClient;
|
||||||
|
@ -108,6 +108,8 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual void didCacheCopy(const GrUniqueKey& copyKey) = 0;
|
virtual void didCacheCopy(const GrUniqueKey& copyKey) = 0;
|
||||||
|
|
||||||
|
virtual SkColorSpace* getColorSpace() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int fWidth;
|
const int fWidth;
|
||||||
const int fHeight;
|
const int fHeight;
|
||||||
|
Loading…
Reference in New Issue
Block a user