| 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 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 DCShader(const SkMatrix& matrix) : fDeviceMatrix(matrix) {} | 28 DCShader(const SkMatrix& matrix) : fDeviceMatrix(matrix) {} |
| 29 | 29 |
| 30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader); | 30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DCShader); |
| 31 | 31 |
| 32 void flatten(SkWriteBuffer& buf) const override { | 32 void flatten(SkWriteBuffer& buf) const override { |
| 33 buf.writeMatrix(fDeviceMatrix); | 33 buf.writeMatrix(fDeviceMatrix); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMatrix& v
iewM, | 36 bool asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMatrix& v
iewM, |
| 37 const SkMatrix* localMatrix, GrColor* color, | 37 const SkMatrix* localMatrix, GrColor* color, GrShad
erDataManager*, |
| 38 GrFragmentProcessor** fp) const override; | 38 GrFragmentProcessor** fp) const override; |
| 39 | 39 |
| 40 #ifndef SK_IGNORE_TO_STRING | 40 #ifndef SK_IGNORE_TO_STRING |
| 41 void toString(SkString* str) const override { | 41 void toString(SkString* str) const override { |
| 42 str->appendf("DCShader: ()"); | 42 str->appendf("DCShader: ()"); |
| 43 } | 43 } |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 const SkMatrix fDeviceMatrix; | 47 const SkMatrix fDeviceMatrix; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 GrFragmentProcessor** fp) const { | 104 GrShaderDataManager*, GrFragmentProcessor** f
p) const { |
| 105 *fp = SkNEW_ARGS(DCFP, (fDeviceMatrix)); | 105 *fp = SkNEW_ARGS(DCFP, (fDeviceMatrix)); |
| 106 *color = GrColorPackA4(paint.getAlpha()); | 106 *color = GrColorPackA4(paint.getAlpha()); |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 class DCShaderGM : public GM { | 110 class DCShaderGM : public GM { |
| 111 public: | 111 public: |
| 112 DCShaderGM() { | 112 DCShaderGM() { |
| 113 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); | 113 this->setBGColor(sk_tool_utils::color_to_565(0xFFAABBCC)); |
| 114 } | 114 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 SkTArray<Prim*> fPrims; | 306 SkTArray<Prim*> fPrims; |
| 307 | 307 |
| 308 typedef GM INHERITED; | 308 typedef GM INHERITED; |
| 309 }; | 309 }; |
| 310 | 310 |
| 311 DEF_GM( return SkNEW(DCShaderGM); ) | 311 DEF_GM( return SkNEW(DCShaderGM); ) |
| 312 } | 312 } |
| 313 #endif | 313 #endif |
| OLD | NEW |