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

Side by Side Diff: src/core/SkColorSpaceXform.h

Issue 2195523002: Revert of Add color space xform support to SkJpegCodec (includes F16!) (Closed) Base URL: https://skia.googlesource.com/skia.git@drop
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | src/core/SkColorSpaceXform.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkColorSpaceXform_DEFINED 8 #ifndef SkColorSpaceXform_DEFINED
9 #define SkColorSpaceXform_DEFINED 9 #define SkColorSpaceXform_DEFINED
10 10
11 #include "SkColorSpace.h" 11 #include "SkColorSpace.h"
12 #include "SkColorSpace_Base.h" 12 #include "SkColorSpace_Base.h"
13 13
14 class SkColorSpaceXform : SkNoncopyable { 14 class SkColorSpaceXform : SkNoncopyable {
15 public: 15 public:
16 16
17 typedef uint32_t RGBA32; 17 typedef uint32_t RGBA32;
18 typedef uint32_t BGRA32;
19 typedef uint64_t RGBAF16; 18 typedef uint64_t RGBAF16;
20 19
21 /** 20 /**
22 * Create an object to handle color space conversions. 21 * Create an object to handle color space conversions.
23 * 22 *
24 * @param srcSpace The encoded color space. 23 * @param srcSpace The encoded color space.
25 * @param dstSpace The destination color space. 24 * @param dstSpace The destination color space.
26 * 25 *
27 */ 26 */
28 static std::unique_ptr<SkColorSpaceXform> New(const sk_sp<SkColorSpace>& src Space, 27 static std::unique_ptr<SkColorSpaceXform> New(const sk_sp<SkColorSpace>& src Space,
29 const sk_sp<SkColorSpace>& dst Space); 28 const sk_sp<SkColorSpace>& dst Space);
30 29
31 /** 30 /**
32 * Apply the color conversion to a src buffer, storing the output in the ds t buffer. 31 * Apply the color conversion to a src buffer, storing the output in the ds t buffer.
33 * The src is stored as RGBA (8888) and is treated as opaque. 32 * The src is stored as RGBA (8888) and is treated as opaque.
34 * TODO (msarett): Support non-opaque srcs. 33 * TODO (msarett): Support non-opaque srcs.
35 */ 34 */
36 virtual void applyToRGBA(RGBA32* dst, const RGBA32* src, int len) const = 0; 35 virtual void applyTo8888(SkPMColor* dst, const RGBA32* src, int len) const = 0;
37 virtual void applyToBGRA(BGRA32* dst, const RGBA32* src, int len) const = 0;
38 virtual void applyToF16(RGBAF16* dst, const RGBA32* src, int len) const = 0; 36 virtual void applyToF16(RGBAF16* dst, const RGBA32* src, int len) const = 0;
39 37
40 virtual ~SkColorSpaceXform() {} 38 virtual ~SkColorSpaceXform() {}
41 }; 39 };
42 40
43 template <SkColorSpace::GammaNamed Dst> 41 template <SkColorSpace::GammaNamed Dst>
44 class SkColorSpaceXform_Base : public SkColorSpaceXform { 42 class SkColorSpaceXform_Base : public SkColorSpaceXform {
45 public: 43 public:
46 44
47 void applyToRGBA(RGBA32* dst, const RGBA32* src, int len) const override; 45 void applyTo8888(SkPMColor* dst, const RGBA32* src, int len) const override;
48 void applyToBGRA(BGRA32* dst, const RGBA32* src, int len) const override;
49 void applyToF16(RGBAF16* dst, const RGBA32* src, int len) const override; 46 void applyToF16(RGBAF16* dst, const RGBA32* src, int len) const override;
50 47
51 static constexpr int kDstGammaTableSize = 1024; 48 static constexpr int kDstGammaTableSize = 1024;
52 49
53 private: 50 private:
54 SkColorSpaceXform_Base(const sk_sp<SkColorSpace>& srcSpace, const SkMatrix44 & srcToDst, 51 SkColorSpaceXform_Base(const sk_sp<SkColorSpace>& srcSpace, const SkMatrix44 & srcToDst,
55 const sk_sp<SkColorSpace>& dstSpace); 52 const sk_sp<SkColorSpace>& dstSpace);
56 53
57 sk_sp<SkColorLookUpTable> fColorLUT; 54 sk_sp<SkColorLookUpTable> fColorLUT;
58 55
59 // May contain pointers into storage or pointers into precomputed tables. 56 // May contain pointers into storage or pointers into precomputed tables.
60 const float* fSrcGammaTables[3]; 57 const float* fSrcGammaTables[3];
61 float fSrcGammaTableStorage[3 * 256]; 58 float fSrcGammaTableStorage[3 * 256];
62 59
63 float fSrcToDst[16]; 60 float fSrcToDst[16];
64 61
65 // May contain pointers into storage or pointers into precomputed tables. 62 // May contain pointers into storage or pointers into precomputed tables.
66 const uint8_t* fDstGammaTables[3]; 63 const uint8_t* fDstGammaTables[3];
67 uint8_t fDstGammaTableStorage[3 * kDstGammaTableSize]; 64 uint8_t fDstGammaTableStorage[3 * kDstGammaTableSize];
68 65
69 friend class SkColorSpaceXform; 66 friend class SkColorSpaceXform;
70 }; 67 };
71 68
72 #endif 69 #endif
OLDNEW
« 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