OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 }; | 48 }; |
49 | 49 |
50 SkFlattenable* DCShader::CreateProc(SkReadBuffer& buf) { | 50 SkFlattenable* DCShader::CreateProc(SkReadBuffer& buf) { |
51 SkMatrix matrix; | 51 SkMatrix matrix; |
52 buf.readMatrix(&matrix); | 52 buf.readMatrix(&matrix); |
53 return SkNEW_ARGS(DCShader, (matrix)); | 53 return SkNEW_ARGS(DCShader, (matrix)); |
54 } | 54 } |
55 | 55 |
56 class DCFP : public GrFragmentProcessor { | 56 class DCFP : public GrFragmentProcessor { |
57 public: | 57 public: |
58 DCFP(const SkMatrix& m) : fDeviceTransform(kDevice_GrCoordSet, m) { | 58 DCFP(GrShaderDataManager*, const SkMatrix& m) : fDeviceTransform(kDevice_GrC
oordSet, m) { |
59 this->addCoordTransform(&fDeviceTransform); | 59 this->addCoordTransform(&fDeviceTransform); |
60 this->initClassID<DCFP>(); | 60 this->initClassID<DCFP>(); |
61 } | 61 } |
62 | 62 |
63 void getGLProcessorKey(const GrGLSLCaps& caps, | 63 void getGLProcessorKey(const GrGLSLCaps& caps, |
64 GrProcessorKeyBuilder* b) const override {} | 64 GrProcessorKeyBuilder* b) const override {} |
65 | 65 |
66 GrGLFragmentProcessor* createGLInstance() const override { | 66 GrGLFragmentProcessor* createGLInstance() const override { |
67 class DCGLFP : public GrGLFragmentProcessor { | 67 class DCGLFP : public GrGLFragmentProcessor { |
68 void emitCode(GrGLFPBuilder* builder, | 68 void emitCode(GrGLFPBuilder* builder, |
(...skipping 25 matching lines...) Expand all Loading... |
94 } | 94 } |
95 | 95 |
96 private: | 96 private: |
97 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } | 97 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } |
98 | 98 |
99 GrCoordTransform fDeviceTransform; | 99 GrCoordTransform fDeviceTransform; |
100 }; | 100 }; |
101 | 101 |
102 bool DCShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMat
rix& viewM, | 102 bool DCShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMat
rix& viewM, |
103 const SkMatrix* localMatrix, GrColor* color, | 103 const SkMatrix* localMatrix, GrColor* color, |
104 GrShaderDataManager*, GrFragmentProcessor** f
p) const { | 104 GrShaderDataManager* shaderDataManager, |
105 *fp = SkNEW_ARGS(DCFP, (fDeviceMatrix)); | 105 GrFragmentProcessor** fp) const { |
| 106 *fp = SkNEW_ARGS(DCFP, (shaderDataManager, fDeviceMatrix)); |
106 *color = GrColorPackA4(paint.getAlpha()); | 107 *color = GrColorPackA4(paint.getAlpha()); |
107 return true; | 108 return true; |
108 } | 109 } |
109 | 110 |
110 class DCShaderGM : public GM { | 111 class DCShaderGM : public GM { |
111 public: | 112 public: |
112 DCShaderGM() { | 113 DCShaderGM() { |
113 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); | 114 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); |
114 } | 115 } |
115 | 116 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 }; | 305 }; |
305 | 306 |
306 SkTArray<Prim*> fPrims; | 307 SkTArray<Prim*> fPrims; |
307 | 308 |
308 typedef GM INHERITED; | 309 typedef GM INHERITED; |
309 }; | 310 }; |
310 | 311 |
311 DEF_GM( return SkNEW(DCShaderGM); ) | 312 DEF_GM( return SkNEW(DCShaderGM); ) |
312 } | 313 } |
313 #endif | 314 #endif |
OLD | NEW |