| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrGLRenderTarget.h" | 8 #include "GrGLRenderTarget.h" |
| 9 | 9 |
| 10 #include "GrGLGpu.h" | 10 #include "GrGLGpu.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 colorValuesPerPixel += 1; | 45 colorValuesPerPixel += 1; |
| 46 } else if (fTexFBOID != 0) { | 46 } else if (fTexFBOID != 0) { |
| 47 // For auto-resolving FBOs, the MSAA buffer is free. | 47 // For auto-resolving FBOs, the MSAA buffer is free. |
| 48 colorValuesPerPixel = 1; | 48 colorValuesPerPixel = 1; |
| 49 } | 49 } |
| 50 SkASSERT(kUnknown_GrPixelConfig != fDesc.fConfig); | 50 SkASSERT(kUnknown_GrPixelConfig != fDesc.fConfig); |
| 51 SkASSERT(!GrPixelConfigIsCompressed(fDesc.fConfig)); | 51 SkASSERT(!GrPixelConfigIsCompressed(fDesc.fConfig)); |
| 52 size_t colorBytes = GrBytesPerPixel(fDesc.fConfig); | 52 size_t colorBytes = GrBytesPerPixel(fDesc.fConfig); |
| 53 SkASSERT(colorBytes > 0); | 53 SkASSERT(colorBytes > 0); |
| 54 fGpuMemorySize = colorValuesPerPixel * fDesc.fWidth * fDesc.fHeight * colorB
ytes; | 54 fGpuMemorySize = colorValuesPerPixel * fDesc.fWidth * fDesc.fHeight * colorB
ytes; |
| 55 |
| 56 SkASSERT(fGpuMemorySize <= WorseCaseSize(desc)); |
| 55 } | 57 } |
| 56 | 58 |
| 57 size_t GrGLRenderTarget::onGpuMemorySize() const { | 59 size_t GrGLRenderTarget::onGpuMemorySize() const { |
| 58 return fGpuMemorySize; | 60 return fGpuMemorySize; |
| 59 } | 61 } |
| 60 | 62 |
| 61 void GrGLRenderTarget::onRelease() { | 63 void GrGLRenderTarget::onRelease() { |
| 62 if (kBorrowed_LifeCycle != fRTLifecycle) { | 64 if (kBorrowed_LifeCycle != fRTLifecycle) { |
| 63 if (fTexFBOID) { | 65 if (fTexFBOID) { |
| 64 GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); | 66 GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 75 fMSColorRenderbufferID = 0; | 77 fMSColorRenderbufferID = 0; |
| 76 INHERITED::onRelease(); | 78 INHERITED::onRelease(); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void GrGLRenderTarget::onAbandon() { | 81 void GrGLRenderTarget::onAbandon() { |
| 80 fRTFBOID = 0; | 82 fRTFBOID = 0; |
| 81 fTexFBOID = 0; | 83 fTexFBOID = 0; |
| 82 fMSColorRenderbufferID = 0; | 84 fMSColorRenderbufferID = 0; |
| 83 INHERITED::onAbandon(); | 85 INHERITED::onAbandon(); |
| 84 } | 86 } |
| OLD | NEW |