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

Side by Side Diff: gm/dashing.cpp

Issue 703783002: Bug fix for cull_line in SkDashPathEffect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add test cases to dashing gm Created 6 years, 1 month 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 | « expectations/gm/ignored-tests.txt ('k') | src/effects/SkDashPathEffect.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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 16 matching lines...) Expand all
27 27
28 // earlier bug stopped us from drawing very long single-segment dashes, because 28 // earlier bug stopped us from drawing very long single-segment dashes, because
29 // SkPathMeasure was skipping very small delta-T values (nearlyzero). This is 29 // SkPathMeasure was skipping very small delta-T values (nearlyzero). This is
30 // now fixes, so this giant dash should appear. 30 // now fixes, so this giant dash should appear.
31 static void show_giant_dash(SkCanvas* canvas) { 31 static void show_giant_dash(SkCanvas* canvas) {
32 SkPaint paint; 32 SkPaint paint;
33 33
34 drawline(canvas, 1, 1, paint, SkIntToScalar(20 * 1000)); 34 drawline(canvas, 1, 1, paint, SkIntToScalar(20 * 1000));
35 } 35 }
36 36
37 static void show_zero_len_dash(SkCanvas* canvas) {
38 SkPaint paint;
39
40 drawline(canvas, 2, 2, paint, SkIntToScalar(0));
41 paint.setStyle(SkPaint::kStroke_Style);
42 paint.setStrokeWidth(SkIntToScalar(2));
43 canvas->translate(0, SkIntToScalar(20));
44 drawline(canvas, 4, 4, paint, SkIntToScalar(0));
45 }
46
37 class DashingGM : public skiagm::GM { 47 class DashingGM : public skiagm::GM {
38 public: 48 public:
39 DashingGM() {} 49 DashingGM() {}
40 50
41 protected: 51 protected:
42 virtual uint32_t onGetFlags() const SK_OVERRIDE { 52 virtual uint32_t onGetFlags() const SK_OVERRIDE {
43 return kSkipTiled_Flag; 53 return kSkipTiled_Flag;
44 } 54 }
45 55
46 SkString onShortName() { 56 SkString onShortName() {
(...skipping 27 matching lines...) Expand all
74 84
75 drawline(canvas, gData[data].fOnInterval * scale, 85 drawline(canvas, gData[data].fOnInterval * scale,
76 gData[data].fOffInterval * scale, 86 gData[data].fOffInterval * scale,
77 paint); 87 paint);
78 canvas->translate(0, SkIntToScalar(20)); 88 canvas->translate(0, SkIntToScalar(20));
79 } 89 }
80 } 90 }
81 } 91 }
82 92
83 show_giant_dash(canvas); 93 show_giant_dash(canvas);
94 canvas->translate(0, SkIntToScalar(20));
95 show_zero_len_dash(canvas);
84 } 96 }
85 }; 97 };
86 98
87 /////////////////////////////////////////////////////////////////////////////// 99 ///////////////////////////////////////////////////////////////////////////////
88 100
89 static void make_unit_star(SkPath* path, int n) { 101 static void make_unit_star(SkPath* path, int n) {
90 SkScalar rad = -SK_ScalarPI / 2; 102 SkScalar rad = -SK_ScalarPI / 2;
91 const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n; 103 const SkScalar drad = (n >> 1) * SK_ScalarPI * 2 / n;
92 104
93 path->moveTo(0, -SK_Scalar1); 105 path->moveTo(0, -SK_Scalar1);
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 485
474 ////////////////////////////////////////////////////////////////////////////// 486 //////////////////////////////////////////////////////////////////////////////
475 487
476 DEF_GM(return SkNEW(DashingGM);) 488 DEF_GM(return SkNEW(DashingGM);)
477 DEF_GM(return SkNEW(Dashing2GM);) 489 DEF_GM(return SkNEW(Dashing2GM);)
478 DEF_GM(return SkNEW(Dashing3GM);) 490 DEF_GM(return SkNEW(Dashing3GM);)
479 DEF_GM(return SkNEW(Dashing4GM);) 491 DEF_GM(return SkNEW(Dashing4GM);)
480 DEF_GM(return SkNEW_ARGS(Dashing5GM, (true));) 492 DEF_GM(return SkNEW_ARGS(Dashing5GM, (true));)
481 DEF_GM(return SkNEW_ARGS(Dashing5GM, (false));) 493 DEF_GM(return SkNEW_ARGS(Dashing5GM, (false));)
482 494
OLDNEW
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | src/effects/SkDashPathEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698