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 #include "GrDrawTarget.h" | 9 #include "GrDrawTarget.h" |
10 | 10 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } | 379 } |
380 | 380 |
381 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, | 381 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, |
382 const GrProcOptInfo& colorPOI, | 382 const GrProcOptInfo& colorPOI, |
383 const GrProcOptInfo& coveragePOI, | 383 const GrProcOptInfo& coveragePOI, |
384 GrDeviceCoordTexture* dstCopy, | 384 GrDeviceCoordTexture* dstCopy, |
385 const SkRect* drawBounds) { | 385 const SkRect* drawBounds) { |
386 if (!pipelineBuilder.willXPNeedDstCopy(*this->caps(), colorPOI, coveragePOI)
) { | 386 if (!pipelineBuilder.willXPNeedDstCopy(*this->caps(), colorPOI, coveragePOI)
) { |
387 return true; | 387 return true; |
388 } | 388 } |
| 389 |
| 390 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
| 391 |
| 392 if (this->caps()->textureBarrierSupport()) { |
| 393 if (GrTexture* rtTex = rt->asTexture()) { |
| 394 // The render target is a texture, se we can read from it directly i
n the shader. The XP |
| 395 // will be responsible to detect this situation and request a textur
e barrier. |
| 396 dstCopy->setTexture(rtTex); |
| 397 dstCopy->setOffset(0, 0); |
| 398 return true; |
| 399 } |
| 400 } |
| 401 |
389 SkIRect copyRect; | 402 SkIRect copyRect; |
390 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | |
391 pipelineBuilder.clip().getConservativeBounds(rt, ©Rect); | 403 pipelineBuilder.clip().getConservativeBounds(rt, ©Rect); |
392 | 404 |
393 if (drawBounds) { | 405 if (drawBounds) { |
394 SkIRect drawIBounds; | 406 SkIRect drawIBounds; |
395 drawBounds->roundOut(&drawIBounds); | 407 drawBounds->roundOut(&drawIBounds); |
396 if (!copyRect.intersect(drawIBounds)) { | 408 if (!copyRect.intersect(drawIBounds)) { |
397 #ifdef SK_DEBUG | 409 #ifdef SK_DEBUG |
398 SkDebugf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); | 410 SkDebugf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); |
399 #endif | 411 #endif |
400 return false; | 412 return false; |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, | 1275 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, |
1264 GrPipelineBuilder::AutoRestoreStencil* ars, | 1276 GrPipelineBuilder::AutoRestoreStencil* ars, |
1265 GrScissorState* scissorState, | 1277 GrScissorState* scissorState, |
1266 const SkRect* devBounds) { | 1278 const SkRect* devBounds) { |
1267 return fClipMaskManager.setupClipping(pipelineBuilder, | 1279 return fClipMaskManager.setupClipping(pipelineBuilder, |
1268 arfp, | 1280 arfp, |
1269 ars, | 1281 ars, |
1270 scissorState, | 1282 scissorState, |
1271 devBounds); | 1283 devBounds); |
1272 } | 1284 } |
OLD | NEW |