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

Side by Side Diff: tests/TessellatingPathRendererTests.cpp

Issue 2259493002: Fix assert caused by floating point error in tessellating path renderer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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/GrTessellator.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 2015 Google Inc. 2 * Copyright 2015 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 "SkPath.h" 8 #include "SkPath.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 static SkPath create_path_15() { 225 static SkPath create_path_15() {
226 SkPath path; 226 SkPath path;
227 path.moveTo( 0.0f, 0.0f); 227 path.moveTo( 0.0f, 0.0f);
228 path.lineTo(10000.0f, 0.0f); 228 path.lineTo(10000.0f, 0.0f);
229 path.lineTo( 0.0f, -1.0f); 229 path.lineTo( 0.0f, -1.0f);
230 path.lineTo(10000.0f, 0.000001f); 230 path.lineTo(10000.0f, 0.000001f);
231 path.lineTo( 0.0f, -30.0f); 231 path.lineTo( 0.0f, -30.0f);
232 return path; 232 return path;
233 } 233 }
234 234
235 // Reduction of Nebraska-StateSeal.svg. Floating point error causes the
236 // same edge to be added to more than one poly on the same side.
237 static SkPath create_path_16() {
238 SkPath path;
239 path.moveTo(170.8199920654296875, 491.86700439453125);
240 path.lineTo(173.7649993896484375, 489.7340087890625);
241 path.lineTo(174.1450958251953125, 498.545989990234375);
242 path.lineTo( 171.998992919921875, 500.88201904296875);
243 path.moveTo(168.2922515869140625, 498.66265869140625);
244 path.lineTo(169.8589935302734375, 497.94500732421875);
245 path.lineTo( 172, 500.88299560546875);
246 path.moveTo( 169.555267333984375, 490.70111083984375);
247 path.lineTo(173.7649993896484375, 489.7340087890625);
248 path.lineTo( 170.82000732421875, 491.86700439453125);
249 return path;
250 }
251
235 static void test_path(GrDrawContext* drawContext, GrResourceProvider* rp, const SkPath& path) { 252 static void test_path(GrDrawContext* drawContext, GrResourceProvider* rp, const SkPath& path) {
236 GrTessellatingPathRenderer tess; 253 GrTessellatingPathRenderer tess;
237 254
238 GrPaint paint; 255 GrPaint paint;
239 paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); 256 paint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
240 257
241 GrNoClip noClip; 258 GrNoClip noClip;
242 GrStyle style(SkStrokeRec::kFill_InitStyle); 259 GrStyle style(SkStrokeRec::kFill_InitStyle);
243 GrPathRenderer::DrawPathArgs args; 260 GrPathRenderer::DrawPathArgs args;
244 args.fPaint = &paint; 261 args.fPaint = &paint;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 test_path(dc.get(), rp, create_path_6()); 294 test_path(dc.get(), rp, create_path_6());
278 test_path(dc.get(), rp, create_path_7()); 295 test_path(dc.get(), rp, create_path_7());
279 test_path(dc.get(), rp, create_path_8()); 296 test_path(dc.get(), rp, create_path_8());
280 test_path(dc.get(), rp, create_path_9()); 297 test_path(dc.get(), rp, create_path_9());
281 test_path(dc.get(), rp, create_path_10()); 298 test_path(dc.get(), rp, create_path_10());
282 test_path(dc.get(), rp, create_path_11()); 299 test_path(dc.get(), rp, create_path_11());
283 test_path(dc.get(), rp, create_path_12()); 300 test_path(dc.get(), rp, create_path_12());
284 test_path(dc.get(), rp, create_path_13()); 301 test_path(dc.get(), rp, create_path_13());
285 test_path(dc.get(), rp, create_path_14()); 302 test_path(dc.get(), rp, create_path_14());
286 test_path(dc.get(), rp, create_path_15()); 303 test_path(dc.get(), rp, create_path_15());
304 test_path(dc.get(), rp, create_path_16());
287 } 305 }
288 #endif 306 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTessellator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698