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

Side by Side Diff: src/core/SkColorMatrixFilterRowMajor255.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/effects/SkColorMatrixFilter.h ('k') | src/core/SkColorMatrixFilterRowMajor255.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 2007 The Android Open Source Project 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 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"
13 12
14 class SK_API SkColorMatrixFilter : public SkColorFilter { 13 class SK_API SkColorMatrixFilterRowMajor255 : public SkColorFilter {
15 public: 14 public:
16 static SkColorFilter* Create(const SkColorMatrix& cm) { 15 explicit SkColorMatrixFilterRowMajor255(const SkScalar array[20]);
17 return new SkColorMatrixFilter(cm);
18 }
19 static SkColorFilter* Create(const SkScalar array[20]) {
20 return new SkColorMatrixFilter(array);
21 }
22
23 /**
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
26 * [0..255]. The alpha components of the mul and add arguments
27 * are ignored.
28 */
29 static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add);
30 16
31 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid e; 17 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid e;
32 void filterSpan4f(const SkPM4f src[], int count, SkPM4f[]) const override; 18 void filterSpan4f(const SkPM4f src[], int count, SkPM4f[]) const override;
33 uint32_t getFlags() const override; 19 uint32_t getFlags() const override;
34 bool asColorMatrix(SkScalar matrix[20]) const override; 20 bool asColorMatrix(SkScalar matrix[20]) const override;
35 SkColorFilter* newComposed(const SkColorFilter*) const override; 21 SkColorFilter* newComposed(const SkColorFilter*) const override;
36 22
37 #if SK_SUPPORT_GPU 23 #if SK_SUPPORT_GPU
38 const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override; 24 const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override;
39 #endif 25 #endif
40 26
41 SK_TO_STRING_OVERRIDE() 27 SK_TO_STRING_OVERRIDE()
42 28
43 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorMatrixFilter) 29 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorMatrixFilter)
44 30
45 protected: 31 protected:
46 explicit SkColorMatrixFilter(const SkColorMatrix&);
47 explicit SkColorMatrixFilter(const SkScalar array[20]);
48 void flatten(SkWriteBuffer&) const override; 32 void flatten(SkWriteBuffer&) const override;
49 33
50 private: 34 private:
51 SkColorMatrix fMatrix; 35 SkScalar fMatrix[20];
52 float fTranspose[SkColorMatrix::kCount]; // for Sk4s 36 float fTranspose[20]; // for Sk4s
53 uint32_t fFlags; 37 uint32_t fFlags;
54 38
55 void initState(const SkScalar array[20]); 39 void initState(const SkScalar array[20]);
56 40
57 typedef SkColorFilter INHERITED; 41 typedef SkColorFilter INHERITED;
58 }; 42 };
59 43
60 #endif 44 #endif
OLDNEW
« no previous file with comments | « include/effects/SkColorMatrixFilter.h ('k') | src/core/SkColorMatrixFilterRowMajor255.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698