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

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

Issue 318923005: SkShader::asNewEffect Refactoring (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkColorShader refactor and fix Created 6 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
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
(...skipping 14 matching lines...) Expand all
25 25
26 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, 26 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix,
27 TileMode* mode) const SK_OVERRIDE { 27 TileMode* mode) const SK_OVERRIDE {
28 return fProxyShader->asABitmap(bitmap, matrix, mode); 28 return fProxyShader->asABitmap(bitmap, matrix, mode);
29 } 29 }
30 30
31 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE { 31 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE {
32 return fProxyShader->asAGradient(info); 32 return fProxyShader->asAGradient(info);
33 } 33 }
34 34
35 virtual GrEffectRef* asNewEffect(GrContext* ctx, const SkPaint& paint, 35 virtual bool asNewEffect(GrContext* context, const SkPaint& paint, const SkM atrix* localMatrix,
36 const SkMatrix* localMatrix) const SK_OVERR IDE { 36 GrColor* grColor, GrEffectRef** grEffect) const SK_ OVERRIDE {
37 SkMatrix tmp = fProxyLocalMatrix; 37 SkMatrix tmp = fProxyLocalMatrix;
38 if (localMatrix) { 38 if (localMatrix) {
39 tmp.preConcat(*localMatrix); 39 tmp.preConcat(*localMatrix);
40 } 40 }
41 return fProxyShader->asNewEffect(ctx, paint, &tmp); 41 return fProxyShader->asNewEffect(context, paint, &tmp, grColor, grEffect );
dandov 2014/06/06 21:50:44 return the value of the proxy shader call to asNew
42 } 42 }
43 43
44 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const SK_OV ERRIDE { 44 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const SK_OV ERRIDE {
45 if (localMatrix) { 45 if (localMatrix) {
46 *localMatrix = fProxyLocalMatrix; 46 *localMatrix = fProxyLocalMatrix;
47 } 47 }
48 return SkRef(fProxyShader.get()); 48 return SkRef(fProxyShader.get());
49 } 49 }
50 50
51 SK_TO_STRING_OVERRIDE() 51 SK_TO_STRING_OVERRIDE()
52 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) 52 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader)
53 53
54 protected: 54 protected:
55 SkLocalMatrixShader(SkReadBuffer&); 55 SkLocalMatrixShader(SkReadBuffer&);
56 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 56 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
57 virtual Context* onCreateContext(const ContextRec&, void*) const SK_OVERRIDE ; 57 virtual Context* onCreateContext(const ContextRec&, void*) const SK_OVERRIDE ;
58 58
59 private: 59 private:
60 SkAutoTUnref<SkShader> fProxyShader; 60 SkAutoTUnref<SkShader> fProxyShader;
61 SkMatrix fProxyLocalMatrix; 61 SkMatrix fProxyLocalMatrix;
62 62
63 typedef SkShader INHERITED; 63 typedef SkShader INHERITED;
64 }; 64 };
65 65
66 #endif 66 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698