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

Unified Diff: src/gpu/GrBlurUtils.cpp

Issue 1955633002: Take SkStrokeRec::InitStyle rather than SkPaint::Style in mask filter and DrawMask (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix xps change 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
« no previous file with comments | « src/effects/SkLayerRasterizer.cpp ('k') | src/xps/SkXPSDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrBlurUtils.cpp
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 59a3dfcd081083e184e85f5a7e738bb950200b5f..aee158113b759275fd34635eaea67a5feec82332 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -54,7 +54,7 @@ static bool sw_draw_with_mask_filter(GrDrawContext* drawContext,
const SkMaskFilter* filter,
const SkIRect& clipBounds,
GrPaint* grp,
- SkPaint::Style style) {
+ SkStrokeRec::InitStyle style) {
SkMask srcM, dstM;
if (!SkDraw::DrawToMask(devPath, &clipBounds, filter, &viewMatrix, &srcM,
@@ -96,7 +96,7 @@ static bool sw_draw_with_mask_filter(GrDrawContext* drawContext,
static sk_sp<GrTexture> create_mask_GPU(GrContext* context,
SkRect* maskRect,
const SkPath& devPath,
- const GrStrokeInfo& strokeInfo,
+ SkStrokeRec::InitStyle style,
bool doAA,
int sampleCnt) {
// This mask will ultimately be drawn as a non-AA rect (see draw_mask).
@@ -139,7 +139,7 @@ static sk_sp<GrTexture> create_mask_GPU(GrContext* context,
// the origin using tempPaint.
SkMatrix translate;
translate.setTranslate(-maskRect->fLeft, -maskRect->fTop);
- drawContext->drawPath(clip, tempPaint, translate, devPath, strokeInfo);
+ drawContext->drawPath(clip, tempPaint, translate, devPath, GrStrokeInfo(style));
return drawContext->asTexture();;
}
@@ -150,7 +150,7 @@ static void draw_path_with_mask_filter(GrContext* context,
const SkMatrix& viewMatrix,
const SkMaskFilter* maskFilter,
const SkPathEffect* pathEffect,
- const GrStrokeInfo& origStrokeInfo,
+ const GrStrokeInfo& strokeInfo,
SkPath* pathPtr,
bool pathIsMutable) {
SkASSERT(maskFilter);
@@ -158,29 +158,30 @@ static void draw_path_with_mask_filter(GrContext* context,
SkIRect clipBounds;
clip.getConservativeBounds(drawContext->width(), drawContext->height(), &clipBounds);
SkTLazy<SkPath> tmpPath;
- GrStrokeInfo strokeInfo(origStrokeInfo);
static const SkRect* cullRect = nullptr; // TODO: what is our bounds?
SkASSERT(strokeInfo.isDashed() || !pathEffect);
-
- if (!strokeInfo.isHairlineStyle()) {
+ SkStrokeRec::InitStyle maskStyle;
+ if (strokeInfo.isHairlineStyle()) {
+ maskStyle = SkStrokeRec::kHairline_InitStyle;
+ } else {
SkPath* strokedPath = pathIsMutable ? pathPtr : tmpPath.init();
+ SkStrokeRec rec = strokeInfo;
if (strokeInfo.isDashed()) {
- if (pathEffect->filterPath(strokedPath, *pathPtr, &strokeInfo, cullRect)) {
+ if (pathEffect->filterPath(strokedPath, *pathPtr, &rec, cullRect)) {
pathPtr = strokedPath;
pathPtr->setIsVolatile(true);
pathIsMutable = true;
}
- strokeInfo.removeDash();
}
- if (strokeInfo.applyToPath(strokedPath, *pathPtr)) {
+ if (rec.applyToPath(strokedPath, *pathPtr)) {
// Apply the stroke to the path if there is one
pathPtr = strokedPath;
pathPtr->setIsVolatile(true);
pathIsMutable = true;
- strokeInfo.setFillStyle();
}
+ maskStyle = SkStrokeRec::kFill_InitStyle;
}
// avoid possibly allocating a new path in transform if we can
@@ -209,7 +210,7 @@ static void draw_path_with_mask_filter(GrContext* context,
paint,
clip,
viewMatrix,
- strokeInfo,
+ SkStrokeRec(maskStyle),
*devPathPtr)) {
// the mask filter was able to draw itself directly, so there's nothing
// left to do.
@@ -219,7 +220,7 @@ static void draw_path_with_mask_filter(GrContext* context,
sk_sp<GrTexture> mask(create_mask_GPU(context,
&maskRect,
*devPathPtr,
- strokeInfo,
+ maskStyle,
paint->isAntiAlias(),
drawContext->numColorSamples()));
if (mask) {
@@ -236,13 +237,9 @@ static void draw_path_with_mask_filter(GrContext* context,
}
}
- // draw the mask on the CPU - this is a fallthrough path in case the
- // GPU path fails
- SkPaint::Style style = strokeInfo.isHairlineStyle() ? SkPaint::kStroke_Style :
- SkPaint::kFill_Style;
sw_draw_with_mask_filter(drawContext, context->textureProvider(),
clip, viewMatrix, *devPathPtr,
- maskFilter, clipBounds, paint, style);
+ maskFilter, clipBounds, paint, maskStyle);
}
void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
« no previous file with comments | « src/effects/SkLayerRasterizer.cpp ('k') | src/xps/SkXPSDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698