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

Unified Diff: src/core/SkColorSpace_Base.h

Issue 2166093003: Miscellaneous color space refactors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Tweak SkColorLookUpTable constructor Created 4 years, 5 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/core/SkColorSpaceXform.cpp ('k') | src/core/SkColorSpace_ICC.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorSpace_Base.h
diff --git a/src/core/SkColorSpace_Base.h b/src/core/SkColorSpace_Base.h
index d18b631072d928932f5dc381c19fdc70aadd76c0..6cfbb8c837bf4b3a398e59523d551cb795f3b8bb 100644
--- a/src/core/SkColorSpace_Base.h
+++ b/src/core/SkColorSpace_Base.h
@@ -129,18 +129,27 @@ struct SkGammas : SkRefCnt {
};
struct SkColorLookUpTable : public SkRefCnt {
+ static constexpr uint8_t kOutputChannels = 3;
+
uint8_t fInputChannels;
mtklein 2016/07/21 19:46:45 Is this one ever going to be not 3?
msarett 2016/07/21 19:49:28 Once we support CMYK, yes. That's why I'm letting
- uint8_t fOutputChannels;
uint8_t fGridPoints[3];
- std::unique_ptr<float[]> fTable;
- SkColorLookUpTable()
- : fInputChannels(0)
- , fOutputChannels(0)
- , fTable(nullptr)
+ const float* table() const {
+ return SkTAddOffset<const float>(this, sizeof(SkColorLookUpTable));
+ }
+
+ SkColorLookUpTable(uint8_t inputChannels, uint8_t gridPoints[3])
+ : fInputChannels(inputChannels)
{
- fGridPoints[0] = fGridPoints[1] = fGridPoints[2] = 0;
+ SkASSERT(3 == inputChannels);
+ memcpy(fGridPoints, gridPoints, 3 * sizeof(uint8_t));
mtklein 2016/07/21 19:46:45 a.k.a, 3
msarett 2016/07/21 19:49:28 True.
}
+
+ // 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); }
};
class SkColorSpace_Base : public SkColorSpace {
« no previous file with comments | « src/core/SkColorSpaceXform.cpp ('k') | src/core/SkColorSpace_ICC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698