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

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

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/SkLightingShader.cpp ('k') | src/core/SkLocalMatrixShader.cpp » ('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 #ifndef SkLocalMatrixShader_DEFINED 8 #ifndef SkLocalMatrixShader_DEFINED
9 #define SkLocalMatrixShader_DEFINED 9 #define SkLocalMatrixShader_DEFINED
10 10
11 #include "SkShader.h" 11 #include "SkShader.h"
12 #include "SkReadBuffer.h" 12 #include "SkReadBuffer.h"
13 #include "SkWriteBuffer.h" 13 #include "SkWriteBuffer.h"
14 14
15 class GrFragmentProcessor;
16
15 class SkLocalMatrixShader : public SkShader { 17 class SkLocalMatrixShader : public SkShader {
16 public: 18 public:
17 SkLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix) 19 SkLocalMatrixShader(SkShader* proxy, const SkMatrix& localMatrix)
18 : INHERITED(&localMatrix) 20 : INHERITED(&localMatrix)
19 , fProxyShader(SkRef(proxy)) 21 , fProxyShader(SkRef(proxy))
20 {} 22 {}
21 23
22 GradientType asAGradient(GradientInfo* info) const override { 24 GradientType asAGradient(GradientInfo* info) const override {
23 return fProxyShader->asAGradient(info); 25 return fProxyShader->asAGradient(info);
24 } 26 }
25 27
26 #if SK_SUPPORT_GPU 28 #if SK_SUPPORT_GPU
27 const GrFragmentProcessor* asFragmentProcessor( 29 sk_sp<GrFragmentProcessor> asFragmentProcessor(
28 GrContext* context, const SkMatrix& viewM, 30 GrContext* context, const SkMatrix& viewM,
29 const SkMatrix* localMatrix, SkFilte rQuality fq, 31 const SkMatrix* localMatrix, SkFilte rQuality fq,
30 SkSourceGammaTreatment gammaTreatmen t) const override { 32 SkSourceGammaTreatment gammaTreatmen t) const override;
31 SkMatrix tmp = this->getLocalMatrix();
32 if (localMatrix) {
33 tmp.preConcat(*localMatrix);
34 }
35 return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, gamma Treatment);
36 }
37 #endif 33 #endif
38 34
39 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { 35 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override {
40 if (localMatrix) { 36 if (localMatrix) {
41 *localMatrix = this->getLocalMatrix(); 37 *localMatrix = this->getLocalMatrix();
42 } 38 }
43 return SkRef(fProxyShader.get()); 39 return SkRef(fProxyShader.get());
44 } 40 }
45 41
46 SK_TO_STRING_OVERRIDE() 42 SK_TO_STRING_OVERRIDE()
(...skipping 11 matching lines...) Expand all
58 return fProxyShader->isABitmap(bitmap, matrix, mode); 54 return fProxyShader->isABitmap(bitmap, matrix, mode);
59 } 55 }
60 56
61 private: 57 private:
62 SkAutoTUnref<SkShader> fProxyShader; 58 SkAutoTUnref<SkShader> fProxyShader;
63 59
64 typedef SkShader INHERITED; 60 typedef SkShader INHERITED;
65 }; 61 };
66 62
67 #endif 63 #endif
OLDNEW
« no previous file with comments | « src/core/SkLightingShader.cpp ('k') | src/core/SkLocalMatrixShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698