Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: src/gpu/GrTexture.cpp

Issue 457333004: Consider index8 a compressed config. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 "GrTexture.h" 10 #include "GrTexture.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const bool sizeChanged = kNotAllocated_MipMapsStatus == fMipMapsStatus; 51 const bool sizeChanged = kNotAllocated_MipMapsStatus == fMipMapsStatus;
52 fMipMapsStatus = kValid_MipMapsStatus; 52 fMipMapsStatus = kValid_MipMapsStatus;
53 if (sizeChanged) { 53 if (sizeChanged) {
54 // This must not be called until after changing fMipMapsStatus. 54 // This must not be called until after changing fMipMapsStatus.
55 this->didChangeGpuMemorySize(); 55 this->didChangeGpuMemorySize();
56 } 56 }
57 } 57 }
58 } 58 }
59 59
60 size_t GrTexture::gpuMemorySize() const { 60 size_t GrTexture::gpuMemorySize() const {
61 size_t textureSize = (size_t) fDesc.fWidth * 61 size_t textureSize;
62 fDesc.fHeight *
63 GrBytesPerPixel(fDesc.fConfig);
64 62
65 if (GrPixelConfigIsCompressed(fDesc.fConfig)) { 63 if (GrPixelConfigIsCompressed(fDesc.fConfig)) {
66 textureSize = GrCompressedFormatDataSize(fDesc.fConfig, fDesc.fWidth, fD esc.fHeight); 64 textureSize = GrCompressedFormatDataSize(fDesc.fConfig, fDesc.fWidth, fD esc.fHeight);
65 } else {
66 textureSize = (size_t) fDesc.fWidth * fDesc.fHeight * GrBytesPerPixel(fD esc.fConfig);
67 } 67 }
68 68
69 if (this->impl()->hasMipMaps()) { 69 if (this->impl()->hasMipMaps()) {
70 // We don't have to worry about the mipmaps being a different size than 70 // We don't have to worry about the mipmaps being a different size than
71 // we'd expect because we never change fDesc.fWidth/fHeight. 71 // we'd expect because we never change fDesc.fWidth/fHeight.
72 textureSize *= 2; 72 textureSize *= 2;
73 } 73 }
74 return textureSize; 74 return textureSize;
75 } 75 }
76 76
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return GrResourceKey(cacheID, texture_resource_type(), 0); 235 return GrResourceKey(cacheID, texture_resource_type(), 0);
236 } 236 }
237 237
238 bool GrTextureImpl::NeedsResizing(const GrResourceKey& key) { 238 bool GrTextureImpl::NeedsResizing(const GrResourceKey& key) {
239 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); 239 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag);
240 } 240 }
241 241
242 bool GrTextureImpl::NeedsBilerp(const GrResourceKey& key) { 242 bool GrTextureImpl::NeedsBilerp(const GrResourceKey& key) {
243 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); 243 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag);
244 } 244 }
OLDNEW
« no previous file with comments | « include/gpu/GrTypes.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698