OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 | 10 |
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 fGpu->removeGpuTraceMarker(marker); | 1865 fGpu->removeGpuTraceMarker(marker); |
1866 if (fDrawBuffer) { | 1866 if (fDrawBuffer) { |
1867 fDrawBuffer->removeGpuTraceMarker(marker); | 1867 fDrawBuffer->removeGpuTraceMarker(marker); |
1868 } | 1868 } |
1869 } | 1869 } |
1870 | 1870 |
1871 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 1871 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
1872 | 1872 |
1873 #ifdef GR_TEST_UTILS | 1873 #ifdef GR_TEST_UTILS |
1874 | 1874 |
1875 BATCH_TEST_DEFINE(StrokeRect) { | 1875 BATCH_TEST_DEFINE(StrokeRectBatch) { |
1876 StrokeRectBatch::Geometry geometry; | 1876 StrokeRectBatch::Geometry geometry; |
1877 geometry.fViewMatrix = GrTest::TestMatrix(random); | 1877 geometry.fViewMatrix = GrTest::TestMatrix(random); |
1878 geometry.fColor = GrRandomColor(random); | 1878 geometry.fColor = GrRandomColor(random); |
1879 geometry.fRect = GrTest::TestRect(random); | 1879 geometry.fRect = GrTest::TestRect(random); |
1880 geometry.fStrokeWidth = random->nextBool() ? 0.0f : 1.0f; | 1880 geometry.fStrokeWidth = random->nextBool() ? 0.0f : 1.0f; |
1881 | 1881 |
1882 return StrokeRectBatch::Create(geometry); | 1882 return StrokeRectBatch::Create(geometry); |
1883 } | 1883 } |
1884 | 1884 |
1885 static uint32_t seed_vertices(GrPrimitiveType type) { | 1885 static uint32_t seed_vertices(GrPrimitiveType type) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 if (hasColors) { | 1935 if (hasColors) { |
1936 colors->push_back(GrRandomColor(random)); | 1936 colors->push_back(GrRandomColor(random)); |
1937 } | 1937 } |
1938 if (hasIndices) { | 1938 if (hasIndices) { |
1939 SkASSERT(maxVertex <= SK_MaxU16); | 1939 SkASSERT(maxVertex <= SK_MaxU16); |
1940 indices->push_back(random->nextULessThan((uint16_t)maxVertex)); | 1940 indices->push_back(random->nextULessThan((uint16_t)maxVertex)); |
1941 } | 1941 } |
1942 } | 1942 } |
1943 } | 1943 } |
1944 | 1944 |
1945 BATCH_TEST_DEFINE(Vertices) { | 1945 BATCH_TEST_DEFINE(VerticesBatch) { |
1946 GrPrimitiveType type = GrPrimitiveType(random->nextULessThan(kLast_GrPrimiti
veType + 1)); | 1946 GrPrimitiveType type = GrPrimitiveType(random->nextULessThan(kLast_GrPrimiti
veType + 1)); |
1947 uint32_t primitiveCount = random->nextRangeU(1, 100); | 1947 uint32_t primitiveCount = random->nextRangeU(1, 100); |
1948 | 1948 |
1949 // TODO make 'sensible' indexbuffers | 1949 // TODO make 'sensible' indexbuffers |
1950 SkTArray<SkPoint> positions; | 1950 SkTArray<SkPoint> positions; |
1951 SkTArray<SkPoint> texCoords; | 1951 SkTArray<SkPoint> texCoords; |
1952 SkTArray<GrColor> colors; | 1952 SkTArray<GrColor> colors; |
1953 SkTArray<uint16_t> indices; | 1953 SkTArray<uint16_t> indices; |
1954 | 1954 |
1955 bool hasTexCoords = random->nextBool(); | 1955 bool hasTexCoords = random->nextBool(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 geometry.fColor = GrRandomColor(random); | 1987 geometry.fColor = GrRandomColor(random); |
1988 return DrawVerticesBatch::Create(geometry, type, viewMatrix, | 1988 return DrawVerticesBatch::Create(geometry, type, viewMatrix, |
1989 positions.begin(), vertexCount, | 1989 positions.begin(), vertexCount, |
1990 indices.begin(), hasIndices ? vertexCount :
0, | 1990 indices.begin(), hasIndices ? vertexCount :
0, |
1991 colors.begin(), | 1991 colors.begin(), |
1992 texCoords.begin(), | 1992 texCoords.begin(), |
1993 bounds); | 1993 bounds); |
1994 } | 1994 } |
1995 | 1995 |
1996 #endif | 1996 #endif |
OLD | NEW |