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 "GrDrawContext.h" |
14 #include "GrGpu.h" | 14 #include "GrGpu.h" |
15 #include "GrRenderTargetPriv.h" | 15 #include "GrRenderTargetPriv.h" |
16 #include "GrStencilAttachment.h" | 16 #include "GrStencilAttachment.h" |
17 | 17 |
18 void GrRenderTarget::discard() { | 18 void GrRenderTarget::discard() { |
19 // go through context so that all necessary flushing occurs | 19 // go through context so that all necessary flushing occurs |
20 GrContext* context = this->getContext(); | 20 GrContext* context = this->getContext(); |
21 GrDrawContext* drawContext = context ? context->drawContext() : nullptr; | 21 if (!context) { |
22 return; | |
23 } | |
24 | |
25 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext()); | |
22 if (!drawContext) { | 26 if (!drawContext) { |
jvanverth1
2015/09/01 14:43:37
Is this check still needed?
robertphillips
2015/09/01 14:49:04
Yep - the context could still be abandoned at this
| |
23 return; | 27 return; |
24 } | 28 } |
25 | 29 |
26 drawContext->discard(this); | 30 drawContext->discard(this); |
27 } | 31 } |
28 | 32 |
29 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { | 33 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { |
30 if (kCanResolve_ResolveType == getResolveType()) { | 34 if (kCanResolve_ResolveType == getResolveType()) { |
31 if (rect) { | 35 if (rect) { |
32 fResolveRect.join(*rect); | 36 fResolveRect.join(*rect); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 | 74 |
71 GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() const { | 75 GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() const { |
72 if (fRenderTarget->fStencilAttachment) { | 76 if (fRenderTarget->fStencilAttachment) { |
73 return fRenderTarget->fStencilAttachment; | 77 return fRenderTarget->fStencilAttachment; |
74 } | 78 } |
75 if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttach ment()) { | 79 if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttach ment()) { |
76 fRenderTarget->getGpu()->attachStencilAttachmentToRenderTarget(fRenderTa rget); | 80 fRenderTarget->getGpu()->attachStencilAttachmentToRenderTarget(fRenderTa rget); |
77 } | 81 } |
78 return fRenderTarget->fStencilAttachment; | 82 return fRenderTarget->fStencilAttachment; |
79 } | 83 } |
OLD | NEW |