OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "GrRenderTarget.h" | 10 #include "GrRenderTarget.h" |
11 | 11 |
12 #include "GrContext.h" | 12 #include "GrContext.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
14 #include "GrRenderTargetPriv.h" | 14 #include "GrRenderTargetPriv.h" |
15 #include "GrStencilBuffer.h" | 15 #include "GrStencilAttachment.h" |
16 | 16 |
17 void GrRenderTarget::discard() { | 17 void GrRenderTarget::discard() { |
18 // go through context so that all necessary flushing occurs | 18 // go through context so that all necessary flushing occurs |
19 GrContext* context = this->getContext(); | 19 GrContext* context = this->getContext(); |
20 if (NULL == context) { | 20 if (NULL == context) { |
21 return; | 21 return; |
22 } | 22 } |
23 context->discardRenderTarget(this); | 23 context->discardRenderTarget(this); |
24 } | 24 } |
25 | 25 |
(...skipping 15 matching lines...) Expand all Loading... |
41 if (fResolveRect.isEmpty()) { | 41 if (fResolveRect.isEmpty()) { |
42 fResolveRect.setLargestInverted(); | 42 fResolveRect.setLargestInverted(); |
43 } else { | 43 } else { |
44 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { | 44 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { |
45 fResolveRect.setLargestInverted(); | 45 fResolveRect.setLargestInverted(); |
46 } | 46 } |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 void GrRenderTarget::onRelease() { | 50 void GrRenderTarget::onRelease() { |
51 this->renderTargetPriv().didAttachStencilBuffer(NULL); | 51 this->renderTargetPriv().didAttachStencilAttachment(NULL); |
52 | 52 |
53 INHERITED::onRelease(); | 53 INHERITED::onRelease(); |
54 } | 54 } |
55 | 55 |
56 void GrRenderTarget::onAbandon() { | 56 void GrRenderTarget::onAbandon() { |
57 this->renderTargetPriv().didAttachStencilBuffer(NULL); | 57 this->renderTargetPriv().didAttachStencilAttachment(NULL); |
58 | 58 |
59 INHERITED::onAbandon(); | 59 INHERITED::onAbandon(); |
60 } | 60 } |
61 | 61 |
62 /////////////////////////////////////////////////////////////////////////////// | 62 /////////////////////////////////////////////////////////////////////////////// |
63 | 63 |
64 void GrRenderTargetPriv::didAttachStencilBuffer(GrStencilBuffer* stencilBuffer)
{ | 64 void GrRenderTargetPriv::didAttachStencilAttachment(GrStencilAttachment* stencil
Attachment) { |
65 SkRefCnt_SafeAssign(fRenderTarget->fStencilBuffer, stencilBuffer); | 65 SkRefCnt_SafeAssign(fRenderTarget->fStencilAttachment, stencilAttachment); |
66 } | 66 } |
67 | 67 |
68 GrStencilBuffer* GrRenderTargetPriv::attachStencilBuffer() const { | 68 GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() const { |
69 if (fRenderTarget->fStencilBuffer) { | 69 if (fRenderTarget->fStencilAttachment) { |
70 return fRenderTarget->fStencilBuffer; | 70 return fRenderTarget->fStencilAttachment; |
71 } | 71 } |
72 if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttach
ment()) { | 72 if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttach
ment()) { |
73 fRenderTarget->getGpu()->attachStencilBufferToRenderTarget(fRenderTarget
); | 73 fRenderTarget->getGpu()->attachStencilAttachmentToRenderTarget(fRenderTa
rget); |
74 } | 74 } |
75 return fRenderTarget->fStencilBuffer; | 75 return fRenderTarget->fStencilAttachment; |
76 } | 76 } |
OLD | NEW |