OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2012 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "GrFrameBufferObj.h" |
| 9 #include "GrFBBindableObj.h" |
| 10 |
| 11 void GrFrameBufferObj::setColor(GrFBBindableObj *buffer) { |
| 12 if (fColorBuffer) { |
| 13 // automatically break the binding of the old buffer |
| 14 GrAlwaysAssert(fColorBuffer->getColorBound(this)); |
| 15 fColorBuffer->resetColorBound(this); |
| 16 |
| 17 GrAlwaysAssert(!fColorBuffer->getDeleted()); |
| 18 fColorBuffer->unref(); |
| 19 } |
| 20 fColorBuffer = buffer; |
| 21 if (fColorBuffer) { |
| 22 GrAlwaysAssert(!fColorBuffer->getDeleted()); |
| 23 fColorBuffer->ref(); |
| 24 |
| 25 GrAlwaysAssert(!fColorBuffer->getColorBound(this)); |
| 26 fColorBuffer->setColorBound(this); |
| 27 } |
| 28 } |
| 29 |
| 30 void GrFrameBufferObj::setDepth(GrFBBindableObj *buffer) { |
| 31 if (fDepthBuffer) { |
| 32 // automatically break the binding of the old buffer |
| 33 GrAlwaysAssert(fDepthBuffer->getDepthBound(this)); |
| 34 fDepthBuffer->resetDepthBound(this); |
| 35 |
| 36 GrAlwaysAssert(!fDepthBuffer->getDeleted()); |
| 37 fDepthBuffer->unref(); |
| 38 } |
| 39 fDepthBuffer = buffer; |
| 40 if (fDepthBuffer) { |
| 41 GrAlwaysAssert(!fDepthBuffer->getDeleted()); |
| 42 fDepthBuffer->ref(); |
| 43 |
| 44 GrAlwaysAssert(!fDepthBuffer->getDepthBound(this)); |
| 45 fDepthBuffer->setDepthBound(this); |
| 46 } |
| 47 } |
| 48 |
| 49 void GrFrameBufferObj::setStencil(GrFBBindableObj *buffer) { |
| 50 if (fStencilBuffer) { |
| 51 // automatically break the binding of the old buffer |
| 52 GrAlwaysAssert(fStencilBuffer->getStencilBound(this)); |
| 53 fStencilBuffer->resetStencilBound(this); |
| 54 |
| 55 //GrAlwaysAssert(!fStencilBuffer->getDeleted()); |
| 56 fStencilBuffer->unref(); |
| 57 } |
| 58 fStencilBuffer = buffer; |
| 59 if (fStencilBuffer) { |
| 60 GrAlwaysAssert(!fStencilBuffer->getDeleted()); |
| 61 fStencilBuffer->ref(); |
| 62 |
| 63 GrAlwaysAssert(!fStencilBuffer->getStencilBound(this)); |
| 64 fStencilBuffer->setStencilBound(this); |
| 65 } |
| 66 } |
OLD | NEW |