| OLD | NEW |
| 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 "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 | 370 |
| 371 for (int aa = 0; aa <= 1; ++aa) { | 371 for (int aa = 0; aa <= 1; ++aa) { |
| 372 paint.setAntiAlias(SkToBool(aa)); | 372 paint.setAntiAlias(SkToBool(aa)); |
| 373 paint.setStrokeWidth(8.f); | 373 paint.setStrokeWidth(8.f); |
| 374 paint.setStrokeCap(SkPaint::kSquare_Cap); | 374 paint.setStrokeCap(SkPaint::kSquare_Cap); |
| 375 | 375 |
| 376 // Single dash element that is cut off at start and end | 376 // Single dash element that is cut off at start and end |
| 377 drawline(canvas, 32.f, 16.f, paint, 20.f, 0, 5.f); | 377 drawline(canvas, 32, 16, paint, 20.f, 0, 5.f); |
| 378 canvas->translate(0, SkIntToScalar(20)); | 378 canvas->translate(0, SkIntToScalar(20)); |
| 379 | 379 |
| 380 // Two dash elements where each one is cut off at beginning and end
respectively | 380 // Two dash elements where each one is cut off at beginning and end
respectively |
| 381 drawline(canvas, 32.f, 16.f, paint, 56.f, 0, 5.f); | 381 drawline(canvas, 32, 16, paint, 56.f, 0, 5.f); |
| 382 canvas->translate(0, SkIntToScalar(20)); | 382 canvas->translate(0, SkIntToScalar(20)); |
| 383 | 383 |
| 384 // Many dash elements where first and last are cut off at beginning
and end respectively | 384 // Many dash elements where first and last are cut off at beginning
and end respectively |
| 385 drawline(canvas, 32.f, 16.f, paint, 584.f, 0, 5.f); | 385 drawline(canvas, 32, 16, paint, 584.f, 0, 5.f); |
| 386 canvas->translate(0, SkIntToScalar(20)); | 386 canvas->translate(0, SkIntToScalar(20)); |
| 387 | 387 |
| 388 // Diagonal dash line where src pnts are not axis aligned (as appose
d to being diagonal from | 388 // Diagonal dash line where src pnts are not axis aligned (as appose
d to being diagonal from |
| 389 // a canvas rotation) | 389 // a canvas rotation) |
| 390 drawline(canvas, 32.f, 16.f, paint, 600.f, 30.f); | 390 drawline(canvas, 32, 16, paint, 600.f, 30.f); |
| 391 canvas->translate(0, SkIntToScalar(20)); | 391 canvas->translate(0, SkIntToScalar(20)); |
| 392 | 392 |
| 393 // Case where only the off interval exists on the line. Thus nothing
should be drawn | 393 // Case where only the off interval exists on the line. Thus nothing
should be drawn |
| 394 drawline(canvas, 32.f, 16.f, paint, 8.f, 0.f, 40.f); | 394 drawline(canvas, 32, 16, paint, 8.f, 0.f, 40.f); |
| 395 canvas->translate(0, SkIntToScalar(20)); | 395 canvas->translate(0, SkIntToScalar(20)); |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 }; | 398 }; |
| 399 | 399 |
| 400 ////////////////////////////////////////////////////////////////////////////// | 400 ////////////////////////////////////////////////////////////////////////////// |
| 401 | 401 |
| 402 static skiagm::GM* F0(void*) { return new DashingGM; } | 402 static skiagm::GM* F0(void*) { return new DashingGM; } |
| 403 static skiagm::GM* F1(void*) { return new Dashing2GM; } | 403 static skiagm::GM* F1(void*) { return new Dashing2GM; } |
| 404 static skiagm::GM* F2(void*) { return new Dashing3GM; } | 404 static skiagm::GM* F2(void*) { return new Dashing3GM; } |
| 405 static skiagm::GM* F3(void*) { return new Dashing4GM; } | 405 static skiagm::GM* F3(void*) { return new Dashing4GM; } |
| 406 | 406 |
| 407 static skiagm::GMRegistry gR0(F0); | 407 static skiagm::GMRegistry gR0(F0); |
| 408 static skiagm::GMRegistry gR1(F1); | 408 static skiagm::GMRegistry gR1(F1); |
| 409 static skiagm::GMRegistry gR2(F2); | 409 static skiagm::GMRegistry gR2(F2); |
| 410 static skiagm::GMRegistry gR3(F3); | 410 static skiagm::GMRegistry gR3(F3); |
| OLD | NEW |