aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/codec
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-03-23 15:32:25 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-24 13:19:53 +0000
commitcf3f2347c8933596aeba873d4ece597a9339392f (patch)
treed340f5802bb11ffe902b5f95ea06c6b75c5ccd74 /include/codec
parenta3bdd44aff94974e720ed04b860fbfe24f8f431e (diff)
Add SkTransferFunctionBehavior flag: Use in codec and encoder
This is a step towards removing the non-linear blending flag from SkColorSpace. The flag on SkColorSpace used to control the premul behavior - now it is controlled by this option. BUG=skia: Change-Id: Ia29bd8c2b0596a93c6aa14332dcd9bd39e388a90 Reviewed-on: https://skia-review.googlesource.com/10008 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'include/codec')
-rw-r--r--include/codec/SkCodec.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index 13730e2a73..11d28ea8f2 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -249,9 +249,10 @@ public:
, fSubset(nullptr)
, fFrameIndex(0)
, fHasPriorFrame(false)
+ , fPremulBehavior(SkTransferFunctionBehavior::kRespect)
{}
- ZeroInitialized fZeroInitialized;
+ ZeroInitialized fZeroInitialized;
/**
* If not NULL, represents a subset of the original image to decode.
* Must be within the bounds returned by getInfo().
@@ -269,14 +270,14 @@ public:
* subset left and subset width to decode partial scanlines on calls
* to getScanlines().
*/
- const SkIRect* fSubset;
+ const SkIRect* fSubset;
/**
* The frame to decode.
*
* Only meaningful for multi-frame images.
*/
- size_t fFrameIndex;
+ size_t fFrameIndex;
/**
* If true, the dst already contains the prior frame.
@@ -295,7 +296,15 @@ public:
* codec needs to first decode the prior frame (which in turn may need
* to decode its prior frame).
*/
- bool fHasPriorFrame;
+ bool fHasPriorFrame;
+
+ /**
+ * Indicates whether we should do a linear premultiply or a legacy premultiply.
+ *
+ * In the case where the dst SkColorSpace is nullptr, this flag is ignored and
+ * we will always do a legacy premultiply.
+ */
+ SkTransferFunctionBehavior fPremulBehavior;
};
/**
@@ -781,7 +790,8 @@ protected:
virtual int onOutputScanline(int inputScanline) const;
- bool initializeColorXform(const SkImageInfo& dstInfo);
+ bool initializeColorXform(const SkImageInfo& dstInfo,
+ SkTransferFunctionBehavior premulBehavior);
SkColorSpaceXform* colorXform() const { return fColorXform.get(); }
virtual std::vector<FrameInfo> onGetFrameInfo() {