aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrStrokeInfo.h
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-06-12 10:24:21 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-12 10:24:21 -0700
commite61c411c1258a323a010558c08de3d9f8d170dca (patch)
tree295c5f7a9ec0001daf7b87e2573e9f74ffbe3d3b /src/gpu/GrStrokeInfo.h
parentb205d09b296e01f1c4debdf7f60d2f3e4cd2ea43 (diff)
Use vertex attributes for dash effect in gpu
This will allow us to batch dashed lines together when drawing. Also, this removes the need for a coord transform matrix in the shader, thus we save the cost of uploading a new matrix uniform everytime we do a simple transform to the dashed line we are drawing. BUG=skia: R=bsalomon@google.com Author: egdaniel@google.com Review URL: https://codereview.chromium.org/326103002
Diffstat (limited to 'src/gpu/GrStrokeInfo.h')
-rw-r--r--src/gpu/GrStrokeInfo.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gpu/GrStrokeInfo.h b/src/gpu/GrStrokeInfo.h
index b96ed39096..b9ba5eada1 100644
--- a/src/gpu/GrStrokeInfo.h
+++ b/src/gpu/GrStrokeInfo.h
@@ -33,10 +33,15 @@ public:
}
}
+ GrStrokeInfo(const SkPaint& paint, SkPaint::Style styleOverride) :
+ fStroke(paint, styleOverride), fDashType(SkPathEffect::kNone_DashType) {
+ this->init(paint);
+ }
+
+
explicit GrStrokeInfo(const SkPaint& paint) :
fStroke(paint), fDashType(SkPathEffect::kNone_DashType) {
- const SkPathEffect* pe = paint.getPathEffect();
- this->setDashInfo(pe);
+ this->init(paint);
}
const SkStrokeRec& getStrokeRec() const { return fStroke; }
@@ -79,6 +84,12 @@ public:
const SkPathEffect::DashInfo& getDashInfo() const { return fDashInfo; }
private:
+
+ void init(const SkPaint& paint) {
+ const SkPathEffect* pe = paint.getPathEffect();
+ this->setDashInfo(pe);
+ }
+
SkStrokeRec fStroke;
SkPathEffect::DashType fDashType;
SkPathEffect::DashInfo fDashInfo;