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

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

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/SkModeColorFilter.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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkLocalMatrixShader.h ('k') | src/core/SkModeColorFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698