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 "GrDrawContext.h" |
13 #include "GrGpu.h" | 14 #include "GrGpu.h" |
14 #include "GrRenderTargetPriv.h" | 15 #include "GrRenderTargetPriv.h" |
15 #include "GrStencilAttachment.h" | 16 #include "GrStencilAttachment.h" |
16 | 17 |
17 void GrRenderTarget::discard() { | 18 void GrRenderTarget::discard() { |
18 // go through context so that all necessary flushing occurs | 19 // go through context so that all necessary flushing occurs |
19 GrContext* context = this->getContext(); | 20 GrContext* context = this->getContext(); |
20 if (NULL == context) { | 21 GrDrawContext* drawContext = context ? context->drawContext() : NULL; |
| 22 if (!drawContext) { |
21 return; | 23 return; |
22 } | 24 } |
23 context->discardRenderTarget(this); | 25 |
| 26 drawContext->discard(this); |
24 } | 27 } |
25 | 28 |
26 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { | 29 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { |
27 if (kCanResolve_ResolveType == getResolveType()) { | 30 if (kCanResolve_ResolveType == getResolveType()) { |
28 if (rect) { | 31 if (rect) { |
29 fResolveRect.join(*rect); | 32 fResolveRect.join(*rect); |
30 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { | 33 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { |
31 fResolveRect.setEmpty(); | 34 fResolveRect.setEmpty(); |
32 } | 35 } |
33 } else { | 36 } else { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 70 |
68 GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() const { | 71 GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() const { |
69 if (fRenderTarget->fStencilAttachment) { | 72 if (fRenderTarget->fStencilAttachment) { |
70 return fRenderTarget->fStencilAttachment; | 73 return fRenderTarget->fStencilAttachment; |
71 } | 74 } |
72 if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttach
ment()) { | 75 if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttach
ment()) { |
73 fRenderTarget->getGpu()->attachStencilAttachmentToRenderTarget(fRenderTa
rget); | 76 fRenderTarget->getGpu()->attachStencilAttachmentToRenderTarget(fRenderTa
rget); |
74 } | 77 } |
75 return fRenderTarget->fStencilAttachment; | 78 return fRenderTarget->fStencilAttachment; |
76 } | 79 } |
OLD | NEW |