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

Unified Diff: src/gpu/GrSWMaskHelper.cpp

Issue 1957363002: Replace GrStrokeInfo with GrStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@resscale
Patch Set: Fix issue where hairlines were going to MSAAPathRenderer Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrSWMaskHelper.cpp
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index b69edab82cab030c7c541d86a9df1a7e3e44439e..937b34380ba464951ff9e59870c145326be033b9 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) {

Powered by Google App Engine
This is Rietveld 408576698