OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 | 9 |
10 | 10 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 int maxVertex = startVertex + vertexCount; | 355 int maxVertex = startVertex + vertexCount; |
356 int maxValidVertex; | 356 int maxValidVertex; |
357 switch (geoSrc.fVertexSrc) { | 357 switch (geoSrc.fVertexSrc) { |
358 case kNone_GeometrySrcType: | 358 case kNone_GeometrySrcType: |
359 GrCrash("Attempting to draw without vertex src."); | 359 GrCrash("Attempting to draw without vertex src."); |
360 case kReserved_GeometrySrcType: // fallthrough | 360 case kReserved_GeometrySrcType: // fallthrough |
361 case kArray_GeometrySrcType: | 361 case kArray_GeometrySrcType: |
362 maxValidVertex = geoSrc.fVertexCount; | 362 maxValidVertex = geoSrc.fVertexCount; |
363 break; | 363 break; |
364 case kBuffer_GeometrySrcType: | 364 case kBuffer_GeometrySrcType: |
365 maxValidVertex = geoSrc.fVertexBuffer->sizeInBytes() / geoSrc.fVerte
xSize; | 365 maxValidVertex = static_cast<int>(geoSrc.fVertexBuffer->sizeInBytes(
) / geoSrc.fVertexSize); |
366 break; | 366 break; |
367 } | 367 } |
368 if (maxVertex > maxValidVertex) { | 368 if (maxVertex > maxValidVertex) { |
369 GrCrash("Drawing outside valid vertex range."); | 369 GrCrash("Drawing outside valid vertex range."); |
370 } | 370 } |
371 if (indexCount > 0) { | 371 if (indexCount > 0) { |
372 int maxIndex = startIndex + indexCount; | 372 int maxIndex = startIndex + indexCount; |
373 int maxValidIndex; | 373 int maxValidIndex; |
374 switch (geoSrc.fIndexSrc) { | 374 switch (geoSrc.fIndexSrc) { |
375 case kNone_GeometrySrcType: | 375 case kNone_GeometrySrcType: |
376 GrCrash("Attempting to draw indexed geom without index src."); | 376 GrCrash("Attempting to draw indexed geom without index src."); |
377 case kReserved_GeometrySrcType: // fallthrough | 377 case kReserved_GeometrySrcType: // fallthrough |
378 case kArray_GeometrySrcType: | 378 case kArray_GeometrySrcType: |
379 maxValidIndex = geoSrc.fIndexCount; | 379 maxValidIndex = geoSrc.fIndexCount; |
380 break; | 380 break; |
381 case kBuffer_GeometrySrcType: | 381 case kBuffer_GeometrySrcType: |
382 maxValidIndex = geoSrc.fIndexBuffer->sizeInBytes() / sizeof(uint
16_t); | 382 maxValidIndex = static_cast<int>(geoSrc.fIndexBuffer->sizeInByte
s() / sizeof(uint16_t)); |
383 break; | 383 break; |
384 } | 384 } |
385 if (maxIndex > maxValidIndex) { | 385 if (maxIndex > maxValidIndex) { |
386 GrCrash("Index reads outside valid index range."); | 386 GrCrash("Index reads outside valid index range."); |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 SkASSERT(NULL != drawState.getRenderTarget()); | 390 SkASSERT(NULL != drawState.getRenderTarget()); |
391 | 391 |
392 for (int s = 0; s < drawState.numColorStages(); ++s) { | 392 for (int s = 0; s < drawState.numColorStages(); ++s) { |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); | 1044 GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); |
1045 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kConfigNames) == kGrPixelConfigCnt); | 1045 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kConfigNames) == kGrPixelConfigCnt); |
1046 | 1046 |
1047 SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig]); | 1047 SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig]); |
1048 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 1048 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
1049 if (i != kUnknown_GrPixelConfig) { | 1049 if (i != kUnknown_GrPixelConfig) { |
1050 GrPrintf("%s is renderable: %s\n", kConfigNames[i], gNY[fConfigRende
rSupport[i]]); | 1050 GrPrintf("%s is renderable: %s\n", kConfigNames[i], gNY[fConfigRende
rSupport[i]]); |
1051 } | 1051 } |
1052 } | 1052 } |
1053 } | 1053 } |
OLD | NEW |