OLD | NEW |
---|---|
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 "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1707 | 1707 |
1708 for (int i = 0; i < count; ++i) { | 1708 for (int i = 0; i < count; ++i) { |
1709 xform[i].toQuad(texRect[i].width(), texRect[i].height(), verts); | 1709 xform[i].toQuad(texRect[i].width(), texRect[i].height(), verts); |
1710 texRect[i].toQuad(texs); | 1710 texRect[i].toQuad(texs); |
1711 append_quad_indices(indices, i); | 1711 append_quad_indices(indices, i); |
1712 verts += 4; | 1712 verts += 4; |
1713 texs += 4; | 1713 texs += 4; |
1714 indices += 6; | 1714 indices += 6; |
1715 } | 1715 } |
1716 | 1716 |
1717 SkAutoTMalloc<SkColor> colorStorage; | |
1718 SkColor* vertCols = NULL; | |
1719 if (colors) { | |
1720 colorStorage.reset(vertCount); | |
1721 vertCols = colorStorage.get(); | |
1722 | |
1723 for (int i = 0; i < count; ++i) { | |
1724 vertCols[0] = vertCols[1] = vertCols[2] = vertCols[3] = colors[i]; | |
1725 vertCols += 4; | |
1726 } | |
1727 } | |
1728 | |
1717 verts = vertStorage.get(); | 1729 verts = vertStorage.get(); |
1718 texs = verts + vertCount; | 1730 texs = verts + vertCount; |
1731 vertCols = colorStorage.get(); | |
1719 indices = indexStorage.get(); | 1732 indices = indexStorage.get(); |
1720 this->drawVertices(d, SkCanvas::kTriangles_VertexMode, vertCount, verts, tex s, colors, xfer, | 1733 this->drawVertices(d, SkCanvas::kTriangles_VertexMode, vertCount, verts, tex s, vertCols, xfer, |
eseidel
2015/07/24 17:22:44
so vertCols is 4x the size of colors, right? Was
robertphillips
2015/07/24 17:55:50
Yep - that resulted in the flickering.
| |
1721 indices, indexCount, p); | 1734 indices, indexCount, p); |
1722 } | 1735 } |
1723 | 1736 |
1724 /////////////////////////////////////////////////////////////////////////////// | 1737 /////////////////////////////////////////////////////////////////////////////// |
1725 | 1738 |
1726 void SkGpuDevice::drawText(const SkDraw& draw, const void* text, | 1739 void SkGpuDevice::drawText(const SkDraw& draw, const void* text, |
1727 size_t byteLength, SkScalar x, SkScalar y, | 1740 size_t byteLength, SkScalar x, SkScalar y, |
1728 const SkPaint& paint) { | 1741 const SkPaint& paint) { |
1729 CHECK_SHOULD_DRAW(draw); | 1742 CHECK_SHOULD_DRAW(draw); |
1730 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext); | 1743 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1887 #endif | 1900 #endif |
1888 } | 1901 } |
1889 | 1902 |
1890 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1903 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1891 // We always return a transient cache, so it is freed after each | 1904 // We always return a transient cache, so it is freed after each |
1892 // filter traversal. | 1905 // filter traversal. |
1893 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1906 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1894 } | 1907 } |
1895 | 1908 |
1896 #endif | 1909 #endif |
OLD | NEW |