| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 "GrGpu.h" | 10 #include "GrGpu.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 SkASSERT(NULL != tex->asRenderTarget()); | 126 SkASSERT(NULL != tex->asRenderTarget()); |
| 127 // TODO: defer this and attach dynamically | 127 // TODO: defer this and attach dynamically |
| 128 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) { | 128 if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) { |
| 129 tex->unref(); | 129 tex->unref(); |
| 130 return NULL; | 130 return NULL; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 return tex; | 133 return tex; |
| 134 } | 134 } |
| 135 | 135 |
| 136 GrTexture* GrGpu::createCompressedTexture(const GrTextureDesc& desc, const void*
srcData) { |
| 137 if (kUnknown_GrPixelConfig == desc.fConfig || |
| 138 !GrPixelConfigIsCompressed(desc.fConfig)) { |
| 139 return NULL; |
| 140 } |
| 141 |
| 142 // We shouldn't be rendering into this |
| 143 if (desc.fFlags & kRenderTarget_GrTextureFlagBit) { |
| 144 return NULL; |
| 145 } |
| 146 |
| 147 // Do we support this format? |
| 148 if (!this->caps()->isConfigTexturable(desc.fConfig)) { |
| 149 return NULL; |
| 150 } |
| 151 |
| 152 this->handleDirtyContext(); |
| 153 return this->onCreateCompressedTexture(desc, srcData); |
| 154 } |
| 155 |
| 136 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { | 156 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { |
| 137 SkASSERT(NULL == rt->getStencilBuffer()); | 157 SkASSERT(NULL == rt->getStencilBuffer()); |
| 138 GrStencilBuffer* sb = | 158 GrStencilBuffer* sb = |
| 139 this->getContext()->findStencilBuffer(rt->width(), | 159 this->getContext()->findStencilBuffer(rt->width(), |
| 140 rt->height(), | 160 rt->height(), |
| 141 rt->numSamples()); | 161 rt->numSamples()); |
| 142 if (NULL != sb) { | 162 if (NULL != sb) { |
| 143 rt->setStencilBuffer(sb); | 163 rt->setStencilBuffer(sb); |
| 144 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); | 164 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); |
| 145 if (!attached) { | 165 if (!attached) { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 } | 570 } |
| 551 | 571 |
| 552 void GrGpu::releaseIndexArray() { | 572 void GrGpu::releaseIndexArray() { |
| 553 // if index source was array, we stowed data in the pool | 573 // if index source was array, we stowed data in the pool |
| 554 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 574 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| 555 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 575 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
| 556 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 576 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
| 557 fIndexPool->putBack(bytes); | 577 fIndexPool->putBack(bytes); |
| 558 --fIndexPoolUseCnt; | 578 --fIndexPoolUseCnt; |
| 559 } | 579 } |
| OLD | NEW |