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

Side by Side Diff: src/gpu/GrSoftwarePathRenderer.cpp

Issue 2126083002: Remove fColor from PathRenderer DrawPathArgs struct (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unnecessary GrPaint::setColor calls 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/gpu/GrSoftwarePathRenderer.h ('k') | src/gpu/batches/GrAAConvexPathRenderer.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 #include "GrSoftwarePathRenderer.h" 8 #include "GrSoftwarePathRenderer.h"
9 #include "GrAuditTrail.h" 9 #include "GrAuditTrail.h"
10 #include "GrClip.h" 10 #include "GrClip.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return false; 55 return false;
56 } 56 }
57 return true; 57 return true;
58 } 58 }
59 59
60 //////////////////////////////////////////////////////////////////////////////// 60 ////////////////////////////////////////////////////////////////////////////////
61 61
62 } 62 }
63 63
64 void GrSoftwarePathRenderer::DrawNonAARect(GrDrawContext* drawContext, 64 void GrSoftwarePathRenderer::DrawNonAARect(GrDrawContext* drawContext,
65 const GrPaint* paint, 65 const GrPaint& paint,
66 const GrUserStencilSettings* userSten cilSettings, 66 const GrUserStencilSettings* userSten cilSettings,
67 const GrClip& clip, 67 const GrClip& clip,
68 GrColor color,
69 const SkMatrix& viewMatrix, 68 const SkMatrix& viewMatrix,
70 const SkRect& rect, 69 const SkRect& rect,
71 const SkMatrix& localMatrix) { 70 const SkMatrix& localMatrix) {
72 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, v iewMatrix, rect, 71 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.ge tColor(),
72 viewMatr ix, rect,
73 nullptr, &localMatrix)); 73 nullptr, &localMatrix));
74 74
75 GrPipelineBuilder pipelineBuilder(*paint, drawContext->mustUseHWAA(*paint)); 75 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
76 pipelineBuilder.setUserStencil(userStencilSettings); 76 pipelineBuilder.setUserStencil(userStencilSettings);
77 77
78 drawContext->drawBatch(pipelineBuilder, clip, batch); 78 drawContext->drawBatch(pipelineBuilder, clip, batch);
79 } 79 }
80 80
81 void GrSoftwarePathRenderer::DrawAroundInvPath(GrDrawContext* drawContext, 81 void GrSoftwarePathRenderer::DrawAroundInvPath(GrDrawContext* drawContext,
82 const GrPaint* paint, 82 const GrPaint& paint,
83 const GrUserStencilSettings* user StencilSettings, 83 const GrUserStencilSettings* user StencilSettings,
84 const GrClip& clip, 84 const GrClip& clip,
85 GrColor color,
86 const SkMatrix& viewMatrix, 85 const SkMatrix& viewMatrix,
87 const SkIRect& devClipBounds, 86 const SkIRect& devClipBounds,
88 const SkIRect& devPathBounds) { 87 const SkIRect& devPathBounds) {
89 SkMatrix invert; 88 SkMatrix invert;
90 if (!viewMatrix.invert(&invert)) { 89 if (!viewMatrix.invert(&invert)) {
91 return; 90 return;
92 } 91 }
93 92
94 SkRect rect; 93 SkRect rect;
95 if (devClipBounds.fTop < devPathBounds.fTop) { 94 if (devClipBounds.fTop < devPathBounds.fTop) {
96 rect.iset(devClipBounds.fLeft, devClipBounds.fTop, 95 rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
97 devClipBounds.fRight, devPathBounds.fTop); 96 devClipBounds.fRight, devPathBounds.fTop);
98 DrawNonAARect(drawContext, paint, userStencilSettings, clip, color, 97 DrawNonAARect(drawContext, paint, userStencilSettings, clip,
99 SkMatrix::I(), rect, invert); 98 SkMatrix::I(), rect, invert);
100 } 99 }
101 if (devClipBounds.fLeft < devPathBounds.fLeft) { 100 if (devClipBounds.fLeft < devPathBounds.fLeft) {
102 rect.iset(devClipBounds.fLeft, devPathBounds.fTop, 101 rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
103 devPathBounds.fLeft, devPathBounds.fBottom); 102 devPathBounds.fLeft, devPathBounds.fBottom);
104 DrawNonAARect(drawContext, paint, userStencilSettings, clip, color, 103 DrawNonAARect(drawContext, paint, userStencilSettings, clip,
105 SkMatrix::I(), rect, invert); 104 SkMatrix::I(), rect, invert);
106 } 105 }
107 if (devClipBounds.fRight > devPathBounds.fRight) { 106 if (devClipBounds.fRight > devPathBounds.fRight) {
108 rect.iset(devPathBounds.fRight, devPathBounds.fTop, 107 rect.iset(devPathBounds.fRight, devPathBounds.fTop,
109 devClipBounds.fRight, devPathBounds.fBottom); 108 devClipBounds.fRight, devPathBounds.fBottom);
110 DrawNonAARect(drawContext, paint, userStencilSettings, clip, color, 109 DrawNonAARect(drawContext, paint, userStencilSettings, clip,
111 SkMatrix::I(), rect, invert); 110 SkMatrix::I(), rect, invert);
112 } 111 }
113 if (devClipBounds.fBottom > devPathBounds.fBottom) { 112 if (devClipBounds.fBottom > devPathBounds.fBottom) {
114 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom, 113 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
115 devClipBounds.fRight, devClipBounds.fBottom); 114 devClipBounds.fRight, devClipBounds.fBottom);
116 DrawNonAARect(drawContext, paint, userStencilSettings, clip, color, 115 DrawNonAARect(drawContext, paint, userStencilSettings, clip,
117 SkMatrix::I(), rect, invert); 116 SkMatrix::I(), rect, invert);
118 } 117 }
119 } 118 }
120 119
121 //////////////////////////////////////////////////////////////////////////////// 120 ////////////////////////////////////////////////////////////////////////////////
122 // return true on success; false on failure 121 // return true on success; false on failure
123 bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) { 122 bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
124 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), 123 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
125 "GrSoftwarePathRenderer::onDrawPath"); 124 "GrSoftwarePathRenderer::onDrawPath");
126 if (!fTexProvider) { 125 if (!fTexProvider) {
127 return false; 126 return false;
128 } 127 }
129 128
130 // We really need to know if the shape will be inverse filled or not 129 // We really need to know if the shape will be inverse filled or not
131 bool inverseFilled = false; 130 bool inverseFilled = false;
132 SkTLazy<GrShape> tmpShape; 131 SkTLazy<GrShape> tmpShape;
133 SkASSERT(!args.fShape->style().applies()) 132 SkASSERT(!args.fShape->style().applies())
134 inverseFilled = args.fShape->inverseFilled(); 133 inverseFilled = args.fShape->inverseFilled();
135 134
136 SkIRect devShapeBounds, devClipBounds; 135 SkIRect devShapeBounds, devClipBounds;
137 if (!get_shape_and_clip_bounds(args.fDrawContext->width(), args.fDrawContext ->height(), 136 if (!get_shape_and_clip_bounds(args.fDrawContext->width(), args.fDrawContext ->height(),
138 *args.fClip, *args.fShape, 137 *args.fClip, *args.fShape,
139 *args.fViewMatrix, &devShapeBounds, &devClipB ounds)) { 138 *args.fViewMatrix, &devShapeBounds, &devClipB ounds)) {
140 if (inverseFilled) { 139 if (inverseFilled) {
141 DrawAroundInvPath(args.fDrawContext, args.fPaint, args.fUserStencilS ettings, 140 DrawAroundInvPath(args.fDrawContext, *args.fPaint, args.fUserStencil Settings,
142 *args.fClip, args.fColor, 141 *args.fClip,
143 *args.fViewMatrix, devClipBounds, devShapeBounds); 142 *args.fViewMatrix, devClipBounds, devShapeBounds);
144 143
145 } 144 }
146 return true; 145 return true;
147 } 146 }
148 147
149 SkAutoTUnref<GrTexture> texture( 148 SkAutoTUnref<GrTexture> texture(
150 GrSWMaskHelper::DrawShapeMaskToTexture(fTexProvider, *args.fShape, d evShapeBounds, 149 GrSWMaskHelper::DrawShapeMaskToTexture(fTexProvider, *args.fShape, d evShapeBounds,
151 args.fAntiAlias, args.fViewMa trix)); 150 args.fAntiAlias, args.fViewMa trix));
152 if (nullptr == texture) { 151 if (nullptr == texture) {
153 return false; 152 return false;
154 } 153 }
155 154
156 GrSWMaskHelper::DrawToTargetWithShapeMask(texture, args.fDrawContext, args.f Paint, 155 GrSWMaskHelper::DrawToTargetWithShapeMask(texture, args.fDrawContext, *args. fPaint,
157 args.fUserStencilSettings, 156 args.fUserStencilSettings,
158 *args.fClip, args.fColor, *args.fV iewMatrix, 157 *args.fClip, *args.fViewMatrix,
159 devShapeBounds); 158 devShapeBounds);
160 159
161 if (inverseFilled) { 160 if (inverseFilled) {
162 DrawAroundInvPath(args.fDrawContext, args.fPaint, args.fUserStencilSetti ngs, 161 DrawAroundInvPath(args.fDrawContext, *args.fPaint, args.fUserStencilSett ings,
163 *args.fClip, args.fColor, 162 *args.fClip,
164 *args.fViewMatrix, devClipBounds, devShapeBounds); 163 *args.fViewMatrix, devClipBounds, devShapeBounds);
165 } 164 }
166 165
167 return true; 166 return true;
168 } 167 }
OLDNEW
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.h ('k') | src/gpu/batches/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698