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, |
| 137 const void* srcData, GrCompressedForma
t format) { |
| 138 if (kUnknown_GrPixelConfig == desc.fConfig) { |
| 139 return NULL; |
| 140 } |
| 141 if (desc.fFlags & kRenderTarget_GrTextureFlagBit) { |
| 142 return NULL; |
| 143 } |
| 144 |
| 145 // Do we support this format? |
| 146 if (!this->caps()->compressedTextureSupport(format)) { |
| 147 return NULL; |
| 148 } |
| 149 |
| 150 this->handleDirtyContext(); |
| 151 return this->onCreateCompressedTexture(desc, srcData, format); |
| 152 } |
| 153 |
136 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { | 154 bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { |
137 SkASSERT(NULL == rt->getStencilBuffer()); | 155 SkASSERT(NULL == rt->getStencilBuffer()); |
138 GrStencilBuffer* sb = | 156 GrStencilBuffer* sb = |
139 this->getContext()->findStencilBuffer(rt->width(), | 157 this->getContext()->findStencilBuffer(rt->width(), |
140 rt->height(), | 158 rt->height(), |
141 rt->numSamples()); | 159 rt->numSamples()); |
142 if (NULL != sb) { | 160 if (NULL != sb) { |
143 rt->setStencilBuffer(sb); | 161 rt->setStencilBuffer(sb); |
144 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); | 162 bool attached = this->attachStencilBufferToRenderTarget(sb, rt); |
145 if (!attached) { | 163 if (!attached) { |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 568 } |
551 | 569 |
552 void GrGpu::releaseIndexArray() { | 570 void GrGpu::releaseIndexArray() { |
553 // if index source was array, we stowed data in the pool | 571 // if index source was array, we stowed data in the pool |
554 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 572 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
555 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 573 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
556 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 574 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
557 fIndexPool->putBack(bytes); | 575 fIndexPool->putBack(bytes); |
558 --fIndexPoolUseCnt; | 576 --fIndexPoolUseCnt; |
559 } | 577 } |
OLD | NEW |