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

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

Issue 1648933002: Move SkColorMatrixFilter implementation to core. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add back newComposed override Created 4 years, 10 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/core/SkColorFilter.h ('k') | src/core/SkColorMatrixFilterRowMajor255.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 2007 The Android Open Source Project 2 * Copyright 2007 The Android Open Source Project
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 SkColorMatrixFilter_DEFINED 8 #ifndef SkColorMatrixFilter_DEFINED
9 #define SkColorMatrixFilter_DEFINED 9 #define SkColorMatrixFilter_DEFINED
10 10
11 #include "SkColorFilter.h" 11 #include "SkColorFilter.h"
12 #include "SkColorMatrix.h" 12 #include "SkColorMatrix.h"
13 13
14 class SK_API SkColorMatrixFilter : public SkColorFilter { 14 class SK_API SkColorMatrixFilter : public SkColorFilter {
15 public: 15 public:
16 static SkColorFilter* Create(const SkColorMatrix& cm) { 16 static SkColorFilter* Create(const SkColorMatrix& cm) {
17 return new SkColorMatrixFilter(cm); 17 return SkColorFilter::CreateMatrixFilterRowMajor255(cm.fMat);
18 } 18 }
19 static SkColorFilter* Create(const SkScalar array[20]) { 19 static SkColorFilter* Create(const SkScalar array[20]) {
20 return new SkColorMatrixFilter(array); 20 return SkColorFilter::CreateMatrixFilterRowMajor255(array);
21 } 21 }
22 22
23 /** 23 /**
24 * Create a colorfilter that multiplies the RGB channels by one color, and 24 * Create a colorfilter that multiplies the RGB channels by one color, and
25 * then adds a second color, pinning the result for each component to 25 * then adds a second color, pinning the result for each component to
26 * [0..255]. The alpha components of the mul and add arguments 26 * [0..255]. The alpha components of the mul and add arguments
27 * are ignored. 27 * are ignored.
28 */ 28 */
29 static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add); 29 static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add);
30
31 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid e;
32 void filterSpan4f(const SkPM4f src[], int count, SkPM4f[]) const override;
33 uint32_t getFlags() const override;
34 bool asColorMatrix(SkScalar matrix[20]) const override;
35 SkColorFilter* newComposed(const SkColorFilter*) const override;
36
37 #if SK_SUPPORT_GPU
38 const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override;
39 #endif
40
41 SK_TO_STRING_OVERRIDE()
42
43 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorMatrixFilter)
44
45 protected:
46 explicit SkColorMatrixFilter(const SkColorMatrix&);
47 explicit SkColorMatrixFilter(const SkScalar array[20]);
48 void flatten(SkWriteBuffer&) const override;
49
50 private:
51 SkColorMatrix fMatrix;
52 float fTranspose[SkColorMatrix::kCount]; // for Sk4s
53 uint32_t fFlags;
54
55 void initState(const SkScalar array[20]);
56
57 typedef SkColorFilter INHERITED;
58 }; 30 };
59 31
60 #endif 32 #endif
OLDNEW
« no previous file with comments | « include/core/SkColorFilter.h ('k') | src/core/SkColorMatrixFilterRowMajor255.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698