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

Side by Side Diff: gm/dcshader.cpp

Issue 1388113002: Bye bye processor data manager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove files Created 5 years, 2 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 | « no previous file | gm/texturedomaineffect.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "gm.h" 9 #include "gm.h"
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 19 matching lines...) Expand all
30 30
31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader); 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader);
32 32
33 void flatten(SkWriteBuffer& buf) const override { 33 void flatten(SkWriteBuffer& buf) const override {
34 buf.writeMatrix(fDeviceMatrix); 34 buf.writeMatrix(fDeviceMatrix);
35 } 35 }
36 36
37 const GrFragmentProcessor* asFragmentProcessor(GrContext*, 37 const GrFragmentProcessor* asFragmentProcessor(GrContext*,
38 const SkMatrix& viewM, 38 const SkMatrix& viewM,
39 const SkMatrix* localMatrix, 39 const SkMatrix* localMatrix,
40 SkFilterQuality, 40 SkFilterQuality) const overri de;
41 GrProcessorDataManager*) cons t override;
42 41
43 #ifndef SK_IGNORE_TO_STRING 42 #ifndef SK_IGNORE_TO_STRING
44 void toString(SkString* str) const override { 43 void toString(SkString* str) const override {
45 str->appendf("DCShader: ()"); 44 str->appendf("DCShader: ()");
46 } 45 }
47 #endif 46 #endif
48 47
49 private: 48 private:
50 const SkMatrix fDeviceMatrix; 49 const SkMatrix fDeviceMatrix;
51 }; 50 };
52 51
53 SkFlattenable* DCShader::CreateProc(SkReadBuffer& buf) { 52 SkFlattenable* DCShader::CreateProc(SkReadBuffer& buf) {
54 SkMatrix matrix; 53 SkMatrix matrix;
55 buf.readMatrix(&matrix); 54 buf.readMatrix(&matrix);
56 return new DCShader(matrix); 55 return new DCShader(matrix);
57 } 56 }
58 57
59 class DCFP : public GrFragmentProcessor { 58 class DCFP : public GrFragmentProcessor {
60 public: 59 public:
61 DCFP(GrProcessorDataManager*, const SkMatrix& m) : fDeviceTransform(kDevice_ GrCoordSet, m) { 60 DCFP(const SkMatrix& m) : fDeviceTransform(kDevice_GrCoordSet, m) {
62 this->addCoordTransform(&fDeviceTransform); 61 this->addCoordTransform(&fDeviceTransform);
63 this->initClassID<DCFP>(); 62 this->initClassID<DCFP>();
64 } 63 }
65 64
66 GrGLFragmentProcessor* onCreateGLInstance() const override { 65 GrGLFragmentProcessor* onCreateGLInstance() const override {
67 class DCGLFP : public GrGLFragmentProcessor { 66 class DCGLFP : public GrGLFragmentProcessor {
68 void emitCode(EmitArgs& args) override { 67 void emitCode(EmitArgs& args) override {
69 GrGLFragmentBuilder* fpb = args.fBuilder->getFragmentShaderBuild er(); 68 GrGLFragmentBuilder* fpb = args.fBuilder->getFragmentShaderBuild er();
70 fpb->codeAppendf("vec2 c = %s;", fpb->ensureFSCoords2D(args.fCoo rds, 0).c_str()); 69 fpb->codeAppendf("vec2 c = %s;", fpb->ensureFSCoords2D(args.fCoo rds, 0).c_str());
71 fpb->codeAppend("vec2 r = mod(c, vec2(20.0));"); 70 fpb->codeAppend("vec2 r = mod(c, vec2(20.0));");
(...skipping 18 matching lines...) Expand all
90 89
91 private: 90 private:
92 void onGetGLProcessorKey(const GrGLSLCaps& caps, 91 void onGetGLProcessorKey(const GrGLSLCaps& caps,
93 GrProcessorKeyBuilder* b) const override {} 92 GrProcessorKeyBuilder* b) const override {}
94 93
95 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } 94 bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
96 95
97 GrCoordTransform fDeviceTransform; 96 GrCoordTransform fDeviceTransform;
98 }; 97 };
99 98
100 const GrFragmentProcessor* DCShader::asFragmentProcessor( 99 const GrFragmentProcessor* DCShader::asFragmentProcessor(GrContext*,
101 GrContext*, 100 const SkMatrix& viewM,
102 const SkMatrix& viewM, 101 const SkMatrix* localMa trix,
103 const SkMatrix* localMatrix, 102 SkFilterQuality) const {
104 SkFilterQuality, 103 SkAutoTUnref<const GrFragmentProcessor> inner(new DCFP(fDeviceMatrix));
105 GrProcessorDataManager* procDat aManager) const {
106 SkAutoTUnref<const GrFragmentProcessor> inner(new DCFP(procDataManager, fDev iceMatrix));
107 return GrFragmentProcessor::MulOutputByInputAlpha(inner); 104 return GrFragmentProcessor::MulOutputByInputAlpha(inner);
108 } 105 }
109 106
110 class DCShaderGM : public GM { 107 class DCShaderGM : public GM {
111 public: 108 public:
112 DCShaderGM() { 109 DCShaderGM() {
113 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); 110 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC));
114 } 111 }
115 112
116 ~DCShaderGM() override { 113 ~DCShaderGM() override {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 }; 288 };
292 289
293 SkTArray<Prim*> fPrims; 290 SkTArray<Prim*> fPrims;
294 291
295 typedef GM INHERITED; 292 typedef GM INHERITED;
296 }; 293 };
297 294
298 DEF_GM(return new DCShaderGM;) 295 DEF_GM(return new DCShaderGM;)
299 } 296 }
300 #endif 297 #endif
OLDNEW
« no previous file with comments | « no previous file | gm/texturedomaineffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698