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

Side by Side Diff: tests/DrawPathTest.cpp

Issue 1569403002: Fix radii calculation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update comment. Created 4 years, 11 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/core/SkScaleToSides.h ('k') | tests/ScaleToSidesTest.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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDashPathEffect.h" 10 #include "SkDashPathEffect.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 SkPaint paint; 306 SkPaint paint;
307 paint.setStyle(SkPaint::kStroke_Style); 307 paint.setStyle(SkPaint::kStroke_Style);
308 paint.setPathEffect(dash); 308 paint.setPathEffect(dash);
309 309
310 SkPath filteredPath; 310 SkPath filteredPath;
311 SkStrokeRec rec(paint); 311 SkStrokeRec rec(paint);
312 REPORTER_ASSERT(reporter, !dash->filterPath(&filteredPath, path, &rec, nullp tr)); 312 REPORTER_ASSERT(reporter, !dash->filterPath(&filteredPath, path, &rec, nullp tr));
313 REPORTER_ASSERT(reporter, filteredPath.isEmpty()); 313 REPORTER_ASSERT(reporter, filteredPath.isEmpty());
314 } 314 }
315 315
316 // http://crbug.com/472147
317 // This is a simplified version from the bug. RRect radii not properly scaled.
318 static void test_crbug_472147_simple(skiatest::Reporter* reporter) {
319 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1000, 1000));
320 SkCanvas* canvas = surface->getCanvas();
321 SkPaint p;
322 SkRect r = SkRect::MakeLTRB(-246.0f, 33.0f, 848.0f, 33554464.0f);
323 SkVector radii[4] = {
324 { 13.0f, 8.0f }, { 170.0f, 2.0 }, { 256.0f, 33554430.0f }, { 120.0f, 5.0 f }
325 };
326 SkRRect rr;
327 rr.setRectRadii(r, radii);
328 canvas->drawRRect(rr, p);
329 }
330
331 // http://crbug.com/472147
332 // RRect radii not properly scaled.
333 static void test_crbug_472147_actual(skiatest::Reporter* reporter) {
334 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1000, 1000));
335 SkCanvas* canvas = surface->getCanvas();
336 SkPaint p;
337 SkRect r = SkRect::MakeLTRB(-246.0f, 33.0f, 848.0f, 33554464.0f);
338 SkVector radii[4] = {
339 { 13.0f, 8.0f }, { 170.0f, 2.0 }, { 256.0f, 33554430.0f }, { 120.0f, 5.0 f }
340 };
341 SkRRect rr;
342 rr.setRectRadii(r, radii);
343 canvas->clipRRect(rr, SkRegion::kIntersect_Op, false);
344
345 SkRect r2 = SkRect::MakeLTRB(0, 33, 1102, 33554464);
346 canvas->drawRect(r2, p);
347 }
348
316 DEF_TEST(DrawPath, reporter) { 349 DEF_TEST(DrawPath, reporter) {
317 test_giantaa(); 350 test_giantaa();
318 test_bug533(); 351 test_bug533();
319 test_bigcubic(); 352 test_bigcubic();
320 test_crbug_124652(); 353 test_crbug_124652();
321 test_crbug_140642(); 354 test_crbug_140642();
322 test_crbug_140803(); 355 test_crbug_140803();
323 test_inversepathwithclip(); 356 test_inversepathwithclip();
324 // why? 357 // why?
325 if (false) test_crbug131181(); 358 if (false) test_crbug131181();
326 test_infinite_dash(reporter); 359 test_infinite_dash(reporter);
327 test_crbug_165432(reporter); 360 test_crbug_165432(reporter);
361 test_crbug_472147_simple(reporter);
362 test_crbug_472147_actual(reporter);
328 test_big_aa_rect(reporter); 363 test_big_aa_rect(reporter);
329 test_halfway(); 364 test_halfway();
330 } 365 }
OLDNEW
« no previous file with comments | « src/core/SkScaleToSides.h ('k') | tests/ScaleToSidesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698