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 #include "SkLocalMatrixShader.h" | 8 #include "SkLocalMatrixShader.h" |
9 | 9 |
| 10 #if SK_SUPPORT_GPU |
| 11 #include "GrFragmentProcessor.h" |
| 12 #endif |
| 13 |
| 14 #if SK_SUPPORT_GPU |
| 15 sk_sp<GrFragmentProcessor> SkLocalMatrixShader::asFragmentProcessor( |
| 16 GrContext* context, const SkMatrix& view
M, |
| 17 const SkMatrix* localMatrix, SkFilterQua
lity fq, |
| 18 SkSourceGammaTreatment gammaTreatment) c
onst { |
| 19 SkMatrix tmp = this->getLocalMatrix(); |
| 20 if (localMatrix) { |
| 21 tmp.preConcat(*localMatrix); |
| 22 } |
| 23 return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, gammaTrea
tment); |
| 24 } |
| 25 #endif |
| 26 |
10 sk_sp<SkFlattenable> SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) { | 27 sk_sp<SkFlattenable> SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) { |
11 SkMatrix lm; | 28 SkMatrix lm; |
12 buffer.readMatrix(&lm); | 29 buffer.readMatrix(&lm); |
13 auto baseShader(buffer.readShader()); | 30 auto baseShader(buffer.readShader()); |
14 if (!baseShader) { | 31 if (!baseShader) { |
15 return nullptr; | 32 return nullptr; |
16 } | 33 } |
17 return baseShader->makeWithLocalMatrix(lm); | 34 return baseShader->makeWithLocalMatrix(lm); |
18 } | 35 } |
19 | 36 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 SkMatrix otherLocalMatrix; | 75 SkMatrix otherLocalMatrix; |
59 SkAutoTUnref<SkShader> proxy(this->refAsALocalMatrixShader(&otherLocalMatrix
)); | 76 SkAutoTUnref<SkShader> proxy(this->refAsALocalMatrixShader(&otherLocalMatrix
)); |
60 if (proxy) { | 77 if (proxy) { |
61 otherLocalMatrix.preConcat(localMatrix); | 78 otherLocalMatrix.preConcat(localMatrix); |
62 lm = &otherLocalMatrix; | 79 lm = &otherLocalMatrix; |
63 baseShader = proxy.get(); | 80 baseShader = proxy.get(); |
64 } | 81 } |
65 | 82 |
66 return sk_make_sp<SkLocalMatrixShader>(baseShader, *lm); | 83 return sk_make_sp<SkLocalMatrixShader>(baseShader, *lm); |
67 } | 84 } |
OLD | NEW |