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" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 void GrRenderTarget::resolve() { | 48 void GrRenderTarget::resolve() { |
49 // go through context so that all necessary flushing occurs | 49 // go through context so that all necessary flushing occurs |
50 GrContext* context = this->getContext(); | 50 GrContext* context = this->getContext(); |
51 if (NULL == context) { | 51 if (NULL == context) { |
52 return; | 52 return; |
53 } | 53 } |
54 context->resolveRenderTarget(this); | 54 context->resolveRenderTarget(this); |
55 } | 55 } |
56 | 56 |
| 57 void GrRenderTarget::discard() { |
| 58 // go through context so that all necessary flushing occurs |
| 59 GrContext* context = this->getContext(); |
| 60 if (NULL == context) { |
| 61 return; |
| 62 } |
| 63 context->discardRenderTarget(this); |
| 64 } |
| 65 |
57 size_t GrRenderTarget::sizeInBytes() const { | 66 size_t GrRenderTarget::sizeInBytes() const { |
58 size_t colorBits; | 67 size_t colorBits; |
59 if (kUnknown_GrPixelConfig == fDesc.fConfig) { | 68 if (kUnknown_GrPixelConfig == fDesc.fConfig) { |
60 colorBits = 32; // don't know, make a guess | 69 colorBits = 32; // don't know, make a guess |
61 } else { | 70 } else { |
62 colorBits = GrBytesPerPixel(fDesc.fConfig); | 71 colorBits = GrBytesPerPixel(fDesc.fConfig); |
63 } | 72 } |
64 uint64_t size = fDesc.fWidth; | 73 uint64_t size = fDesc.fWidth; |
65 size *= fDesc.fHeight; | 74 size *= fDesc.fHeight; |
66 size *= colorBits; | 75 size *= colorBits; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 this->setStencilBuffer(NULL); | 109 this->setStencilBuffer(NULL); |
101 | 110 |
102 INHERITED::onRelease(); | 111 INHERITED::onRelease(); |
103 } | 112 } |
104 | 113 |
105 void GrRenderTarget::onAbandon() { | 114 void GrRenderTarget::onAbandon() { |
106 this->setStencilBuffer(NULL); | 115 this->setStencilBuffer(NULL); |
107 | 116 |
108 INHERITED::onAbandon(); | 117 INHERITED::onAbandon(); |
109 } | 118 } |
OLD | NEW |