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

Side by Side Diff: src/gpu/GrStrokeInfo.h

Issue 326103002: Use vertex attributes for dash effect in gpu (Closed) Base URL: https://skia.googlesource.com/skia.git@dashPlumb2
Patch Set: Float fix Created 6 years, 6 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 | « src/gpu/GrContext.cpp ('k') | src/gpu/SkGpuDevice.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 2014 Google Inc. 2 * Copyright 2014 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 #ifndef GrStrokeInfo_DEFINED 8 #ifndef GrStrokeInfo_DEFINED
9 #define GrStrokeInfo_DEFINED 9 #define GrStrokeInfo_DEFINED
10 10
(...skipping 15 matching lines...) Expand all
26 if (includeDash) { 26 if (includeDash) {
27 fDashInfo = src.fDashInfo; 27 fDashInfo = src.fDashInfo;
28 fDashType = src.fDashType; 28 fDashType = src.fDashType;
29 fIntervals.reset(src.dashCount()); 29 fIntervals.reset(src.dashCount());
30 memcpy(fIntervals.get(), src.fIntervals.get(), src.dashCount() * siz eof(SkScalar)); 30 memcpy(fIntervals.get(), src.fIntervals.get(), src.dashCount() * siz eof(SkScalar));
31 } else { 31 } else {
32 fDashType = SkPathEffect::kNone_DashType; 32 fDashType = SkPathEffect::kNone_DashType;
33 } 33 }
34 } 34 }
35 35
36 GrStrokeInfo(const SkPaint& paint, SkPaint::Style styleOverride) :
37 fStroke(paint, styleOverride), fDashType(SkPathEffect::kNone_DashType) {
38 this->init(paint);
39 }
40
41
36 explicit GrStrokeInfo(const SkPaint& paint) : 42 explicit GrStrokeInfo(const SkPaint& paint) :
37 fStroke(paint), fDashType(SkPathEffect::kNone_DashType) { 43 fStroke(paint), fDashType(SkPathEffect::kNone_DashType) {
38 const SkPathEffect* pe = paint.getPathEffect(); 44 this->init(paint);
39 this->setDashInfo(pe);
40 } 45 }
41 46
42 const SkStrokeRec& getStrokeRec() const { return fStroke; } 47 const SkStrokeRec& getStrokeRec() const { return fStroke; }
43 48
44 SkStrokeRec* getStrokeRecPtr() { return &fStroke; } 49 SkStrokeRec* getStrokeRecPtr() { return &fStroke; }
45 50
46 void setFillStyle() { fStroke.setFillStyle(); } 51 void setFillStyle() { fStroke.setFillStyle(); }
47 52
48 /* 53 /*
49 * This functions takes in a patheffect and fills in fDashInfo with the vari ous dashing 54 * This functions takes in a patheffect and fills in fDashInfo with the vari ous dashing
(...skipping 22 matching lines...) Expand all
72 return fDashInfo.fCount; 77 return fDashInfo.fCount;
73 } 78 }
74 79
75 void removeDash() { 80 void removeDash() {
76 fDashType = SkPathEffect::kNone_DashType; 81 fDashType = SkPathEffect::kNone_DashType;
77 } 82 }
78 83
79 const SkPathEffect::DashInfo& getDashInfo() const { return fDashInfo; } 84 const SkPathEffect::DashInfo& getDashInfo() const { return fDashInfo; }
80 85
81 private: 86 private:
87
88 void init(const SkPaint& paint) {
89 const SkPathEffect* pe = paint.getPathEffect();
90 this->setDashInfo(pe);
91 }
92
82 SkStrokeRec fStroke; 93 SkStrokeRec fStroke;
83 SkPathEffect::DashType fDashType; 94 SkPathEffect::DashType fDashType;
84 SkPathEffect::DashInfo fDashInfo; 95 SkPathEffect::DashInfo fDashInfo;
85 SkAutoSTArray<2, SkScalar> fIntervals; 96 SkAutoSTArray<2, SkScalar> fIntervals;
86 }; 97 };
87 98
88 #endif 99 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698