Fix two more drawVertices "bugs"

1) Prior to SkVertices, drawing with local coords but no shader triggered
   wireframe mode (as if no local coords were supplied, and assuming no
   colors). I find the wireframe thing to be strange, but restore that
   behavior to match CPU backend.

2) More importantly: If we *do* fall into the wireframe mode, make sure to
   not *also* draw in non-wireframe. Yesterday's bugfix to paint
   conversion caused those kinds of draws to draw wireframe, then draw in
   fill mode on top.

Bug: skia:
Change-Id: Ie579b54480b4488a09c207fecbbe3badbddc5d68
Reviewed-on: https://skia-review.googlesource.com/18032
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2017-05-26 10:39:51 -04:00 committed by Skia Commit-Bot
parent eb9f278e8c
commit 0b403f8b6b

View File

@ -1634,8 +1634,7 @@ void SkGpuDevice::wireframeVertices(SkVertices::VertexMode vmode, int vertexCoun
&primitiveType);
}
void SkGpuDevice::drawVertices(const SkVertices* vertices, SkBlendMode mode,
const SkPaint& paint) {
void SkGpuDevice::drawVertices(const SkVertices* vertices, SkBlendMode mode, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
CHECK_SHOULD_DRAW();
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawVertices", fContext.get());
@ -1644,10 +1643,11 @@ void SkGpuDevice::drawVertices(const SkVertices* vertices, SkBlendMode mode,
GrPaint grPaint;
bool hasColors = vertices->hasColors();
bool hasTexs = vertices->hasTexCoords();
if (!hasTexs && !hasColors) {
if ((!hasTexs || !paint.getShader()) && !hasColors) {
// The dreaded wireframe mode. Fallback to drawVertices and go so slooooooow.
this->wireframeVertices(vertices->mode(), vertices->vertexCount(), vertices->positions(),
mode, vertices->indices(), vertices->indexCount(), paint);
return;
}
if (!init_vertices_paint(fContext.get(), fRenderTargetContext.get(), paint, this->ctm(),
mode, hasTexs, hasColors, &grPaint)) {