Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: src/core/SkLocalMatrixShader.cpp

Issue 2175563003: Bundle SkShader::asFragmentProcessor arguments in a struct (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix indentation to be less arbitrary Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkLocalMatrixShader.h ('k') | src/core/SkNormalSource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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( 15 sk_sp<GrFragmentProcessor> SkLocalMatrixShader::asFragmentProcessor(const AsFPAr gs& args) const {
16 GrContext* context, const SkMatrix& view M,
17 const SkMatrix* localMatrix, SkFilterQua lity fq,
18 SkSourceGammaTreatment gammaTreatment) c onst {
19 SkMatrix tmp = this->getLocalMatrix(); 16 SkMatrix tmp = this->getLocalMatrix();
20 if (localMatrix) { 17 if (args.fLocalMatrix) {
21 tmp.preConcat(*localMatrix); 18 tmp.preConcat(*args.fLocalMatrix);
22 } 19 }
23 return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, gammaTrea tment); 20 return fProxyShader->asFragmentProcessor(AsFPArgs(
21 args.fContext, args.fViewMatrix, &tmp, args.fFilterQuality, args.fGammaT reatment));
24 } 22 }
25 #endif 23 #endif
26 24
27 sk_sp<SkFlattenable> SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) { 25 sk_sp<SkFlattenable> SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) {
28 SkMatrix lm; 26 SkMatrix lm;
29 buffer.readMatrix(&lm); 27 buffer.readMatrix(&lm);
30 auto baseShader(buffer.readShader()); 28 auto baseShader(buffer.readShader());
31 if (!baseShader) { 29 if (!baseShader) {
32 return nullptr; 30 return nullptr;
33 } 31 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 SkMatrix otherLocalMatrix; 73 SkMatrix otherLocalMatrix;
76 SkAutoTUnref<SkShader> proxy(this->refAsALocalMatrixShader(&otherLocalMatrix )); 74 SkAutoTUnref<SkShader> proxy(this->refAsALocalMatrixShader(&otherLocalMatrix ));
77 if (proxy) { 75 if (proxy) {
78 otherLocalMatrix.preConcat(localMatrix); 76 otherLocalMatrix.preConcat(localMatrix);
79 lm = &otherLocalMatrix; 77 lm = &otherLocalMatrix;
80 baseShader = proxy.get(); 78 baseShader = proxy.get();
81 } 79 }
82 80
83 return sk_make_sp<SkLocalMatrixShader>(baseShader, *lm); 81 return sk_make_sp<SkLocalMatrixShader>(baseShader, *lm);
84 } 82 }
OLDNEW
« no previous file with comments | « src/core/SkLocalMatrixShader.h ('k') | src/core/SkNormalSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698