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

Unified Diff: src/core/SkPicture.cpp

Issue 685113003: Enable distance field path rendering in Chrome. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/core/SkPicture.cpp
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 98c28e61af4189d99681e0bd00028cc4cbdf78ef..602025aa34a107446d0a2c2831f583d6af1d415c 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -135,7 +135,8 @@ struct SkPicture::PathCounter {
: numPaintWithPathEffectUses (0)
, numFastPathDashEffects (0)
, numAAConcavePaths (0)
- , numAAHairlineConcavePaths (0) {
+ , numAAHairlineConcavePaths (0)
+ , numAADFEligibleConcavePaths(0) {
}
// Recurse into nested pictures.
@@ -145,6 +146,7 @@ struct SkPicture::PathCounter {
numFastPathDashEffects += analysis.fNumFastPathDashEffects;
numAAConcavePaths += analysis.fNumAAConcavePaths;
numAAHairlineConcavePaths += analysis.fNumAAHairlineConcavePaths;
+ numAADFEligibleConcavePaths += analysis.fNumAADFEligibleConcavePaths;
}
void checkPaint(const SkPaint* paint) {
@@ -171,9 +173,14 @@ struct SkPicture::PathCounter {
if (op.paint.isAntiAlias() && !op.path.isConvex()) {
numAAConcavePaths++;
- if (SkPaint::kStroke_Style == op.paint.getStyle() &&
+ SkPaint::Style paintStyle = op.paint.getStyle();
+ const SkRect& pathBounds = op.path.getBounds();
+ if (SkPaint::kStroke_Style == paintStyle &&
0 == op.paint.getStrokeWidth()) {
numAAHairlineConcavePaths++;
+ } else if (SkPaint::kFill_Style == paintStyle && pathBounds.width() < 64.f &&
+ pathBounds.height() < 64.f) {
bsalomon 2014/10/29 20:53:45 && !op.path.isVolatile() ?
jvanverth1 2014/10/30 18:55:47 Done.
+ numAADFEligibleConcavePaths++;
}
}
}
@@ -190,6 +197,7 @@ struct SkPicture::PathCounter {
int numFastPathDashEffects;
int numAAConcavePaths;
int numAAHairlineConcavePaths;
+ int numAADFEligibleConcavePaths;
};
SkPicture::Analysis::Analysis(const SkRecord& record) {
@@ -203,6 +211,7 @@ SkPicture::Analysis::Analysis(const SkRecord& record) {
fNumFastPathDashEffects = counter.numFastPathDashEffects;
fNumAAConcavePaths = counter.numAAConcavePaths;
fNumAAHairlineConcavePaths = counter.numAAHairlineConcavePaths;
+ fNumAADFEligibleConcavePaths = counter.numAADFEligibleConcavePaths;
fHasText = false;
TextHunter text;
@@ -227,7 +236,7 @@ bool SkPicture::Analysis::suitableForGpuRasterization(const char** reason,
&& 0 == sampleCount);
bool ret = suitableForDash &&
- (fNumAAConcavePaths - fNumAAHairlineConcavePaths)
+ (fNumAAConcavePaths - fNumAAHairlineConcavePaths - fNumAADFEligibleConcavePaths)
< kNumAAConcavePathsTol;
if (!ret && reason) {
@@ -237,7 +246,7 @@ bool SkPicture::Analysis::suitableForGpuRasterization(const char** reason,
} else {
*reason = "Too many non dashed path effects.";
}
- } else if ((fNumAAConcavePaths - fNumAAHairlineConcavePaths)
+ } else if ((fNumAAConcavePaths - fNumAAHairlineConcavePaths - fNumAADFEligibleConcavePaths)
>= kNumAAConcavePathsTol)
*reason = "Too many anti-aliased concave paths.";
else

Powered by Google App Engine
This is Rietveld 408576698