| 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 21 matching lines...) Expand all Loading... |
| 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 const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 39 const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
| 40 const SkMatrix& viewM, | 40 const SkMatrix& viewM, |
| 41 const SkMatrix* localMatrix, | 41 const SkMatrix* localMatrix, |
| 42 SkFilterQuality) const overri
de; | 42 SkFilterQuality, |
| 43 GrRenderTarget* dst) const ov
erride; |
| 43 | 44 |
| 44 #ifndef SK_IGNORE_TO_STRING | 45 #ifndef SK_IGNORE_TO_STRING |
| 45 void toString(SkString* str) const override { | 46 void toString(SkString* str) const override { |
| 46 str->appendf("DCShader: ()"); | 47 str->appendf("DCShader: ()"); |
| 47 } | 48 } |
| 48 #endif | 49 #endif |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 const SkMatrix fDeviceMatrix; | 52 const SkMatrix fDeviceMatrix; |
| 52 }; | 53 }; |
| (...skipping 41 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 GrRenderTarget* dst) co
nst { |
| 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 |