| 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 | 10 #if SK_SUPPORT_GPU |
| 11 #include "GrFragmentProcessor.h" | 11 #include "GrFragmentProcessor.h" |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #if SK_SUPPORT_GPU | 14 #if SK_SUPPORT_GPU |
| 15 sk_sp<GrFragmentProcessor> SkLocalMatrixShader::asFragmentProcessor(const AsFPAr
gs& args) const { | 15 sk_sp<GrFragmentProcessor> SkLocalMatrixShader::asFragmentProcessor(const AsFPAr
gs& args) const { |
| 16 SkMatrix tmp = this->getLocalMatrix(); | 16 SkMatrix tmp = this->getLocalMatrix(); |
| 17 if (args.fLocalMatrix) { | 17 if (args.fLocalMatrix) { |
| 18 tmp.preConcat(*args.fLocalMatrix); | 18 tmp.preConcat(*args.fLocalMatrix); |
| 19 } | 19 } |
| 20 return fProxyShader->asFragmentProcessor(AsFPArgs( | 20 return fProxyShader->asFragmentProcessor(AsFPArgs( |
| 21 args.fContext, args.fViewMatrix, &tmp, args.fFilterQuality, args.fGammaT
reatment)); | 21 args.fContext, args.fViewMatrix, &tmp, args.fFilterQuality, args.fDstCol
orSpace, |
| 22 args.fGammaTreatment)); |
| 22 } | 23 } |
| 23 #endif | 24 #endif |
| 24 | 25 |
| 25 sk_sp<SkFlattenable> SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) { | 26 sk_sp<SkFlattenable> SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) { |
| 26 SkMatrix lm; | 27 SkMatrix lm; |
| 27 buffer.readMatrix(&lm); | 28 buffer.readMatrix(&lm); |
| 28 auto baseShader(buffer.readShader()); | 29 auto baseShader(buffer.readShader()); |
| 29 if (!baseShader) { | 30 if (!baseShader) { |
| 30 return nullptr; | 31 return nullptr; |
| 31 } | 32 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 SkMatrix otherLocalMatrix; | 74 SkMatrix otherLocalMatrix; |
| 74 SkAutoTUnref<SkShader> proxy(this->refAsALocalMatrixShader(&otherLocalMatrix
)); | 75 SkAutoTUnref<SkShader> proxy(this->refAsALocalMatrixShader(&otherLocalMatrix
)); |
| 75 if (proxy) { | 76 if (proxy) { |
| 76 otherLocalMatrix.preConcat(localMatrix); | 77 otherLocalMatrix.preConcat(localMatrix); |
| 77 lm = &otherLocalMatrix; | 78 lm = &otherLocalMatrix; |
| 78 baseShader = proxy.get(); | 79 baseShader = proxy.get(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 return sk_make_sp<SkLocalMatrixShader>(baseShader, *lm); | 82 return sk_make_sp<SkLocalMatrixShader>(baseShader, *lm); |
| 82 } | 83 } |
| OLD | NEW |