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

Side by Side Diff: src/gpu/GrAARectRenderer.h

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: tiny fix Created 6 years, 1 month 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/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.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 2012 Google Inc. 2 * Copyright 2012 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 GrAARectRenderer_DEFINED 8 #ifndef GrAARectRenderer_DEFINED
9 #define GrAARectRenderer_DEFINED 9 #define GrAARectRenderer_DEFINED
10 10
11 #include "SkMatrix.h" 11 #include "SkMatrix.h"
12 #include "SkRect.h" 12 #include "SkRect.h"
13 #include "SkRefCnt.h" 13 #include "SkRefCnt.h"
14 #include "SkStrokeRec.h" 14 #include "SkStrokeRec.h"
15 15
16 class GrGpu; 16 class GrGpu;
17 class GrDrawState;
17 class GrDrawTarget; 18 class GrDrawTarget;
18 class GrIndexBuffer; 19 class GrIndexBuffer;
19 20
20 /* 21 /*
21 * This class wraps helper functions that draw AA rects (filled & stroked) 22 * This class wraps helper functions that draw AA rects (filled & stroked)
22 */ 23 */
23 class GrAARectRenderer : public SkRefCnt { 24 class GrAARectRenderer : public SkRefCnt {
24 public: 25 public:
25 SK_DECLARE_INST_COUNT(GrAARectRenderer) 26 SK_DECLARE_INST_COUNT(GrAARectRenderer)
26 27
27 GrAARectRenderer(GrGpu* gpu) 28 GrAARectRenderer(GrGpu* gpu)
28 : fGpu(gpu) 29 : fGpu(gpu)
29 , fAAFillRectIndexBuffer(NULL) 30 , fAAFillRectIndexBuffer(NULL)
30 , fAAMiterStrokeRectIndexBuffer(NULL) 31 , fAAMiterStrokeRectIndexBuffer(NULL)
31 , fAABevelStrokeRectIndexBuffer(NULL) { 32 , fAABevelStrokeRectIndexBuffer(NULL) {
32 } 33 }
33 34
34 void reset(); 35 void reset();
35 36
36 ~GrAARectRenderer() { 37 ~GrAARectRenderer() {
37 this->reset(); 38 this->reset();
38 } 39 }
39 40
40 // TODO: potentialy fuse the fill & stroke methods and differentiate 41 // TODO: potentialy fuse the fill & stroke methods and differentiate
41 // between them by passing in stroke (==NULL means fill). 42 // between them by passing in stroke (==NULL means fill).
42 43
43 void fillAARect(GrDrawTarget* target, 44 void fillAARect(GrDrawTarget* target,
45 GrDrawState* ds,
44 const SkRect& rect, 46 const SkRect& rect,
45 const SkMatrix& combinedMatrix, 47 const SkMatrix& combinedMatrix,
46 const SkRect& devRect) { 48 const SkRect& devRect) {
47 this->geometryFillAARect(target, rect, combinedMatrix, devRect); 49 this->geometryFillAARect(target, ds, rect, combinedMatrix, devRect);
48 } 50 }
49 51
50 void strokeAARect(GrDrawTarget* target, 52 void strokeAARect(GrDrawTarget*,
53 GrDrawState*,
51 const SkRect& rect, 54 const SkRect& rect,
52 const SkMatrix& combinedMatrix, 55 const SkMatrix& combinedMatrix,
53 const SkRect& devRect, 56 const SkRect& devRect,
54 const SkStrokeRec& stroke); 57 const SkStrokeRec& stroke);
55 58
56 // First rect is outer; second rect is inner 59 // First rect is outer; second rect is inner
57 void fillAANestedRects(GrDrawTarget* target, 60 void fillAANestedRects(GrDrawTarget*,
61 GrDrawState*,
58 const SkRect rects[2], 62 const SkRect rects[2],
59 const SkMatrix& combinedMatrix); 63 const SkMatrix& combinedMatrix);
60 64
61 private: 65 private:
62 GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke); 66 GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke);
63 67
64 void geometryFillAARect(GrDrawTarget* target, 68 void geometryFillAARect(GrDrawTarget*,
69 GrDrawState*,
65 const SkRect& rect, 70 const SkRect& rect,
66 const SkMatrix& combinedMatrix, 71 const SkMatrix& combinedMatrix,
67 const SkRect& devRect); 72 const SkRect& devRect);
68 73
69 void geometryStrokeAARect(GrDrawTarget* target, 74 void geometryStrokeAARect(GrDrawTarget*,
75 GrDrawState*,
70 const SkRect& devOutside, 76 const SkRect& devOutside,
71 const SkRect& devOutsideAssist, 77 const SkRect& devOutsideAssist,
72 const SkRect& devInside, 78 const SkRect& devInside,
73 bool miterStroke); 79 bool miterStroke);
74 80
75 GrGpu* fGpu; 81 GrGpu* fGpu;
76 GrIndexBuffer* fAAFillRectIndexBuffer; 82 GrIndexBuffer* fAAFillRectIndexBuffer;
77 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer; 83 GrIndexBuffer* fAAMiterStrokeRectIndexBuffer;
78 GrIndexBuffer* fAABevelStrokeRectIndexBuffer; 84 GrIndexBuffer* fAABevelStrokeRectIndexBuffer;
79 85
80 typedef SkRefCnt INHERITED; 86 typedef SkRefCnt INHERITED;
81 }; 87 };
82 88
83 #endif // GrAARectRenderer_DEFINED 89 #endif // GrAARectRenderer_DEFINED
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698