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

Side by Side Diff: tests/PathTest.cpp

Issue 790733003: remove (dumb) canvas::NewRaster, and rename surface::NewRasterPMColor to N32Premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase after chrome patches have landed Created 6 years 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 | « tests/DrawPathTest.cpp ('k') | tests/RecordDrawTest.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 2011 Google Inc. 2 * Copyright 2011 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkParse.h" 10 #include "SkParse.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 static void make_path_crbug364224_simplified(SkPath* path) { 48 static void make_path_crbug364224_simplified(SkPath* path) {
49 path->moveTo(3.747501373f, 2.724499941f); 49 path->moveTo(3.747501373f, 2.724499941f);
50 path->cubicTo(3.648251295f, 0.5194999576f, 3.575501442f, 0.4999999702f, 3.49 7501373f, 0.4999999702f); 50 path->cubicTo(3.648251295f, 0.5194999576f, 3.575501442f, 0.4999999702f, 3.49 7501373f, 0.4999999702f);
51 path->close(); 51 path->close();
52 } 52 }
53 53
54 static void test_path_crbug364224() { 54 static void test_path_crbug364224() {
55 SkPath path; 55 SkPath path;
56 SkPaint paint; 56 SkPaint paint;
57 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(84, 88)); 57 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(84, 88));
58 SkCanvas* canvas = surface->getCanvas(); 58 SkCanvas* canvas = surface->getCanvas();
59 59
60 make_path_crbug364224_simplified(&path); 60 make_path_crbug364224_simplified(&path);
61 canvas->drawPath(path, paint); 61 canvas->drawPath(path, paint);
62 62
63 make_path_crbug364224(&path); 63 make_path_crbug364224(&path);
64 canvas->drawPath(path, paint); 64 canvas->drawPath(path, paint);
65 } 65 }
66 66
67 /** 67 /**
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // This used to assert in the debug build, as the edges did not all line-up. 292 // This used to assert in the debug build, as the edges did not all line-up.
293 static void test_bad_cubic_crbug234190() { 293 static void test_bad_cubic_crbug234190() {
294 SkPath path; 294 SkPath path;
295 path.moveTo(13.8509f, 3.16858f); 295 path.moveTo(13.8509f, 3.16858f);
296 path.cubicTo(-2.35893e+08f, -4.21044e+08f, 296 path.cubicTo(-2.35893e+08f, -4.21044e+08f,
297 -2.38991e+08f, -4.26573e+08f, 297 -2.38991e+08f, -4.26573e+08f,
298 -2.41016e+08f, -4.30188e+08f); 298 -2.41016e+08f, -4.30188e+08f);
299 299
300 SkPaint paint; 300 SkPaint paint;
301 paint.setAntiAlias(true); 301 paint.setAntiAlias(true);
302 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(84, 88)); 302 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(84, 88));
303 surface->getCanvas()->drawPath(path, paint); 303 surface->getCanvas()->drawPath(path, paint);
304 } 304 }
305 305
306 static void test_bad_cubic_crbug229478() { 306 static void test_bad_cubic_crbug229478() {
307 const SkPoint pts[] = { 307 const SkPoint pts[] = {
308 { 4595.91064f, -11596.9873f }, 308 { 4595.91064f, -11596.9873f },
309 { 4597.2168f, -11595.9414f }, 309 { 4597.2168f, -11595.9414f },
310 { 4598.52344f, -11594.8955f }, 310 { 4598.52344f, -11594.8955f },
311 { 4599.83008f, -11593.8496f }, 311 { 4599.83008f, -11593.8496f },
312 }; 312 };
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 411 }
412 412
413 // This used to assert in the SK_DEBUG build, as the clip step would fail with 413 // This used to assert in the SK_DEBUG build, as the clip step would fail with
414 // too-few interations in our cubic-line intersection code. That code now runs 414 // too-few interations in our cubic-line intersection code. That code now runs
415 // 24 interations (instead of 16). 415 // 24 interations (instead of 16).
416 static void test_crbug_170666() { 416 static void test_crbug_170666() {
417 SkPath path; 417 SkPath path;
418 SkPaint paint; 418 SkPaint paint;
419 paint.setAntiAlias(true); 419 paint.setAntiAlias(true);
420 420
421 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(1000, 1000)); 421 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1000, 1000));
422 422
423 build_path_simple_170666(path); 423 build_path_simple_170666(path);
424 surface->getCanvas()->drawPath(path, paint); 424 surface->getCanvas()->drawPath(path, paint);
425 425
426 build_path_170666(path); 426 build_path_170666(path);
427 surface->getCanvas()->drawPath(path, paint); 427 surface->getCanvas()->drawPath(path, paint);
428 } 428 }
429 429
430 static void test_addrect(skiatest::Reporter* reporter) { 430 static void test_addrect(skiatest::Reporter* reporter) {
431 SkPath path; 431 SkPath path;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 path->quadTo(577198, 1972, 577238, 1971.31f); 490 path->quadTo(577198, 1972, 577238, 1971.31f);
491 path->quadTo(577277, 1970.62f, 577317, 1971.45f); 491 path->quadTo(577277, 1970.62f, 577317, 1971.45f);
492 path->quadTo(577330, 1971.72f, 577341, 1972.11f); 492 path->quadTo(577330, 1971.72f, 577341, 1972.11f);
493 path->cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237 f); 493 path->cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237 f);
494 path->moveTo(306.718f, -32.912f); 494 path->moveTo(306.718f, -32.912f);
495 path->cubicTo(30.531f, 10.0005f, 1502.47f, 13.2804f, 84.3088f, 9.99601f) ; 495 path->cubicTo(30.531f, 10.0005f, 1502.47f, 13.2804f, 84.3088f, 9.99601f) ;
496 } 496 }
497 } 497 }
498 498
499 static void test_clipped_cubic() { 499 static void test_clipped_cubic() {
500 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(640, 480)); 500 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
501 501
502 // This path used to assert, because our cubic-chopping code incorrectly 502 // This path used to assert, because our cubic-chopping code incorrectly
503 // moved control points after the chop. This test should be run in SK_DEBUG 503 // moved control points after the chop. This test should be run in SK_DEBUG
504 // mode to ensure that we no long assert. 504 // mode to ensure that we no long assert.
505 SkPath path; 505 SkPath path;
506 for (int doReducedCase = 0; doReducedCase <= 1; ++doReducedCase) { 506 for (int doReducedCase = 0; doReducedCase <= 1; ++doReducedCase) {
507 build_big_path(&path, SkToBool(doReducedCase)); 507 build_big_path(&path, SkToBool(doReducedCase));
508 508
509 SkPaint paint; 509 SkPaint paint;
510 for (int doAA = 0; doAA <= 1; ++doAA) { 510 for (int doAA = 0; doAA <= 1; ++doAA) {
(...skipping 15 matching lines...) Expand all
526 { SkDoubleToScalar(18.5030727), SkDoubleToScalar(129.13121) }, 526 { SkDoubleToScalar(18.5030727), SkDoubleToScalar(129.13121) },
527 }; 527 };
528 528
529 SkPath path; 529 SkPath path;
530 path.moveTo(pts[0]); 530 path.moveTo(pts[0]);
531 path.cubicTo(pts[1], pts[2], pts[3]); 531 path.cubicTo(pts[1], pts[2], pts[3]);
532 532
533 SkPaint paint; 533 SkPaint paint;
534 paint.setAntiAlias(true); 534 paint.setAntiAlias(true);
535 535
536 SkSurface* surface = SkSurface::NewRasterPMColor(19, 130); 536 SkSurface* surface = SkSurface::NewRasterN32Premul(19, 130);
537 surface->getCanvas()->drawPath(path, paint); 537 surface->getCanvas()->drawPath(path, paint);
538 surface->unref(); 538 surface->unref();
539 } 539 }
540 540
541 // Inspired by http://code.google.com/p/chromium/issues/detail?id=141651 541 // Inspired by http://code.google.com/p/chromium/issues/detail?id=141651
542 // 542 //
543 static void test_isfinite_after_transform(skiatest::Reporter* reporter) { 543 static void test_isfinite_after_transform(skiatest::Reporter* reporter) {
544 SkPath path; 544 SkPath path;
545 path.quadTo(157, 366, 286, 208); 545 path.quadTo(157, 366, 286, 208);
546 path.arcTo(37, 442, 315, 163, 957494590897113.0f); 546 path.arcTo(37, 442, 315, 163, 957494590897113.0f);
(...skipping 3176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3723 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); 3723 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode);
3724 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); 3724 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode);
3725 test_conicTo_special_case(reporter); 3725 test_conicTo_special_case(reporter);
3726 test_get_point(reporter); 3726 test_get_point(reporter);
3727 test_contains(reporter); 3727 test_contains(reporter);
3728 PathTest_Private::TestPathTo(reporter); 3728 PathTest_Private::TestPathTo(reporter);
3729 PathRefTest_Private::TestPathRef(reporter); 3729 PathRefTest_Private::TestPathRef(reporter);
3730 test_dump(reporter); 3730 test_dump(reporter);
3731 test_path_crbugskia2820(reporter); 3731 test_path_crbugskia2820(reporter);
3732 } 3732 }
OLDNEW
« no previous file with comments | « tests/DrawPathTest.cpp ('k') | tests/RecordDrawTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698