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

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

Issue 13222004: Trim the copy of the dst made for dst-reading effects using the clip and dev-bounds of draw. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "effects/GrCircleEdgeEffect.h" 10 #include "effects/GrCircleEdgeEffect.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 innerRadius = SkMaxScalar(0, radius - halfWidth); 129 innerRadius = SkMaxScalar(0, radius - halfWidth);
130 } 130 }
131 } 131 }
132 132
133 for (int i = 0; i < 4; ++i) { 133 for (int i = 0; i < 4; ++i) {
134 verts[i].fCenter = center; 134 verts[i].fCenter = center;
135 verts[i].fOuterRadius = outerRadius + 0.5f; 135 verts[i].fOuterRadius = outerRadius + 0.5f;
136 verts[i].fInnerRadius = innerRadius - 0.5f; 136 verts[i].fInnerRadius = innerRadius - 0.5f;
137 } 137 }
138 138
139 SkScalar L = -outerRadius;
140 SkScalar R = +outerRadius;
141 SkScalar T = -outerRadius;
142 SkScalar B = +outerRadius;
143
144 // We've extended the outer radius out half a pixel to antialias. 139 // We've extended the outer radius out half a pixel to antialias.
145 // Expand the drawn rect here so all the pixels will be captured. 140 // Expand the drawn rect here so all the pixels will be captured.
146 L += center.fX - SK_ScalarHalf; 141 SkRect bounds = SkRect::MakeLTRB(
147 R += center.fX + SK_ScalarHalf; 142 center.fX - outerRadius - SK_ScalarHalf,
148 T += center.fY - SK_ScalarHalf; 143 center.fY - outerRadius - SK_ScalarHalf,
149 B += center.fY + SK_ScalarHalf; 144 center.fX + outerRadius + SK_ScalarHalf,
145 center.fY + outerRadius + SK_ScalarHalf
146 );
150 147
151 verts[0].fPos = SkPoint::Make(L, T); 148 verts[0].fPos = SkPoint::Make(bounds.fLeft, bounds.fTop);
152 verts[1].fPos = SkPoint::Make(R, T); 149 verts[1].fPos = SkPoint::Make(bounds.fRight, bounds.fTop);
153 verts[2].fPos = SkPoint::Make(L, B); 150 verts[2].fPos = SkPoint::Make(bounds.fLeft, bounds.fBottom);
154 verts[3].fPos = SkPoint::Make(R, B); 151 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fBottom);
155 152
156 target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, 4); 153 target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, 4, &bounds);
157 } 154 }
158 155
159 void GrOvalRenderer::drawEllipse(GrDrawTarget* target, 156 void GrOvalRenderer::drawEllipse(GrDrawTarget* target,
160 const GrPaint& paint, 157 const GrPaint& paint,
161 const GrRect& ellipse, 158 const GrRect& ellipse,
162 const SkStrokeRec& stroke) 159 const SkStrokeRec& stroke)
163 { 160 {
164 GrDrawState* drawState = target->drawState(); 161 GrDrawState* drawState = target->drawState();
165 #ifdef SK_DEBUG 162 #ifdef SK_DEBUG
166 { 163 {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 T += center.fY - SK_ScalarHalf; 265 T += center.fY - SK_ScalarHalf;
269 B += center.fY + SK_ScalarHalf; 266 B += center.fY + SK_ScalarHalf;
270 267
271 verts[0].fPos = SkPoint::Make(L, T); 268 verts[0].fPos = SkPoint::Make(L, T);
272 verts[1].fPos = SkPoint::Make(R, T); 269 verts[1].fPos = SkPoint::Make(R, T);
273 verts[2].fPos = SkPoint::Make(L, B); 270 verts[2].fPos = SkPoint::Make(L, B);
274 verts[3].fPos = SkPoint::Make(R, B); 271 verts[3].fPos = SkPoint::Make(R, B);
275 272
276 target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, 4); 273 target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, 4);
277 } 274 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698