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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 189963004: Fix the rendering error of SkDraw::drawVertices in gpu path for solid color (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: code rebase + update comments according to Brian's suggestions Created 6 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/core/SkVertState.cpp ('k') | no next file » | 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 431238b9db27f2350334fb879e1be650e849ac92..45da4cfeb82f81cca29a58f56352a341715177e5 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -34,6 +34,7 @@
#include "SkSurface.h"
#include "SkTLazy.h"
#include "SkUtils.h"
+#include "SkVertState.h"
#include "SkErrorInternals.h"
#define CACHE_COMPATIBLE_DEVICE_TEXTURES 1
@@ -1628,6 +1629,31 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
const SkPaint& paint) {
CHECK_SHOULD_DRAW(draw, false);
+ // If both textures and vertex-colors are NULL, strokes hairlines with the paint's color.
+ if ((NULL == texs || NULL == paint.getShader()) && NULL == colors) {
+ texs = NULL;
+ SkPaint copy(paint);
+ copy.setStyle(SkPaint::kStroke_Style);
+ copy.setStrokeWidth(0);
+
+ VertState state(vertexCount, indices, indexCount);
+ VertState::Proc vertProc = state.chooseProc(vmode);
+
+ SkPoint* pts = new SkPoint[vertexCount * 6];
+ int i = 0;
+ while (vertProc(&state)) {
+ pts[i] = vertices[state.f0];
+ pts[i + 1] = vertices[state.f1];
+ pts[i + 2] = vertices[state.f1];
+ pts[i + 3] = vertices[state.f2];
+ pts[i + 4] = vertices[state.f2];
+ pts[i + 5] = vertices[state.f0];
+ i += 6;
+ }
+ draw.drawPoints(SkCanvas::kLines_PointMode, i, pts, copy, true);
+ return;
+ }
+
GrPaint grPaint;
// we ignore the shader if texs is null.
if (NULL == texs) {
« no previous file with comments | « src/core/SkVertState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698