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

Side by Side Diff: gm/gradients_2pt_conical.cpp

Issue 311373003: Fix Assert for gpu ConicalTwoPointGradient edgecase to be correct bounds. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix assert to check if zero start rad 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
« no previous file with comments | « no previous file | src/effects/gradients/SkTwoPointConicalGradient_gpu.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 #include "gm.h" 8 #include "gm.h"
9 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 10
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 7); 187 SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 7);
188 SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3); 188 SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
189 center1.set(SkScalarAve(pts[0].fX, pts[1].fX), 189 center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
190 SkScalarAve(pts[0].fY, pts[1].fY)); 190 SkScalarAve(pts[0].fY, pts[1].fY));
191 center0.set(center1.fX, center1.fY + radius1); 191 center0.set(center1.fX, center1.fY + radius1);
192 return SkGradientShader::CreateTwoPointConical(center0, radius0, 192 return SkGradientShader::CreateTwoPointConical(center0, radius0,
193 center1, radius1, 193 center1, radius1,
194 data.fColors, data.fPos, 194 data.fColors, data.fPos,
195 data.fCount, tm, 0, &localMat rix); 195 data.fCount, tm, 0, &localMat rix);
196 } 196 }
197
197 static SkShader* Make2ConicalZeroRadEdgeX(const SkPoint pts[2], const GradData& data, 198 static SkShader* Make2ConicalZeroRadEdgeX(const SkPoint pts[2], const GradData& data,
198 SkShader::TileMode tm, const SkMatrix& localMatrix) { 199 SkShader::TileMode tm, const SkMatrix& localMatrix) {
199 SkPoint center0, center1; 200 SkPoint center0, center1;
200 SkScalar radius0 = 0.f; 201 SkScalar radius0 = 0.f;
201 SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3); 202 SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
202 center1.set(SkScalarAve(pts[0].fX, pts[1].fX), 203 center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
203 SkScalarAve(pts[0].fY, pts[1].fY)); 204 SkScalarAve(pts[0].fY, pts[1].fY));
204 center0.set(center1.fX + radius1, center1.fY); 205 center0.set(center1.fX + radius1, center1.fY);
205 return SkGradientShader::CreateTwoPointConical(center0, radius0, 206 return SkGradientShader::CreateTwoPointConical(center0, radius0,
206 center1, radius1, 207 center1, radius1,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 372
372 static GM* MyFactory1(void*) { return new ConicalGradientsGM(kInside_GradCaseTyp e); } 373 static GM* MyFactory1(void*) { return new ConicalGradientsGM(kInside_GradCaseTyp e); }
373 static GMRegistry reg1(MyFactory1); 374 static GMRegistry reg1(MyFactory1);
374 375
375 static GM* MyFactory2(void*) { return new ConicalGradientsGM(kOutside_GradCaseTy pe); } 376 static GM* MyFactory2(void*) { return new ConicalGradientsGM(kOutside_GradCaseTy pe); }
376 static GMRegistry reg2(MyFactory2); 377 static GMRegistry reg2(MyFactory2);
377 378
378 static GM* MyFactory3(void*) { return new ConicalGradientsGM(kEdge_GradCaseType) ; } 379 static GM* MyFactory3(void*) { return new ConicalGradientsGM(kEdge_GradCaseType) ; }
379 static GMRegistry reg3(MyFactory3); 380 static GMRegistry reg3(MyFactory3);
380 } 381 }
OLDNEW
« no previous file with comments | « no previous file | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698