OLD | NEW |
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 #ifndef SkLocalMatrixShader_DEFINED | 8 #ifndef SkLocalMatrixShader_DEFINED |
9 #define SkLocalMatrixShader_DEFINED | 9 #define SkLocalMatrixShader_DEFINED |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, | 26 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, |
27 TileMode* mode) const override { | 27 TileMode* mode) const override { |
28 return fProxyShader->asABitmap(bitmap, matrix, mode); | 28 return fProxyShader->asABitmap(bitmap, matrix, mode); |
29 } | 29 } |
30 | 30 |
31 GradientType asAGradient(GradientInfo* info) const override { | 31 GradientType asAGradient(GradientInfo* info) const override { |
32 return fProxyShader->asAGradient(info); | 32 return fProxyShader->asAGradient(info); |
33 } | 33 } |
34 | 34 |
35 #if SK_SUPPORT_GPU | 35 #if SK_SUPPORT_GPU |
36 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, | 36 |
37 const SkMatrix* localMatrix, SkFilterQua
lity fq, | 37 virtual bool asFragmentProcessor(GrContext* context, const SkPaint& paint, |
38 GrProcessorDataManager* procDataManager)
const override { | 38 const SkMatrix& viewM, const SkMatrix* loca
lMatrix, |
| 39 GrColor* grColor, GrProcessorDataManager* p
rocDataManager, |
| 40 GrFragmentProcessor** fp) const override { |
39 SkMatrix tmp = this->getLocalMatrix(); | 41 SkMatrix tmp = this->getLocalMatrix(); |
40 if (localMatrix) { | 42 if (localMatrix) { |
41 tmp.preConcat(*localMatrix); | 43 tmp.preConcat(*localMatrix); |
42 } | 44 } |
43 return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, procD
ataManager); | 45 return fProxyShader->asFragmentProcessor(context, paint, viewM, &tmp, gr
Color, |
| 46 procDataManager, fp); |
44 } | 47 } |
| 48 |
| 49 #else |
| 50 |
| 51 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&
, |
| 52 const SkMatrix*, GrColor*, GrProcessorDataM
anager*, |
| 53 GrFragmentProcessor**) const override { |
| 54 SkDEBUGFAIL("Should not call in GPU-less build"); |
| 55 return false; |
| 56 } |
| 57 |
45 #endif | 58 #endif |
46 | 59 |
47 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { | 60 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { |
48 if (localMatrix) { | 61 if (localMatrix) { |
49 *localMatrix = this->getLocalMatrix(); | 62 *localMatrix = this->getLocalMatrix(); |
50 } | 63 } |
51 return SkRef(fProxyShader.get()); | 64 return SkRef(fProxyShader.get()); |
52 } | 65 } |
53 | 66 |
54 SK_TO_STRING_OVERRIDE() | 67 SK_TO_STRING_OVERRIDE() |
55 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) | 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) |
56 | 69 |
57 protected: | 70 protected: |
58 void flatten(SkWriteBuffer&) const override; | 71 void flatten(SkWriteBuffer&) const override; |
59 Context* onCreateContext(const ContextRec&, void*) const override; | 72 Context* onCreateContext(const ContextRec&, void*) const override; |
60 | 73 |
61 private: | 74 private: |
62 SkAutoTUnref<SkShader> fProxyShader; | 75 SkAutoTUnref<SkShader> fProxyShader; |
63 | 76 |
64 typedef SkShader INHERITED; | 77 typedef SkShader INHERITED; |
65 }; | 78 }; |
66 | 79 |
67 #endif | 80 #endif |
OLD | NEW |