| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 | 1150 |
| 1151 uint32_t GrDrawTargetCaps::CreateUniqueID() { | 1151 uint32_t GrDrawTargetCaps::CreateUniqueID() { |
| 1152 static int32_t gUniqueID = SK_InvalidUniqueID; | 1152 static int32_t gUniqueID = SK_InvalidUniqueID; |
| 1153 uint32_t id; | 1153 uint32_t id; |
| 1154 do { | 1154 do { |
| 1155 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 1155 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
| 1156 } while (id == SK_InvalidUniqueID); | 1156 } while (id == SK_InvalidUniqueID); |
| 1157 return id; | 1157 return id; |
| 1158 } | 1158 } |
| 1159 | 1159 |
| OLD | NEW |