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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 //////////////////////////////////////////////////////////////////////////////// | 71 //////////////////////////////////////////////////////////////////////////////// |
72 | 72 |
73 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, | 73 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
der, |
74 const GrProcOptInfo& colorPOI, | 74 const GrProcOptInfo& colorPOI, |
75 const GrProcOptInfo& coveragePOI, | 75 const GrProcOptInfo& coveragePOI, |
76 GrDeviceCoordTexture* dstCopy, | 76 GrDeviceCoordTexture* dstCopy, |
77 const SkRect* drawBounds) { | 77 const SkRect* drawBounds) { |
78 if (!pipelineBuilder.willXPNeedDstCopy(*this->caps(), colorPOI, coveragePOI)
) { | 78 if (!pipelineBuilder.willXPNeedDstCopy(*this->caps(), colorPOI, coveragePOI)
) { |
79 return true; | 79 return true; |
80 } | 80 } |
| 81 |
| 82 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); |
| 83 |
| 84 if (this->caps()->textureBarrierSupport()) { |
| 85 if (GrTexture* rtTex = rt->asTexture()) { |
| 86 // The render target is a texture, se we can read from it directly i
n the shader. The XP |
| 87 // will be responsible to detect this situation and request a textur
e barrier. |
| 88 dstCopy->setTexture(rtTex); |
| 89 dstCopy->setOffset(0, 0); |
| 90 return true; |
| 91 } |
| 92 } |
| 93 |
81 SkIRect copyRect; | 94 SkIRect copyRect; |
82 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); | |
83 pipelineBuilder.clip().getConservativeBounds(rt, ©Rect); | 95 pipelineBuilder.clip().getConservativeBounds(rt, ©Rect); |
84 | 96 |
85 if (drawBounds) { | 97 if (drawBounds) { |
86 SkIRect drawIBounds; | 98 SkIRect drawIBounds; |
87 drawBounds->roundOut(&drawIBounds); | 99 drawBounds->roundOut(&drawIBounds); |
88 if (!copyRect.intersect(drawIBounds)) { | 100 if (!copyRect.intersect(drawIBounds)) { |
89 #ifdef SK_DEBUG | 101 #ifdef SK_DEBUG |
90 SkDebugf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); | 102 SkDebugf("Missed an early reject. Bailing on draw from setupDstReadI
fNecessary.\n"); |
91 #endif | 103 #endif |
92 return false; | 104 return false; |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, | 768 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, |
757 GrPipelineBuilder::AutoRestoreStencil* ars, | 769 GrPipelineBuilder::AutoRestoreStencil* ars, |
758 GrScissorState* scissorState, | 770 GrScissorState* scissorState, |
759 const SkRect* devBounds) { | 771 const SkRect* devBounds) { |
760 return fClipMaskManager.setupClipping(pipelineBuilder, | 772 return fClipMaskManager.setupClipping(pipelineBuilder, |
761 arfp, | 773 arfp, |
762 ars, | 774 ars, |
763 scissorState, | 775 scissorState, |
764 devBounds); | 776 devBounds); |
765 } | 777 } |
OLD | NEW |