OLD | NEW |
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 #include "gm.h" | 8 #include "gm.h" |
9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 #include "GrFragmentProcessor.h" | 10 #include "GrFragmentProcessor.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader); | 32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader); |
33 | 33 |
34 void flatten(SkWriteBuffer& buf) const override { | 34 void flatten(SkWriteBuffer& buf) const override { |
35 buf.writeMatrix(fDeviceMatrix); | 35 buf.writeMatrix(fDeviceMatrix); |
36 } | 36 } |
37 | 37 |
38 const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 38 const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
39 const SkMatrix& viewM, | 39 const SkMatrix& viewM, |
40 const SkMatrix* localMatrix, | 40 const SkMatrix* localMatrix, |
41 SkFilterQuality) const overri
de; | 41 SkFilterQuality, |
| 42 SkSourceGammaTreatment) const
override; |
42 | 43 |
43 #ifndef SK_IGNORE_TO_STRING | 44 #ifndef SK_IGNORE_TO_STRING |
44 void toString(SkString* str) const override { | 45 void toString(SkString* str) const override { |
45 str->appendf("DCShader: ()"); | 46 str->appendf("DCShader: ()"); |
46 } | 47 } |
47 #endif | 48 #endif |
48 | 49 |
49 private: | 50 private: |
50 const SkMatrix fDeviceMatrix; | 51 const SkMatrix fDeviceMatrix; |
51 }; | 52 }; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 GrProcessorKeyBuilder* b) const override {} | 95 GrProcessorKeyBuilder* b) const override {} |
95 | 96 |
96 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } | 97 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } |
97 | 98 |
98 GrCoordTransform fDeviceTransform; | 99 GrCoordTransform fDeviceTransform; |
99 }; | 100 }; |
100 | 101 |
101 const GrFragmentProcessor* DCShader::asFragmentProcessor(GrContext*, | 102 const GrFragmentProcessor* DCShader::asFragmentProcessor(GrContext*, |
102 const SkMatrix& viewM, | 103 const SkMatrix& viewM, |
103 const SkMatrix* localMa
trix, | 104 const SkMatrix* localMa
trix, |
104 SkFilterQuality) const
{ | 105 SkFilterQuality, |
| 106 SkSourceGammaTreatment)
const { |
105 SkAutoTUnref<const GrFragmentProcessor> inner(new DCFP(fDeviceMatrix)); | 107 SkAutoTUnref<const GrFragmentProcessor> inner(new DCFP(fDeviceMatrix)); |
106 return GrFragmentProcessor::MulOutputByInputAlpha(inner); | 108 return GrFragmentProcessor::MulOutputByInputAlpha(inner); |
107 } | 109 } |
108 | 110 |
109 class DCShaderGM : public GM { | 111 class DCShaderGM : public GM { |
110 public: | 112 public: |
111 DCShaderGM() { | 113 DCShaderGM() { |
112 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); | 114 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); |
113 } | 115 } |
114 | 116 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 }; | 292 }; |
291 | 293 |
292 SkTArray<Prim*> fPrims; | 294 SkTArray<Prim*> fPrims; |
293 | 295 |
294 typedef GM INHERITED; | 296 typedef GM INHERITED; |
295 }; | 297 }; |
296 | 298 |
297 DEF_GM(return new DCShaderGM;) | 299 DEF_GM(return new DCShaderGM;) |
298 } | 300 } |
299 #endif | 301 #endif |
OLD | NEW |