diff options
author | brianosman <brianosman@google.com> | 2016-04-06 07:38:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-06 07:38:23 -0700 |
commit | 898235c4864df66aa7f6d32bc2a8b8551040ce1e (patch) | |
tree | 5fb30f04825c59a970a208cabadd4bad0be283b3 /src/core/SkSpecialImage.h | |
parent | 1817d282cda17cb8c2db0ac6fdc937743c026016 (diff) |
SkSurfaceProps now has a gamma-correct ("AllowSRGBInputs") flag. That's propagated in a few places so that the backend can do the right thing for L32 vs S32 mode.
Also added SkSurfaceProps to SkSpecialImage, so that Image -> Surface conversion can preserve the desired behavior during filtering.
Many small changes, including a bunch of comments about places where we may be losing information right now. My approach was to ensure that if anything fails, it will always fall back to "legacy" mode - gamma-correctness is opt-in, so I'll just have to feed things through as missing cases are exposed.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1838953007
Review URL: https://codereview.chromium.org/1845283003
Diffstat (limited to 'src/core/SkSpecialImage.h')
-rw-r--r-- | src/core/SkSpecialImage.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/core/SkSpecialImage.h b/src/core/SkSpecialImage.h index 4de28ebd16..57785fa445 100644 --- a/src/core/SkSpecialImage.h +++ b/src/core/SkSpecialImage.h @@ -10,6 +10,7 @@ #include "SkNextID.h" #include "SkRefCnt.h" +#include "SkSurfaceProps.h" // remove this when internal_getProxy goes away (see skbug.com/4965) #include "SkImageFilter.h" @@ -47,6 +48,8 @@ public: typedef void* ReleaseContext; typedef void(*RasterReleaseProc)(void* pixels, ReleaseContext); + const SkSurfaceProps& props() const { return fProps; } + int width() const { return fSubset.width(); } int height() const { return fSubset.height(); } const SkIRect& subset() const { return fSubset; } @@ -69,20 +72,24 @@ public: static sk_sp<SkSpecialImage> MakeFromImage(SkImageFilter::Proxy*, const SkIRect& subset, - sk_sp<SkImage>); + sk_sp<SkImage>, + const SkSurfaceProps* = nullptr); static sk_sp<SkSpecialImage> MakeFromRaster(SkImageFilter::Proxy*, const SkIRect& subset, - const SkBitmap&); + const SkBitmap&, + const SkSurfaceProps* = nullptr); static sk_sp<SkSpecialImage> MakeFromGpu(SkImageFilter::Proxy*, const SkIRect& subset, uint32_t uniqueID, GrTexture*, + const SkSurfaceProps* = nullptr, SkAlphaType at = kPremul_SkAlphaType); static sk_sp<SkSpecialImage> MakeFromPixmap(SkImageFilter::Proxy*, const SkIRect& subset, const SkPixmap&, RasterReleaseProc, - ReleaseContext); + ReleaseContext, + const SkSurfaceProps* = nullptr); /** * Create a new special surface with a backend that is compatible with this special image. @@ -110,7 +117,8 @@ public: // These three internal methods will go away (see skbug.com/4965) bool internal_getBM(SkBitmap* result); - static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const SkBitmap&); + static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const SkBitmap&, + const SkSurfaceProps*); SkImageFilter::Proxy* internal_getProxy() const; // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063) @@ -135,12 +143,8 @@ public: bool peekPixels(SkPixmap*) const; protected: - SkSpecialImage(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID) - : fSubset(subset) - , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::ImageID() - : uniqueID) - , fProxy(proxy) { - } + SkSpecialImage(SkImageFilter::Proxy*, const SkIRect& subset, uint32_t uniqueID, + const SkSurfaceProps*); // The following 2 are for testing and shouldn't be used. friend class TestingSpecialImageAccess; @@ -154,8 +158,9 @@ protected: SkImageFilter::Proxy* proxy() const { return fProxy; } private: - const SkIRect fSubset; - const uint32_t fUniqueID; + const SkSurfaceProps fProps; + const SkIRect fSubset; + const uint32_t fUniqueID; // TODO: remove this ASAP (see skbug.com/4965) SkImageFilter::Proxy* fProxy; |