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

Unified Diff: src/core/SkColorSpaceXform.h

Issue 1952063002: Create SkColorSpaceXform to handle color conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 7 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 | « src/codec/SkJpegCodec.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
new file mode 100644
index 0000000000000000000000000000000000000000..c3010f0ccac99c00867c4e8eea7e7ae2d3b330ce
--- /dev/null
+++ b/src/core/SkColorSpaceXform.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkColorSpaceXform_DEFINED
+#define SkColorSpaceXform_DEFINED
+
+#include "SkColorSpace.h"
+
+class SkColorSpaceXform {
+public:
+
+ /**
+ * Create an object to handle color space conversions.
+ *
+ * @param srcSpace The encoded color space.
+ * @param dstSpace The destination color space.
+ *
+ */
+ static std::unique_ptr<SkColorSpaceXform> New(const sk_sp<SkColorSpace>& srcSpace,
+ const sk_sp<SkColorSpace>& dstSpace);
+
+ /**
+ * Apply the color conversion to a src buffer, storing the output in the dst buffer.
+ * The src is stored in RGBA_8888 and the dst is stored in 8888 platform format.
+ * The output is not premultiplied.
+ */
+ virtual void xform_RGBA_8888(uint32_t* dst, const uint32_t* src, uint32_t len) const = 0;
+
+ virtual ~SkColorSpaceXform() {}
+};
+
+class SkGammaByValueXform : public SkColorSpaceXform {
+public:
+
+ void xform_RGBA_8888(uint32_t* dst, const uint32_t* src, uint32_t len) const override;
+
+private:
+ SkGammaByValueXform(float srcGammas[3], const SkMatrix44& srcToDst, float dstGammas[3]);
+
+ float fSrcGammas[3];
+ const SkMatrix44 fSrcToDst;
+ float fDstGammas[3];
+
+ friend class SkColorSpaceXform;
+};
+
+#endif
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | src/core/SkColorSpaceXform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698