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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { | 118 !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
119 return NULL; | 119 return NULL; |
120 } | 120 } |
121 | 121 |
122 GrTexture *tex = NULL; | 122 GrTexture *tex = NULL; |
123 if (GrPixelConfigIsCompressed(desc.fConfig)) { | 123 if (GrPixelConfigIsCompressed(desc.fConfig)) { |
124 // We shouldn't be rendering into this | 124 // We shouldn't be rendering into this |
125 SkASSERT((desc.fFlags & kRenderTarget_GrTextureFlagBit) == 0); | 125 SkASSERT((desc.fFlags & kRenderTarget_GrTextureFlagBit) == 0); |
126 | 126 |
127 if (!this->caps()->npotTextureTileSupport() && | 127 if (!this->caps()->npotTextureTileSupport() && |
128 (!GrIsPow2(desc.fWidth) || !GrIsPow2(desc.fHeight))) { | 128 (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight))) { |
129 return NULL; | 129 return NULL; |
130 } | 130 } |
131 | 131 |
132 this->handleDirtyContext(); | 132 this->handleDirtyContext(); |
133 tex = this->onCreateCompressedTexture(desc, srcData); | 133 tex = this->onCreateCompressedTexture(desc, srcData); |
134 } else { | 134 } else { |
135 this->handleDirtyContext(); | 135 this->handleDirtyContext(); |
136 tex = this->onCreateTexture(desc, srcData, rowBytes); | 136 tex = this->onCreateTexture(desc, srcData, rowBytes); |
137 if (NULL != tex && | 137 if (NULL != tex && |
138 (kRenderTarget_GrTextureFlagBit & desc.fFlags) && | 138 (kRenderTarget_GrTextureFlagBit & desc.fFlags) && |
139 !(kNoStencil_GrTextureFlagBit & desc.fFlags)) { | 139 !(kNoStencil_GrTextureFlagBit & desc.fFlags)) { |
140 SkASSERT(NULL != tex->asRenderTarget()); | 140 SkASSERT(NULL != tex->asRenderTarget()); |
141 // TODO: defer this and attach dynamically | 141 // TODO: defer this and attach dynamically |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 } | 565 } |
566 | 566 |
567 void GrGpu::releaseIndexArray() { | 567 void GrGpu::releaseIndexArray() { |
568 // if index source was array, we stowed data in the pool | 568 // if index source was array, we stowed data in the pool |
569 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 569 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
570 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 570 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
571 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 571 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
572 fIndexPool->putBack(bytes); | 572 fIndexPool->putBack(bytes); |
573 --fIndexPoolUseCnt; | 573 --fIndexPoolUseCnt; |
574 } | 574 } |
OLD | NEW |