| 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 case kBuffer_GeometrySrcType: | 380 case kBuffer_GeometrySrcType: |
| 381 maxValidIndex = geoSrc.fIndexBuffer->sizeInBytes() / sizeof(uint
16_t); | 381 maxValidIndex = geoSrc.fIndexBuffer->sizeInBytes() / sizeof(uint
16_t); |
| 382 break; | 382 break; |
| 383 } | 383 } |
| 384 if (maxIndex > maxValidIndex) { | 384 if (maxIndex > maxValidIndex) { |
| 385 GrCrash("Index reads outside valid index range."); | 385 GrCrash("Index reads outside valid index range."); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 | 388 |
| 389 GrAssert(NULL != drawState.getRenderTarget()); | 389 GrAssert(NULL != drawState.getRenderTarget()); |
| 390 for (int s = 0; s < GrDrawState::kNumStages; ++s) { | 390 |
| 391 if (drawState.isStageEnabled(s)) { | 391 for (int s = 0; s < drawState.numColorStages(); ++s) { |
| 392 const GrEffectRef& effect = *drawState.getStage(s).getEffect(); | 392 const GrEffectRef& effect = *drawState.getColorStage(s).getEffect(); |
| 393 int numTextures = effect->numTextures(); | 393 int numTextures = effect->numTextures(); |
| 394 for (int t = 0; t < numTextures; ++t) { | 394 for (int t = 0; t < numTextures; ++t) { |
| 395 GrTexture* texture = effect->texture(t); | 395 GrTexture* texture = effect->texture(t); |
| 396 GrAssert(texture->asRenderTarget() != drawState.getRenderTarget(
)); | 396 GrAssert(texture->asRenderTarget() != drawState.getRenderTarget()); |
| 397 } | 397 } |
| 398 } |
| 399 for (int s = 0; s < drawState.numCoverageStages(); ++s) { |
| 400 const GrEffectRef& effect = *drawState.getCoverageStage(s).getEffect(); |
| 401 int numTextures = effect->numTextures(); |
| 402 for (int t = 0; t < numTextures; ++t) { |
| 403 GrTexture* texture = effect->texture(t); |
| 404 GrAssert(texture->asRenderTarget() != drawState.getRenderTarget()); |
| 398 } | 405 } |
| 399 } | 406 } |
| 400 | 407 |
| 401 GrAssert(drawState.validateVertexAttribs()); | 408 GrAssert(drawState.validateVertexAttribs()); |
| 402 #endif | 409 #endif |
| 403 if (NULL == drawState.getRenderTarget()) { | 410 if (NULL == drawState.getRenderTarget()) { |
| 404 return false; | 411 return false; |
| 405 } | 412 } |
| 406 return true; | 413 return true; |
| 407 } | 414 } |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 | 912 |
| 906 GrRenderTarget* rt = dst->asRenderTarget(); | 913 GrRenderTarget* rt = dst->asRenderTarget(); |
| 907 GrTexture* tex = src->asTexture(); | 914 GrTexture* tex = src->asTexture(); |
| 908 | 915 |
| 909 GrDrawTarget::AutoStateRestore asr(this, kReset_ASRInit); | 916 GrDrawTarget::AutoStateRestore asr(this, kReset_ASRInit); |
| 910 this->drawState()->setRenderTarget(rt); | 917 this->drawState()->setRenderTarget(rt); |
| 911 SkMatrix matrix; | 918 SkMatrix matrix; |
| 912 matrix.setTranslate(SkIntToScalar(srcRect.fLeft - dstPoint.fX), | 919 matrix.setTranslate(SkIntToScalar(srcRect.fLeft - dstPoint.fX), |
| 913 SkIntToScalar(srcRect.fTop - dstPoint.fY)); | 920 SkIntToScalar(srcRect.fTop - dstPoint.fY)); |
| 914 matrix.postIDiv(tex->width(), tex->height()); | 921 matrix.postIDiv(tex->width(), tex->height()); |
| 915 this->drawState()->createTextureEffect(0, tex, matrix); | 922 this->drawState()->addColorTextureEffect(tex, matrix); |
| 916 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, | 923 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, |
| 917 dstPoint.fY, | 924 dstPoint.fY, |
| 918 srcRect.width(), | 925 srcRect.width(), |
| 919 srcRect.height()); | 926 srcRect.height()); |
| 920 this->drawSimpleRect(dstRect); | 927 this->drawSimpleRect(dstRect); |
| 921 return true; | 928 return true; |
| 922 } | 929 } |
| 923 | 930 |
| 924 void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* d
esc) { | 931 void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* d
esc) { |
| 925 // Make the dst of the copy be a render target because the default copySurfa
ce draws to the dst. | 932 // Make the dst of the copy be a render target because the default copySurfa
ce draws to the dst. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); | 985 GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]
); |
| 979 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); | 986 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); |
| 980 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); | 987 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor
t]); |
| 981 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); | 988 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); |
| 982 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); | 989 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); |
| 983 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport])
; | 990 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport])
; |
| 984 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); | 991 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); |
| 985 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); | 992 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); |
| 986 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); | 993 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); |
| 987 } | 994 } |
| OLD | NEW |