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

Unified Diff: src/gpu/GrContext.cpp

Issue 326103002: Use vertex attributes for dash effect in gpu (Closed) Base URL: https://skia.googlesource.com/skia.git@dashPlumb2
Patch Set: Float fix Created 6 years, 6 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/core/SkStrokeRec.cpp ('k') | src/gpu/GrStrokeInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index b64bf60740326d66effed290171df04a4588c7e0..e823a986cf934d482e61aec8516454eb7013731a 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -9,8 +9,9 @@
#include "GrContext.h"
-#include "effects/GrSingleTextureEffect.h"
#include "effects/GrConfigConversionEffect.h"
+#include "effects/GrDashingEffect.h"
+#include "effects/GrSingleTextureEffect.h"
#include "GrAARectRenderer.h"
#include "GrBufferAllocPool.h"
@@ -971,11 +972,10 @@ void GrContext::drawVertices(const GrPaint& paint,
GrDrawTarget::AutoReleaseGeometry geo; // must be inside AutoCheckFlush scope
GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf);
+ GrDrawState* drawState = target->drawState();
GR_CREATE_TRACE_MARKER("GrContext::drawVertices", target);
- GrDrawState* drawState = target->drawState();
-
int colorOffset = -1, texOffset = -1;
set_vertex_attributes(drawState, texCoords, colors, &colorOffset, &texOffset);
@@ -1168,6 +1168,24 @@ void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const GrStrok
}
if (strokeInfo.isDashed()) {
+ SkPoint pts[2];
+ if (path.isLine(pts)) {
+ AutoRestoreEffects are;
+ AutoCheckFlush acf(this);
+ GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf);
+ GrDrawState* drawState = target->drawState();
+
+ SkMatrix origViewMatrix = drawState->getViewMatrix();
+ GrDrawState::AutoViewMatrixRestore avmr;
+ if (avmr.setIdentity(target->drawState())) {
+ if (GrDashingEffect::DrawDashLine(pts, paint, strokeInfo, fGpu, target,
+ origViewMatrix)) {
+ return;
+ }
+ }
+ }
+
+ // Filter dashed path into new path with the dashing applied
const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo();
SkTLazy<SkPath> effectPath;
GrStrokeInfo newStrokeInfo(strokeInfo, false);
« no previous file with comments | « src/core/SkStrokeRec.cpp ('k') | src/gpu/GrStrokeInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698