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

Side by Side Diff: include/effects/SkColorCubeFilter.h

Issue 1827433002: Reland of [2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « include/effects/SkBlurDrawLooper.h ('k') | include/effects/SkColorFilterImageFilter.h » ('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 2014 Google Inc. 2 * Copyright 2014 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 SkColorCubeFilter_DEFINED 8 #ifndef SkColorCubeFilter_DEFINED
9 #define SkColorCubeFilter_DEFINED 9 #define SkColorCubeFilter_DEFINED
10 10
11 #include "SkColorFilter.h" 11 #include "SkColorFilter.h"
12 #include "SkData.h" 12 #include "SkData.h"
13 #include "../private/SkMutex.h" 13 #include "../private/SkMutex.h"
14 #include "../private/SkTemplates.h" 14 #include "../private/SkTemplates.h"
15 15
16 class SK_API SkColorCubeFilter : public SkColorFilter { 16 class SK_API SkColorCubeFilter : public SkColorFilter {
17 public: 17 public:
18 /** cubeData must containt a 3D data in the form of cube of the size: 18 /** cubeData must containt a 3D data in the form of cube of the size:
19 * cubeDimension * cubeDimension * cubeDimension * sizeof(SkColor) 19 * cubeDimension * cubeDimension * cubeDimension * sizeof(SkColor)
20 * This cube contains a transform where (x,y,z) maps to the (r,g,b). 20 * This cube contains a transform where (x,y,z) maps to the (r,g,b).
21 * The alpha components of the colors must be 0xFF. 21 * The alpha components of the colors must be 0xFF.
22 */ 22 */
23 static sk_sp<SkColorFilter> Make(sk_sp<SkData> cubeData, int cubeDimension);
24
25 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR
23 static SkColorFilter* Create(SkData* cubeData, int cubeDimension); 26 static SkColorFilter* Create(SkData* cubeData, int cubeDimension);
27 #endif
24 28
25 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid e; 29 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid e;
26 uint32_t getFlags() const override; 30 uint32_t getFlags() const override;
27 31
28 #if SK_SUPPORT_GPU 32 #if SK_SUPPORT_GPU
29 const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override; 33 const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override;
30 #endif 34 #endif
31 35
32 SK_TO_STRING_OVERRIDE() 36 SK_TO_STRING_OVERRIDE()
33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorCubeFilter) 37 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorCubeFilter)
34 38
35 protected: 39 protected:
36 SkColorCubeFilter(SkData* cubeData, int cubeDimension); 40 SkColorCubeFilter(sk_sp<SkData> cubeData, int cubeDimension);
37 void flatten(SkWriteBuffer&) const override; 41 void flatten(SkWriteBuffer&) const override;
38 42
39 private: 43 private:
40 /** The cache is initialized on-demand when getProcessingLuts is called. 44 /** The cache is initialized on-demand when getProcessingLuts is called.
41 */ 45 */
42 class ColorCubeProcesingCache { 46 class ColorCubeProcesingCache {
43 public: 47 public:
44 ColorCubeProcesingCache(int cubeDimension); 48 ColorCubeProcesingCache(int cubeDimension);
45 49
46 void getProcessingLuts(const int* (*colorToIndex)[2], 50 void getProcessingLuts(const int* (*colorToIndex)[2],
(...skipping 22 matching lines...) Expand all
69 73
70 sk_sp<SkData> fCubeData; 74 sk_sp<SkData> fCubeData;
71 int32_t fUniqueID; 75 int32_t fUniqueID;
72 76
73 mutable ColorCubeProcesingCache fCache; 77 mutable ColorCubeProcesingCache fCache;
74 78
75 typedef SkColorFilter INHERITED; 79 typedef SkColorFilter INHERITED;
76 }; 80 };
77 81
78 #endif 82 #endif
OLDNEW
« no previous file with comments | « include/effects/SkBlurDrawLooper.h ('k') | include/effects/SkColorFilterImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698