aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSWMaskHelper.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-05-10 09:14:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-10 09:14:17 -0700
commit6663acff010ce752e4bf778da81fa97448c9db31 (patch)
treeba48f7716f7ef948d9faac90599b8a555c0f51d3 /src/gpu/GrSWMaskHelper.cpp
parent44d427e048b2e290e086dc2c9f9227818388ef17 (diff)
Replace GrStrokeInfo with GrStyle.
A side effect is that arbitrary path effects can no be pushed deeper into the Ganesh flow for paths. They may be applied by path renderers. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1957363002 Committed: https://skia.googlesource.com/skia/+/33595bdf4b64a745f6340338d307e806e96c587f Review-Url: https://codereview.chromium.org/1957363002
Diffstat (limited to 'src/gpu/GrSWMaskHelper.cpp')
-rw-r--r--src/gpu/GrSWMaskHelper.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index b69edab82c..937b34380b 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -11,6 +11,7 @@
#include "GrDrawTarget.h"
#include "GrGpu.h"
#include "GrPipelineBuilder.h"
+#include "GrStyle.h"
#include "SkData.h"
#include "SkDistanceFieldGen.h"
@@ -117,22 +118,11 @@ void GrSWMaskHelper::draw(const SkRect& rect, SkRegion::Op op,
/**
* Draw a single path element of the clip stack into the accumulation bitmap
*/
-void GrSWMaskHelper::draw(const SkPath& path, const SkStrokeRec& stroke, SkRegion::Op op,
+void GrSWMaskHelper::draw(const SkPath& path, const GrStyle& style, SkRegion::Op op,
bool antiAlias, uint8_t alpha) {
-
SkPaint paint;
- if (stroke.isHairlineStyle()) {
- paint.setStyle(SkPaint::kStroke_Style);
- } else {
- if (stroke.isFillStyle()) {
- paint.setStyle(SkPaint::kFill_Style);
- } else {
- paint.setStyle(SkPaint::kStroke_Style);
- paint.setStrokeJoin(stroke.getJoin());
- paint.setStrokeCap(stroke.getCap());
- paint.setStrokeWidth(stroke.getWidth());
- }
- }
+ paint.setPathEffect(sk_ref_sp(style.pathEffect()));
+ style.strokeRec().applyToPaint(&paint);
paint.setAntiAlias(antiAlias);
SkTBlitterAllocator allocator;
@@ -307,7 +297,7 @@ void GrSWMaskHelper::toSDF(unsigned char* sdf) {
*/
GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context,
const SkPath& path,
- const SkStrokeRec& stroke,
+ const GrStyle& style,
const SkIRect& resultBounds,
bool antiAlias,
const SkMatrix* matrix) {
@@ -317,7 +307,7 @@ GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context,
return nullptr;
}
- helper.draw(path, stroke, SkRegion::kReplace_Op, antiAlias, 0xFF);
+ helper.draw(path, style, SkRegion::kReplace_Op, antiAlias, 0xFF);
GrTexture* texture(helper.createTexture());
if (!texture) {