| 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 "GrContext.h" | 8 #include "GrContext.h" |
| 9 #include "GrCaps.h" | 9 #include "GrCaps.h" |
| 10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 textureSize = (size_t) fDesc.fWidth * fDesc.fHeight * GrBytesPerPixel(fD
esc.fConfig); | 44 textureSize = (size_t) fDesc.fWidth * fDesc.fHeight * GrBytesPerPixel(fD
esc.fConfig); |
| 45 } | 45 } |
| 46 | 46 |
| 47 if (this->texturePriv().hasMipMaps()) { | 47 if (this->texturePriv().hasMipMaps()) { |
| 48 // We don't have to worry about the mipmaps being a different size than | 48 // We don't have to worry about the mipmaps being a different size than |
| 49 // we'd expect because we never change fDesc.fWidth/fHeight. | 49 // we'd expect because we never change fDesc.fWidth/fHeight. |
| 50 textureSize += textureSize/3; | 50 textureSize += textureSize/3; |
| 51 } | 51 } |
| 52 | 52 |
| 53 SkASSERT(!SkToBool(fDesc.fFlags & kRenderTarget_GrSurfaceFlag)); | 53 SkASSERT(!SkToBool(fDesc.fFlags & kRenderTarget_GrSurfaceFlag)); |
| 54 SkASSERT(textureSize <= WorseCaseSize(fDesc)); | 54 SkASSERT(textureSize <= WorstCaseSize(fDesc)); |
| 55 | 55 |
| 56 return textureSize; | 56 return textureSize; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void GrTexture::validateDesc() const { | 59 void GrTexture::validateDesc() const { |
| 60 if (this->asRenderTarget()) { | 60 if (this->asRenderTarget()) { |
| 61 // This texture has a render target | 61 // This texture has a render target |
| 62 SkASSERT(0 != (fDesc.fFlags & kRenderTarget_GrSurfaceFlag)); | 62 SkASSERT(0 != (fDesc.fFlags & kRenderTarget_GrSurfaceFlag)); |
| 63 SkASSERT(fDesc.fSampleCnt == this->asRenderTarget()->numColorSamples()); | 63 SkASSERT(fDesc.fSampleCnt == this->asRenderTarget()->numColorSamples()); |
| 64 } else { | 64 } else { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 SkASSERT(desc.fSampleCnt < (1 << 8)); | 119 SkASSERT(desc.fSampleCnt < (1 << 8)); |
| 120 SkASSERT(flags < (1 << 10)); | 120 SkASSERT(flags < (1 << 10)); |
| 121 SkASSERT(static_cast<int>(origin) < (1 << 8)); | 121 SkASSERT(static_cast<int>(origin) < (1 << 8)); |
| 122 | 122 |
| 123 GrScratchKey::Builder builder(key, kType, 3); | 123 GrScratchKey::Builder builder(key, kType, 3); |
| 124 builder[0] = desc.fWidth; | 124 builder[0] = desc.fWidth; |
| 125 builder[1] = desc.fHeight; | 125 builder[1] = desc.fHeight; |
| 126 builder[2] = desc.fConfig | (desc.fIsMipMapped << 5) | (desc.fSampleCnt << 6
) | (flags << 14) | 126 builder[2] = desc.fConfig | (desc.fIsMipMapped << 5) | (desc.fSampleCnt << 6
) | (flags << 14) |
| 127 | (origin << 24); | 127 | (origin << 24); |
| 128 } | 128 } |
| OLD | NEW |