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

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: Rebase to ToT Created 6 years, 1 month 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 | « include/core/SkPicture.h ('k') | src/core/SkPictureContentInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicture.cpp
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index dccb822c82c4d3ab6abc37327167cd0650134a79..01b315a758a3134069231f5d9fea9872da737325 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 && !op.path.isVolatile()) {
+ 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
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkPictureContentInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698