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

Side by Side Diff: gm/strokes.cpp

Issue 1334543002: Revert of more zero-length changes for svg compatibility (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | src/core/SkCanvas.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 "gm.h" 8 #include "gm.h"
9 #include "SkPath.h" 9 #include "SkPath.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 private: 77 private:
78 typedef skiagm::GM INHERITED; 78 typedef skiagm::GM INHERITED;
79 }; 79 };
80 80
81 /* See 81 /* See
82 https://code.google.com/p/chromium/issues/detail?id=422974 and 82 https://code.google.com/p/chromium/issues/detail?id=422974 and
83 http://jsfiddle.net/1xnku3sg/2/ 83 http://jsfiddle.net/1xnku3sg/2/
84 */ 84 */
85 class ZeroLenStrokesGM : public skiagm::GM { 85 class ZeroLenStrokesGM : public skiagm::GM {
86 SkPath fMoveHfPath, fMoveZfPath, fDashedfPath, fRefPath[4]; 86 SkPath fMoveHfPath, fMoveZfPath, fDashedfPath, fRefPath[4];
87 SkPath fCubicPath, fQuadPath, fLinePath;
88 protected: 87 protected:
89 void onOnceBeforeDraw() override { 88 void onOnceBeforeDraw() override {
90 89
91 SkAssertResult(SkParsePath::FromSVGString("M0,0h0M10,0h0M20,0h0", &fMove HfPath)); 90 SkAssertResult(SkParsePath::FromSVGString("M0,0h0M10,0h0M20,0h0", &fMove HfPath));
92 SkAssertResult(SkParsePath::FromSVGString("M0,0zM10,0zM20,0z", &fMoveZfP ath)); 91 SkAssertResult(SkParsePath::FromSVGString("M0,0zM10,0zM20,0z", &fMoveZfP ath));
93 SkAssertResult(SkParsePath::FromSVGString("M0,0h25", &fDashedfPath)); 92 SkAssertResult(SkParsePath::FromSVGString("M0,0h25", &fDashedfPath));
94 SkAssertResult(SkParsePath::FromSVGString("M 0 0 C 0 0 0 0 0 0", &fCubic Path));
95 SkAssertResult(SkParsePath::FromSVGString("M 0 0 Q 0 0 0 0", &fQuadPath) );
96 SkAssertResult(SkParsePath::FromSVGString("M 0 0 L 0 0", &fLinePath));
97 93
98 for (int i = 0; i < 3; ++i) { 94 for (int i = 0; i < 3; ++i) {
99 fRefPath[0].addCircle(i * 10.f, 0, 5); 95 fRefPath[0].addCircle(i * 10.f, 0, 5);
100 fRefPath[1].addCircle(i * 10.f, 0, 10); 96 fRefPath[1].addCircle(i * 10.f, 0, 10);
101 fRefPath[2].addRect(i * 10.f - 4, -2, i * 10.f + 4, 6); 97 fRefPath[2].addRect(i * 10.f - 4, -2, i * 10.f + 4, 6);
102 fRefPath[3].addRect(i * 10.f - 10, -10, i * 10.f + 10, 10); 98 fRefPath[3].addRect(i * 10.f - 10, -10, i * 10.f + 10, 10);
103 } 99 }
104 } 100 }
105 101
106 SkString onShortName() override { 102 SkString onShortName() override {
(...skipping 30 matching lines...) Expand all
137 canvas->drawPath(fRefPath[i * 2], fillPaint); 133 canvas->drawPath(fRefPath[i * 2], fillPaint);
138 strokePaint.setStrokeWidth(20); 134 strokePaint.setStrokeWidth(20);
139 strokePaint.setAlpha(127); 135 strokePaint.setAlpha(127);
140 canvas->translate(0, 50); 136 canvas->translate(0, 50);
141 canvas->drawPath(fMoveHfPath, strokePaint); 137 canvas->drawPath(fMoveHfPath, strokePaint);
142 canvas->translate(0, 30); 138 canvas->translate(0, 30);
143 canvas->drawPath(fMoveZfPath, strokePaint); 139 canvas->drawPath(fMoveZfPath, strokePaint);
144 canvas->translate(0, 30); 140 canvas->translate(0, 30);
145 fillPaint.setAlpha(127); 141 fillPaint.setAlpha(127);
146 canvas->drawPath(fRefPath[1 + i * 2], fillPaint); 142 canvas->drawPath(fRefPath[1 + i * 2], fillPaint);
147 canvas->translate(0, 30);
148 canvas->drawPath(fCubicPath, strokePaint);
149 canvas->translate(0, 30);
150 canvas->drawPath(fQuadPath, strokePaint);
151 canvas->translate(0, 30);
152 canvas->drawPath(fLinePath, strokePaint);
153 canvas->restore(); 143 canvas->restore();
154 } 144 }
155 } 145 }
156 146
157 private: 147 private:
158 typedef skiagm::GM INHERITED; 148 typedef skiagm::GM INHERITED;
159 }; 149 };
160 150
161 class Strokes2GM : public skiagm::GM { 151 class Strokes2GM : public skiagm::GM {
162 SkPath fPath; 152 SkPath fPath;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 static skiagm::GM* F3(void*) { return new Strokes4GM; } 401 static skiagm::GM* F3(void*) { return new Strokes4GM; }
412 static skiagm::GM* F4(void*) { return new Strokes5GM; } 402 static skiagm::GM* F4(void*) { return new Strokes5GM; }
413 403
414 static skiagm::GMRegistry R0(F0); 404 static skiagm::GMRegistry R0(F0);
415 static skiagm::GMRegistry R1(F1); 405 static skiagm::GMRegistry R1(F1);
416 static skiagm::GMRegistry R2(F2); 406 static skiagm::GMRegistry R2(F2);
417 static skiagm::GMRegistry R3(F3); 407 static skiagm::GMRegistry R3(F3);
418 static skiagm::GMRegistry R4(F4); 408 static skiagm::GMRegistry R4(F4);
419 409
420 DEF_GM( return new ZeroLenStrokesGM; ) 410 DEF_GM( return new ZeroLenStrokesGM; )
OLDNEW
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698