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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 449433003: Fix drawVertices() on GPU when texs=colors=shaders=indices=null (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove extra space Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "effects/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 const uint16_t indices[], int indexCount, 1615 const uint16_t indices[], int indexCount,
1616 const SkPaint& paint) { 1616 const SkPaint& paint) {
1617 CHECK_SHOULD_DRAW(draw, false); 1617 CHECK_SHOULD_DRAW(draw, false);
1618 1618
1619 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawVertices", fContext); 1619 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawVertices", fContext);
1620 1620
1621 const uint16_t* outIndices; 1621 const uint16_t* outIndices;
1622 SkAutoTDeleteArray<uint16_t> outAlloc(NULL); 1622 SkAutoTDeleteArray<uint16_t> outAlloc(NULL);
1623 GrPrimitiveType primType; 1623 GrPrimitiveType primType;
1624 GrPaint grPaint; 1624 GrPaint grPaint;
1625 1625
1626 // If both textures and vertex-colors are NULL, strokes hairlines with the p aint's color. 1626 // If both textures and vertex-colors are NULL, strokes hairlines with the p aint's color.
1627 if ((NULL == texs || NULL == paint.getShader()) && NULL == colors) { 1627 if ((NULL == texs || NULL == paint.getShader()) && NULL == colors) {
1628 1628
1629 texs = NULL; 1629 texs = NULL;
1630 1630
1631 SkPaint copy(paint); 1631 SkPaint copy(paint);
1632 copy.setStyle(SkPaint::kStroke_Style); 1632 copy.setStyle(SkPaint::kStroke_Style);
1633 copy.setStrokeWidth(0); 1633 copy.setStrokeWidth(0);
1634 1634
1635 // we ignore the shader if texs is null. 1635 // we ignore the shader if texs is null.
1636 SkPaint2GrPaintNoShader(this->context(), copy, SkColor2GrColor(copy.getC olor()), 1636 SkPaint2GrPaintNoShader(this->context(), copy, SkColor2GrColor(copy.getC olor()),
1637 NULL == colors, &grPaint); 1637 NULL == colors, &grPaint);
1638 1638
1639 primType = kLines_GrPrimitiveType; 1639 primType = kLines_GrPrimitiveType;
1640 int triangleCount = 0; 1640 int triangleCount = 0;
1641 int n = (NULL == indices) ? vertexCount : indexCount;
1641 switch (vmode) { 1642 switch (vmode) {
1642 case SkCanvas::kTriangles_VertexMode: 1643 case SkCanvas::kTriangles_VertexMode:
1643 triangleCount = indexCount / 3; 1644 triangleCount = n / 3;
1644 break; 1645 break;
1645 case SkCanvas::kTriangleStrip_VertexMode: 1646 case SkCanvas::kTriangleStrip_VertexMode:
1646 case SkCanvas::kTriangleFan_VertexMode: 1647 case SkCanvas::kTriangleFan_VertexMode:
1647 triangleCount = indexCount - 2; 1648 triangleCount = n - 2;
1648 break; 1649 break;
1649 } 1650 }
1650 1651
1651 VertState state(vertexCount, indices, indexCount); 1652 VertState state(vertexCount, indices, indexCount);
1652 VertState::Proc vertProc = state.chooseProc(vmode); 1653 VertState::Proc vertProc = state.chooseProc(vmode);
1653 1654
1654 //number of indices for lines per triangle with kLines 1655 //number of indices for lines per triangle with kLines
1655 indexCount = triangleCount * 6; 1656 indexCount = triangleCount * 6;
1656 1657
1657 outAlloc.reset(SkNEW_ARRAY(uint16_t, indexCount)); 1658 outAlloc.reset(SkNEW_ARRAY(uint16_t, indexCount));
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 } 2124 }
2124 2125
2125 return true; 2126 return true;
2126 } 2127 }
2127 2128
2128 SkImageFilter::UniqueIDCache* SkGpuDevice::getImageFilterCache() { 2129 SkImageFilter::UniqueIDCache* SkGpuDevice::getImageFilterCache() {
2129 // We always return a transient cache, so it is freed after each 2130 // We always return a transient cache, so it is freed after each
2130 // filter traversal. 2131 // filter traversal.
2131 return SkImageFilter::UniqueIDCache::Create(kDefaultImageFilterCacheSize); 2132 return SkImageFilter::UniqueIDCache::Create(kDefaultImageFilterCacheSize);
2132 } 2133 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698