Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Unified Diff: src/core/SkColorSpaceXform.h

Issue 2335723002: Reduce overhead for linear color xforms (Closed)
Patch Set: More refactoring Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bench/ColorCodecBench.cpp ('k') | src/core/SkColorSpaceXform.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorSpaceXform.h
diff --git a/src/core/SkColorSpaceXform.h b/src/core/SkColorSpaceXform.h
index 83ead7b122ba620fc4f0e6c5035e6b53ca959bb7..6d63879653a4a1a72ceb2d741a3f69bd22d91a8a 100644
--- a/src/core/SkColorSpaceXform.h
+++ b/src/core/SkColorSpaceXform.h
@@ -26,9 +26,17 @@ public:
const sk_sp<SkColorSpace>& dstSpace);
/**
- * Apply the color conversion to a src buffer, storing the output in the dst buffer.
- * The src is stored as RGBA (8888). The dst is stored in the format indicated by
- * |dstColorType| and is premultiplied by alpha if |premul| is set.
+ * Apply the color conversion to a |src| buffer, storing the output in the |dst| buffer.
+ *
+ * @param dst Stored in the format described by |dstColorType| and |dstAlphaType|
+ * @param src Stored as RGBA_8888, kUnpremul (note kOpaque is a form of kUnpremul)
+ * @param len Number of pixels in the buffers
+ * @param dstColorType Describes color type of |dst|
+ * @param dstAlphaType Describes alpha type of |dst|
+ * kUnpremul preserves input alpha values
+ * kPremul performs a premultiplication and also preserves alpha values
+ * kOpaque optimization hint, |dst| alphas set to 1
+ *
*/
virtual void apply(void* dst, const uint32_t* src, int len, SkColorType dstColorType,
SkAlphaType dstAlphaType) const = 0;
@@ -36,13 +44,25 @@ public:
virtual ~SkColorSpaceXform() {}
};
+enum SrcGamma {
+ kLinear_SrcGamma,
+ kTable_SrcGamma,
+};
+
+enum DstGamma {
+ kLinear_DstGamma,
+ kSRGB_DstGamma,
+ k2Dot2_DstGamma,
+ kTable_DstGamma,
+};
+
enum ColorSpaceMatch {
kNone_ColorSpaceMatch,
kGamut_ColorSpaceMatch,
kFull_ColorSpaceMatch,
};
-template <SkGammaNamed kDst, ColorSpaceMatch kCSM>
+template <SrcGamma kSrc, DstGamma kDst, ColorSpaceMatch kCSM>
class SkColorSpaceXform_Base : public SkColorSpaceXform {
public:
« no previous file with comments | « bench/ColorCodecBench.cpp ('k') | src/core/SkColorSpaceXform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698