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

Unified Diff: src/core/SkColorLookUpTable.h

Issue 2449243003: Initial implementation of a SkColorSpace_A2B xform (Closed)
Patch Set: fixed compile error on certain trybots related to RVO move-elision Created 4 years, 1 month 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 | « gn/core.gni ('k') | src/core/SkColorLookUpTable.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorLookUpTable.h
diff --git a/src/core/SkColorLookUpTable.h b/src/core/SkColorLookUpTable.h
new file mode 100644
index 0000000000000000000000000000000000000000..b9eb81acc137fb7e7a9f8f8060a395d0c2ea9616
--- /dev/null
+++ b/src/core/SkColorLookUpTable.h
@@ -0,0 +1,40 @@
+/*
+ * 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 SkColorLookUpTable_DEFINED
+#define SkColorLookUpTable_DEFINED
+
+#include "SkRefCnt.h"
+#include "SkTemplates.h"
+
+class SkColorLookUpTable : public SkRefCnt {
+public:
+ static constexpr uint8_t kOutputChannels = 3;
+
+ SkColorLookUpTable(uint8_t inputChannels, const uint8_t gridPoints[3]) {
+ SkASSERT(3 == inputChannels);
+ memcpy(fGridPoints, gridPoints, 3 * sizeof(uint8_t));
+ }
+
+ void interp3D(float dst[3], float src[3]) const;
+
+private:
+ const float* table() const {
+ return SkTAddOffset<const float>(this, sizeof(SkColorLookUpTable));
+ }
+
+ uint8_t fGridPoints[3];
+
+public:
+ // Objects of this type are created in a custom fashion using sk_malloc_throw
+ // and therefore must be sk_freed.
+ void* operator new(size_t size) = delete;
+ void* operator new(size_t, void* p) { return p; }
+ void operator delete(void* p) { sk_free(p); }
+};
+
+#endif
« no previous file with comments | « gn/core.gni ('k') | src/core/SkColorLookUpTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698