OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 static const int kVertsPerRRect = 16; | 1376 static const int kVertsPerRRect = 16; |
1377 static const int kNumRRectsInIndexBuffer = 256; | 1377 static const int kNumRRectsInIndexBuffer = 256; |
1378 | 1378 |
1379 GR_DECLARE_STATIC_UNIQUE_KEY(gStrokeRRectOnlyIndexBufferKey); | 1379 GR_DECLARE_STATIC_UNIQUE_KEY(gStrokeRRectOnlyIndexBufferKey); |
1380 GR_DECLARE_STATIC_UNIQUE_KEY(gRRectOnlyIndexBufferKey); | 1380 GR_DECLARE_STATIC_UNIQUE_KEY(gRRectOnlyIndexBufferKey); |
1381 static const GrIndexBuffer* ref_rrect_index_buffer(bool strokeOnly, | 1381 static const GrIndexBuffer* ref_rrect_index_buffer(bool strokeOnly, |
1382 GrResourceProvider* resourceP
rovider) { | 1382 GrResourceProvider* resourceP
rovider) { |
1383 GR_DEFINE_STATIC_UNIQUE_KEY(gStrokeRRectOnlyIndexBufferKey); | 1383 GR_DEFINE_STATIC_UNIQUE_KEY(gStrokeRRectOnlyIndexBufferKey); |
1384 GR_DEFINE_STATIC_UNIQUE_KEY(gRRectOnlyIndexBufferKey); | 1384 GR_DEFINE_STATIC_UNIQUE_KEY(gRRectOnlyIndexBufferKey); |
1385 if (strokeOnly) { | 1385 if (strokeOnly) { |
1386 return resourceProvider->refOrCreateInstancedIndexBuffer( | 1386 return resourceProvider->findOrCreateInstancedIndexBuffer( |
1387 gRRectIndices, kIndicesPerStrokeRRect, kNumRRectsInIndexBuffer, kVer
tsPerRRect, | 1387 gRRectIndices, kIndicesPerStrokeRRect, kNumRRectsInIndexBuffer, kVer
tsPerRRect, |
1388 gStrokeRRectOnlyIndexBufferKey); | 1388 gStrokeRRectOnlyIndexBufferKey); |
1389 } else { | 1389 } else { |
1390 return resourceProvider->refOrCreateInstancedIndexBuffer( | 1390 return resourceProvider->findOrCreateInstancedIndexBuffer( |
1391 gRRectIndices, kIndicesPerRRect, kNumRRectsInIndexBuffer, kVertsPerR
Rect, | 1391 gRRectIndices, kIndicesPerRRect, kNumRRectsInIndexBuffer, kVertsPerR
Rect, |
1392 gRRectOnlyIndexBufferKey); | 1392 gRRectOnlyIndexBufferKey); |
1393 | 1393 |
1394 } | 1394 } |
1395 } | 1395 } |
1396 | 1396 |
1397 bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target, | 1397 bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target, |
1398 const GrPipelineBuilder& pipelineBuilder, | 1398 const GrPipelineBuilder& pipelineBuilder, |
1399 GrColor color, | 1399 GrColor color, |
1400 const SkMatrix& viewMatrix, | 1400 const SkMatrix& viewMatrix, |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 } | 2032 } |
2033 | 2033 |
2034 BATCH_TEST_DEFINE(RRectBatch) { | 2034 BATCH_TEST_DEFINE(RRectBatch) { |
2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
2036 GrColor color = GrRandomColor(random); | 2036 GrColor color = GrRandomColor(random); |
2037 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2037 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
2039 } | 2039 } |
2040 | 2040 |
2041 #endif | 2041 #endif |
OLD | NEW |