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

Side by Side Diff: gm/dcshader.cpp

Issue 2175563003: Bundle SkShader::asFragmentProcessor arguments in a struct (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix indentation to be less arbitrary Created 4 years, 5 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 | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp ('k') | include/core/SkShader.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 #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 18 matching lines...) Expand all
29 class DCShader : public SkShader { 29 class DCShader : public SkShader {
30 public: 30 public:
31 DCShader(const SkMatrix& matrix) : fDeviceMatrix(matrix) {} 31 DCShader(const SkMatrix& matrix) : fDeviceMatrix(matrix) {}
32 32
33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader); 33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader);
34 34
35 void flatten(SkWriteBuffer& buf) const override { 35 void flatten(SkWriteBuffer& buf) const override {
36 buf.writeMatrix(fDeviceMatrix); 36 buf.writeMatrix(fDeviceMatrix);
37 } 37 }
38 38
39 sk_sp<GrFragmentProcessor> asFragmentProcessor(GrContext*, 39 sk_sp<GrFragmentProcessor> asFragmentProcessor(const AsFPArgs&) const overri de;
40 const SkMatrix& viewM,
41 const SkMatrix* localMatrix,
42 SkFilterQuality,
43 SkSourceGammaTreatment) const override;
44 40
45 #ifndef SK_IGNORE_TO_STRING 41 #ifndef SK_IGNORE_TO_STRING
46 void toString(SkString* str) const override { 42 void toString(SkString* str) const override {
47 str->appendf("DCShader: ()"); 43 str->appendf("DCShader: ()");
48 } 44 }
49 #endif 45 #endif
50 46
51 private: 47 private:
52 const SkMatrix fDeviceMatrix; 48 const SkMatrix fDeviceMatrix;
53 }; 49 };
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 89
94 private: 90 private:
95 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, 91 void onGetGLSLProcessorKey(const GrGLSLCaps& caps,
96 GrProcessorKeyBuilder* b) const override {} 92 GrProcessorKeyBuilder* b) const override {}
97 93
98 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } 94 bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
99 95
100 GrCoordTransform fDeviceTransform; 96 GrCoordTransform fDeviceTransform;
101 }; 97 };
102 98
103 sk_sp<GrFragmentProcessor> DCShader::asFragmentProcessor(GrContext*, 99 sk_sp<GrFragmentProcessor> DCShader::asFragmentProcessor(const AsFPArgs&) const {
104 const SkMatrix& viewM,
105 const SkMatrix* localMa trix,
106 SkFilterQuality,
107 SkSourceGammaTreatment) const {
108 sk_sp<GrFragmentProcessor> inner(new DCFP(fDeviceMatrix)); 100 sk_sp<GrFragmentProcessor> inner(new DCFP(fDeviceMatrix));
109 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); 101 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
110 } 102 }
111 103
112 class DCShaderGM : public GM { 104 class DCShaderGM : public GM {
113 public: 105 public:
114 DCShaderGM() { 106 DCShaderGM() {
115 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); 107 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC));
116 } 108 }
117 109
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 }; 285 };
294 286
295 SkTArray<Prim*> fPrims; 287 SkTArray<Prim*> fPrims;
296 288
297 typedef GM INHERITED; 289 typedef GM INHERITED;
298 }; 290 };
299 291
300 DEF_GM(return new DCShaderGM;) 292 DEF_GM(return new DCShaderGM;)
301 } 293 }
302 #endif 294 #endif
OLDNEW
« no previous file with comments | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp ('k') | include/core/SkShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698