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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 } | 560 } |
561 | 561 |
562 const GrVertexBuffer* vertexBuffer; | 562 const GrVertexBuffer* vertexBuffer; |
563 int firstVertex; | 563 int firstVertex; |
564 | 564 |
565 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 565 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
566 vertexCount, | 566 vertexCount, |
567 &vertexBuffer, | 567 &vertexBuffer, |
568 &firstVertex); | 568 &firstVertex); |
569 | 569 |
| 570 if (!vertices) { |
| 571 SkDebugf("Could not allocate vertices\n"); |
| 572 return; |
| 573 } |
| 574 |
570 SkPoint* vertex = reinterpret_cast<SkPoint*>(vertices); | 575 SkPoint* vertex = reinterpret_cast<SkPoint*>(vertices); |
571 | 576 |
572 GrPrimitiveType primType; | 577 GrPrimitiveType primType; |
573 | 578 |
574 if (args.fStrokeWidth > 0) {; | 579 if (args.fStrokeWidth > 0) {; |
575 primType = kTriangleStrip_GrPrimitiveType; | 580 primType = kTriangleStrip_GrPrimitiveType; |
576 args.fRect.sort(); | 581 args.fRect.sort(); |
577 this->setStrokeRectStrip(vertex, args.fRect, args.fStrokeWidth); | 582 this->setStrokeRectStrip(vertex, args.fRect, args.fStrokeWidth); |
578 } else { | 583 } else { |
579 // hairline | 584 // hairline |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 int instanceCount = fGeoData.count(); | 898 int instanceCount = fGeoData.count(); |
894 | 899 |
895 const GrVertexBuffer* vertexBuffer; | 900 const GrVertexBuffer* vertexBuffer; |
896 int firstVertex; | 901 int firstVertex; |
897 | 902 |
898 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 903 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
899 this->vertexCount(
), | 904 this->vertexCount(
), |
900 &vertexBuffer, | 905 &vertexBuffer, |
901 &firstVertex); | 906 &firstVertex); |
902 | 907 |
| 908 if (!vertices) { |
| 909 SkDebugf("Could not allocate vertices\n"); |
| 910 return; |
| 911 } |
| 912 |
903 const GrIndexBuffer* indexBuffer; | 913 const GrIndexBuffer* indexBuffer; |
904 int firstIndex; | 914 int firstIndex; |
905 | 915 |
906 void* indices = NULL; | 916 void* indices = NULL; |
907 if (this->hasIndices()) { | 917 if (this->hasIndices()) { |
908 indices = batchTarget->indexPool()->makeSpace(this->indexCount(), | 918 indices = batchTarget->indexPool()->makeSpace(this->indexCount(), |
909 &indexBuffer, | 919 &indexBuffer, |
910 &firstIndex); | 920 &firstIndex); |
| 921 |
| 922 if (!indices) { |
| 923 SkDebugf("Could not allocate indices\n"); |
| 924 return; |
| 925 } |
911 } | 926 } |
912 | 927 |
913 int indexOffset = 0; | 928 int indexOffset = 0; |
914 int vertexOffset = 0; | 929 int vertexOffset = 0; |
915 for (int i = 0; i < instanceCount; i++) { | 930 for (int i = 0; i < instanceCount; i++) { |
916 const Geometry& args = fGeoData[i]; | 931 const Geometry& args = fGeoData[i]; |
917 | 932 |
918 // TODO we can actually cache this interleaved and then just memcopy | 933 // TODO we can actually cache this interleaved and then just memcopy |
919 if (this->hasIndices()) { | 934 if (this->hasIndices()) { |
920 for (int j = 0; j < args.fIndices.count(); ++j, ++indexOffset) { | 935 for (int j = 0; j < args.fIndices.count(); ++j, ++indexOffset) { |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 } | 1997 } |
1983 } | 1998 } |
1984 | 1999 |
1985 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 2000 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
1986 fGpu->removeGpuTraceMarker(marker); | 2001 fGpu->removeGpuTraceMarker(marker); |
1987 if (fDrawBuffer) { | 2002 if (fDrawBuffer) { |
1988 fDrawBuffer->removeGpuTraceMarker(marker); | 2003 fDrawBuffer->removeGpuTraceMarker(marker); |
1989 } | 2004 } |
1990 } | 2005 } |
1991 | 2006 |
OLD | NEW |