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

Side by Side Diff: gm/dashcubics.cpp

Issue 166583002: Factory methods for heap-allocated SkPathEffect and SkXfermode objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update experimental/PdfViewer Created 6 years, 10 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 | « experimental/PdfViewer/SkPdfGraphicsState.cpp ('k') | gm/dashing.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 "SkPath.h" 10 #include "SkPath.h"
(...skipping 25 matching lines...) Expand all
36 "C 156,305 217,269 217,269 C 217,269 217,269 217,269 C 217,269 217,269 2 17,269" 36 "C 156,305 217,269 217,269 C 217,269 217,269 217,269 C 217,269 217,269 2 17,269"
37 "C 217,269 156,305 163,402 C 250,359 250,288 250,288 C 250,288 250,288 2 50,288" 37 "C 217,269 156,305 163,402 C 250,359 250,288 250,288 C 250,288 250,288 2 50,288"
38 "C 250,288 250,288 250,288 C 250,288 250,359 338,402 C 345,305 283,269 2 83,269" 38 "C 250,288 250,288 250,288 C 250,288 250,359 338,402 C 345,305 283,269 2 83,269"
39 "C 283,269 283,269 283,269 C 283,269 283,269 283,269 C 283,269 345,305 4 25,250" 39 "C 283,269 283,269 283,269 C 283,269 283,269 283,269 C 283,269 345,305 4 25,250"
40 "C 344,195 283,231 283,231 C 283,231 283,231 283,231 C 283,231 283,231 2 83,231" 40 "C 344,195 283,231 283,231 C 283,231 283,231 283,231 C 283,231 283,231 2 83,231"
41 "C 283,231 344,195 338,98"; 41 "C 283,231 344,195 338,98";
42 42
43 SkParsePath::FromSVGString(d, &path); 43 SkParsePath::FromSVGString(d, &path);
44 44
45 SkScalar intervals[] = { 5, 10 }; 45 SkScalar intervals[] = { 5, 10 };
46 SkPathEffect* pe = new SkDashPathEffect(intervals, 2, 0); 46 SkPathEffect* pe = SkDashPathEffect::Create(intervals, 2, 0);
47 47
48 SkPaint paint; 48 SkPaint paint;
49 paint.setAntiAlias(true); 49 paint.setAntiAlias(true);
50 paint.setStyle(SkPaint::kStroke_Style); 50 paint.setStyle(SkPaint::kStroke_Style);
51 51
52 paint.setStrokeWidth(42); 52 paint.setStrokeWidth(42);
53 canvas->drawPath(path, paint); 53 canvas->drawPath(path, paint);
54 54
55 paint.setColor(SK_ColorRED); 55 paint.setColor(SK_ColorRED);
56 paint.setStrokeWidth(21); 56 paint.setStrokeWidth(21);
57 paint.setPathEffect(pe)->unref(); 57 paint.setPathEffect(pe)->unref();
58 canvas->drawPath(path, paint); 58 canvas->drawPath(path, paint);
59 59
60 paint.setColor(SK_ColorGREEN); 60 paint.setColor(SK_ColorGREEN);
61 paint.setPathEffect(NULL); 61 paint.setPathEffect(NULL);
62 paint.setStrokeWidth(0); 62 paint.setStrokeWidth(0);
63 canvas->drawPath(path, paint); 63 canvas->drawPath(path, paint);
64 } 64 }
65 65
66 private: 66 private:
67 typedef GM INHERITED; 67 typedef GM INHERITED;
68 }; 68 };
69 69
70 ////////////////////////////////////////////////////////////////////////////// 70 //////////////////////////////////////////////////////////////////////////////
71 71
72 static skiagm::GM* MyFactory(void*) { return new DashCubicsGM; } 72 static skiagm::GM* MyFactory(void*) { return new DashCubicsGM; }
73 static skiagm::GMRegistry reg(MyFactory); 73 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkPdfGraphicsState.cpp ('k') | gm/dashing.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698