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 if (!context) { | 21 if (!context) { |
22 return; | 22 return; |
23 } | 23 } |
24 | 24 |
25 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext()); | 25 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(this)); |
26 if (!drawContext) { | 26 if (!drawContext) { |
27 return; | 27 return; |
28 } | 28 } |
29 | 29 |
30 drawContext->discard(this); | 30 drawContext->discard(); |
31 } | 31 } |
32 | 32 |
33 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { | 33 void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { |
34 if (kCanResolve_ResolveType == getResolveType()) { | 34 if (kCanResolve_ResolveType == getResolveType()) { |
35 if (rect) { | 35 if (rect) { |
36 fResolveRect.join(*rect); | 36 fResolveRect.join(*rect); |
37 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { | 37 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { |
38 fResolveRect.setEmpty(); | 38 fResolveRect.setEmpty(); |
39 } | 39 } |
40 } else { | 40 } else { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // we're not acctually adding one. | 74 // we're not acctually adding one. |
75 return true; | 75 return true; |
76 } | 76 } |
77 fRenderTarget->fStencilAttachment = stencil; | 77 fRenderTarget->fStencilAttachment = stencil; |
78 if (!fRenderTarget->completeStencilAttachment()) { | 78 if (!fRenderTarget->completeStencilAttachment()) { |
79 SkSafeSetNull(fRenderTarget->fStencilAttachment); | 79 SkSafeSetNull(fRenderTarget->fStencilAttachment); |
80 return false; | 80 return false; |
81 } | 81 } |
82 return true; | 82 return true; |
83 } | 83 } |
OLD | NEW |