OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 size_t vertexStride = this->geometryProcessor()->getVertexStride(); | 69 size_t vertexStride = this->geometryProcessor()->getVertexStride(); |
70 | 70 |
71 const GrVertexBuffer* vertexBuffer; | 71 const GrVertexBuffer* vertexBuffer; |
72 int firstVertex; | 72 int firstVertex; |
73 | 73 |
74 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 74 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
75 kVertsPerCubic, | 75 kVertsPerCubic, |
76 &vertexBuffer, | 76 &vertexBuffer, |
77 &firstVertex); | 77 &firstVertex); |
78 | 78 |
| 79 if (!vertices || !batchTarget->quadIndexBuffer()) { |
| 80 SkDebugf("Could not allocate buffers\n"); |
| 81 return; |
| 82 } |
| 83 |
79 SkASSERT(vertexStride == sizeof(Vertex)); | 84 SkASSERT(vertexStride == sizeof(Vertex)); |
80 Vertex* verts = reinterpret_cast<Vertex*>(vertices); | 85 Vertex* verts = reinterpret_cast<Vertex*>(vertices); |
81 | 86 |
82 verts[0].fPosition.setRectFan(fGeometry.fBounds.fLeft, fGeometry.fBounds
.fTop, | 87 verts[0].fPosition.setRectFan(fGeometry.fBounds.fLeft, fGeometry.fBounds
.fTop, |
83 fGeometry.fBounds.fRight, fGeometry.fBound
s.fBottom, | 88 fGeometry.fBounds.fRight, fGeometry.fBound
s.fBottom, |
84 sizeof(Vertex)); | 89 sizeof(Vertex)); |
85 for (int v = 0; v < 4; ++v) { | 90 for (int v = 0; v < 4; ++v) { |
86 verts[v].fKLM[0] = eval_line(verts[v].fPosition, fKlmEqs + 0, fSign)
; | 91 verts[v].fKLM[0] = eval_line(verts[v].fPosition, fKlmEqs + 0, fSign)
; |
87 verts[v].fKLM[1] = eval_line(verts[v].fPosition, fKlmEqs + 3, fSign)
; | 92 verts[v].fKLM[1] = eval_line(verts[v].fPosition, fKlmEqs + 3, fSign)
; |
88 verts[v].fKLM[2] = eval_line(verts[v].fPosition, fKlmEqs + 6, 1.f); | 93 verts[v].fKLM[2] = eval_line(verts[v].fPosition, fKlmEqs + 6, 1.f); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 size_t vertexStride = this->geometryProcessor()->getVertexStride(); | 476 size_t vertexStride = this->geometryProcessor()->getVertexStride(); |
472 | 477 |
473 const GrVertexBuffer* vertexBuffer; | 478 const GrVertexBuffer* vertexBuffer; |
474 int firstVertex; | 479 int firstVertex; |
475 | 480 |
476 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 481 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
477 kVertsPerCubic, | 482 kVertsPerCubic, |
478 &vertexBuffer, | 483 &vertexBuffer, |
479 &firstVertex); | 484 &firstVertex); |
480 | 485 |
| 486 if (!vertices || !batchTarget->quadIndexBuffer()) { |
| 487 SkDebugf("Could not allocate buffers\n"); |
| 488 return; |
| 489 } |
| 490 |
481 SkASSERT(vertexStride == sizeof(Vertex)); | 491 SkASSERT(vertexStride == sizeof(Vertex)); |
482 Vertex* verts = reinterpret_cast<Vertex*>(vertices); | 492 Vertex* verts = reinterpret_cast<Vertex*>(vertices); |
483 | 493 |
484 verts[0].fPosition.setRectFan(fGeometry.fBounds.fLeft, fGeometry.fBounds
.fTop, | 494 verts[0].fPosition.setRectFan(fGeometry.fBounds.fLeft, fGeometry.fBounds
.fTop, |
485 fGeometry.fBounds.fRight, fGeometry.fBound
s.fBottom, | 495 fGeometry.fBounds.fRight, fGeometry.fBound
s.fBottom, |
486 sizeof(Vertex)); | 496 sizeof(Vertex)); |
487 | 497 |
488 fDevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); | 498 fDevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); |
489 | 499 |
490 | 500 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 typedef GM INHERITED; | 656 typedef GM INHERITED; |
647 }; | 657 }; |
648 | 658 |
649 DEF_GM( return SkNEW(BezierCubicEffects); ) | 659 DEF_GM( return SkNEW(BezierCubicEffects); ) |
650 DEF_GM( return SkNEW(BezierConicEffects); ) | 660 DEF_GM( return SkNEW(BezierConicEffects); ) |
651 DEF_GM( return SkNEW(BezierQuadEffects); ) | 661 DEF_GM( return SkNEW(BezierQuadEffects); ) |
652 | 662 |
653 } | 663 } |
654 | 664 |
655 #endif | 665 #endif |
OLD | NEW |