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

Unified Diff: src/core/SkColorSpaceXform_Base.h

Issue 2413383002: Cache dst LUTs in SkColorSpaceXform (Closed)
Patch Set: Ref the storage on SkColorSpaceXform Created 4 years, 2 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_Base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorSpaceXform_Base.h
diff --git a/src/core/SkColorSpaceXform_Base.h b/src/core/SkColorSpaceXform_Base.h
index 02714ad59ee4800a9c5960aafd0ef72283375b08..c1b9785424eafca700156ac54d3aaa45153d061b 100644
--- a/src/core/SkColorSpaceXform_Base.h
+++ b/src/core/SkColorSpaceXform_Base.h
@@ -11,6 +11,23 @@
#include "SkColorSpace.h"
#include "SkColorSpace_Base.h"
#include "SkColorSpaceXform.h"
+#include "SkResourceCache.h"
+
+class SkColorSpaceXform_Base : public SkColorSpaceXform {
+public:
+ static constexpr int kDstGammaTableSize = 1024;
+
+protected:
+ virtual bool onApply(ColorFormat dstFormat, void* dst, ColorFormat srcFormat, const void* src,
+ int count, SkAlphaType alphaType) const = 0;
+
+private:
+ static void BuildDstGammaTables(const uint8_t* outGammaTables[3], uint8_t* gammaTableStorage,
+ const SkColorSpace* space, bool gammasAreMatching);
+
+ friend class SkColorSpaceXform;
+ friend class SkColorSpace_Base;
+};
enum SrcGamma {
kLinear_SrcGamma,
@@ -31,24 +48,22 @@ enum ColorSpaceMatch {
};
template <SrcGamma kSrc, DstGamma kDst, ColorSpaceMatch kCSM>
-class SkColorSpaceXform_Base : public SkColorSpaceXform {
-public:
- static constexpr int kDstGammaTableSize = 1024;
-
+class SkColorSpaceXform_XYZ : public SkColorSpaceXform_Base {
protected:
bool onApply(ColorFormat dstFormat, void* dst, ColorFormat srcFormat, const void* src,
int count, SkAlphaType alphaType) const override;
private:
- SkColorSpaceXform_Base(SkColorSpace* srcSpace, const SkMatrix44& srcToDst,
- SkColorSpace* dstSpace);
+ SkColorSpaceXform_XYZ(SkColorSpace* srcSpace, const SkMatrix44& srcToDst,
+ SkColorSpace* dstSpace);
sk_sp<SkColorLookUpTable> fColorLUT;
// Contain pointers into storage or pointers into precomputed tables.
const float* fSrcGammaTables[3];
+ SkAutoTMalloc<float> fSrcStorage;
const uint8_t* fDstGammaTables[3];
- SkAutoMalloc fStorage;
+ sk_sp<SkData> fDstStorage;
float fSrcToDst[16];
« no previous file with comments | « src/core/SkColorSpaceXform.cpp ('k') | src/core/SkColorSpace_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698