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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 66813002: Revert "Do not apply hairline optimization for paths if nv_path_rendering is used" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 52dc5a7351af856c08d7c88446a74ebc6351f9c3..ca86b84a20ff33985dfe0fddbd5da11b4d9bce99 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -12,8 +12,7 @@
#include "GrContext.h"
#include "GrBitmapTextContext.h"
-#include "GrGpu.h"
-#include "GrDrawTargetCaps.h"
+
#include "SkGrTexturePixelRef.h"
#include "SkColorFilter.h"
@@ -851,6 +850,14 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
return;
}
+ // can we cheat, and treat a thin stroke as a hairline w/ coverage
+ // if we can, we draw lots faster (raster device does this same test)
+ SkScalar hairlineCoverage;
+ bool doHairLine = SkDrawTreatAsHairline(paint, fContext->getMatrix(), &hairlineCoverage);
+ if (doHairLine) {
+ grPaint.setCoverage(SkScalarRoundToInt(hairlineCoverage * grPaint.getCoverage()));
+ }
+
// If we have a prematrix, apply it to the path, optimizing for the case
// where the original path can in fact be modified in place (even though
// its parameter type is const).
@@ -880,6 +887,10 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
pathPtr = &effectPath;
}
+ if (!pathEffect && doHairLine) {
+ stroke.setHairlineStyle();
+ }
+
if (paint.getMaskFilter()) {
if (!stroke.isHairlineStyle()) {
if (stroke.applyToPath(&tmpPath, *pathPtr)) {
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698