| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 break; | 383 break; |
| 384 } | 384 } |
| 385 if (maxIndex > maxValidIndex) { | 385 if (maxIndex > maxValidIndex) { |
| 386 SkFAIL("Index reads outside valid index range."); | 386 SkFAIL("Index reads outside valid index range."); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 SkASSERT(drawState.getRenderTarget()); | 390 SkASSERT(drawState.getRenderTarget()); |
| 391 | 391 |
| 392 if (drawState.hasGeometryProcessor()) { | 392 if (drawState.hasGeometryProcessor()) { |
| 393 const GrEffect* effect = drawState.getGeometryProcessor()->getEffect(); | 393 const GrGeometryProcessor* gp = drawState.getGeometryProcessor()->getGeo
metryProcessor(); |
| 394 int numTextures = effect->numTextures(); | 394 int numTextures = gp->numTextures(); |
| 395 for (int t = 0; t < numTextures; ++t) { | 395 for (int t = 0; t < numTextures; ++t) { |
| 396 GrTexture* texture = effect->texture(t); | 396 GrTexture* texture = gp->texture(t); |
| 397 SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget()); | 397 SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget()); |
| 398 } | 398 } |
| 399 } | 399 } |
| 400 | 400 |
| 401 for (int s = 0; s < drawState.numColorStages(); ++s) { | 401 for (int s = 0; s < drawState.numColorStages(); ++s) { |
| 402 const GrEffect* effect = drawState.getColorStage(s).getEffect(); | 402 const GrProcessor* effect = drawState.getColorStage(s).getProcessor(); |
| 403 int numTextures = effect->numTextures(); | 403 int numTextures = effect->numTextures(); |
| 404 for (int t = 0; t < numTextures; ++t) { | 404 for (int t = 0; t < numTextures; ++t) { |
| 405 GrTexture* texture = effect->texture(t); | 405 GrTexture* texture = effect->texture(t); |
| 406 SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget()); | 406 SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget()); |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 for (int s = 0; s < drawState.numCoverageStages(); ++s) { | 409 for (int s = 0; s < drawState.numCoverageStages(); ++s) { |
| 410 const GrEffect* effect = drawState.getCoverageStage(s).getEffect(); | 410 const GrProcessor* effect = drawState.getCoverageStage(s).getProcessor()
; |
| 411 int numTextures = effect->numTextures(); | 411 int numTextures = effect->numTextures(); |
| 412 for (int t = 0; t < numTextures; ++t) { | 412 for (int t = 0; t < numTextures; ++t) { |
| 413 GrTexture* texture = effect->texture(t); | 413 GrTexture* texture = effect->texture(t); |
| 414 SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget()); | 414 SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget()); |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 SkASSERT(drawState.validateVertexAttribs()); | 418 SkASSERT(drawState.validateVertexAttribs()); |
| 419 #endif | 419 #endif |
| 420 if (NULL == drawState.getRenderTarget()) { | 420 if (NULL == drawState.getRenderTarget()) { |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 | 977 |
| 978 GrRenderTarget* rt = dst->asRenderTarget(); | 978 GrRenderTarget* rt = dst->asRenderTarget(); |
| 979 GrTexture* tex = src->asTexture(); | 979 GrTexture* tex = src->asTexture(); |
| 980 | 980 |
| 981 GrDrawTarget::AutoStateRestore asr(this, kReset_ASRInit); | 981 GrDrawTarget::AutoStateRestore asr(this, kReset_ASRInit); |
| 982 this->drawState()->setRenderTarget(rt); | 982 this->drawState()->setRenderTarget(rt); |
| 983 SkMatrix matrix; | 983 SkMatrix matrix; |
| 984 matrix.setTranslate(SkIntToScalar(srcRect.fLeft - dstPoint.fX), | 984 matrix.setTranslate(SkIntToScalar(srcRect.fLeft - dstPoint.fX), |
| 985 SkIntToScalar(srcRect.fTop - dstPoint.fY)); | 985 SkIntToScalar(srcRect.fTop - dstPoint.fY)); |
| 986 matrix.postIDiv(tex->width(), tex->height()); | 986 matrix.postIDiv(tex->width(), tex->height()); |
| 987 this->drawState()->addColorTextureEffect(tex, matrix); | 987 this->drawState()->addColorTextureProcessor(tex, matrix); |
| 988 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, | 988 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, |
| 989 dstPoint.fY, | 989 dstPoint.fY, |
| 990 srcRect.width(), | 990 srcRect.width(), |
| 991 srcRect.height()); | 991 srcRect.height()); |
| 992 this->drawSimpleRect(dstRect); | 992 this->drawSimpleRect(dstRect); |
| 993 return true; | 993 return true; |
| 994 } | 994 } |
| 995 | 995 |
| 996 void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* d
esc) { | 996 void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* d
esc) { |
| 997 // Make the dst of the copy be a render target because the default copySurfa
ce draws to the dst. | 997 // Make the dst of the copy be a render target because the default copySurfa
ce draws to the dst. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]); | 1140 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]); |
| 1141 | 1141 |
| 1142 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 1142 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
| 1143 r.appendf("%s is uploadable to a texture: %s\n", | 1143 r.appendf("%s is uploadable to a texture: %s\n", |
| 1144 kConfigNames[i], | 1144 kConfigNames[i], |
| 1145 gNY[fConfigTextureSupport[i]]); | 1145 gNY[fConfigTextureSupport[i]]); |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 return r; | 1148 return r; |
| 1149 } | 1149 } |
| OLD | NEW |