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

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

Issue 22850006: Replace uses of GrAssert by SkASSERT. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrTextStrike_impl.h ('k') | src/gpu/GrTextureAccess.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (NULL == context) { 67 if (NULL == context) {
68 return; 68 return;
69 } 69 }
70 context->writeTexturePixels(this, 70 context->writeTexturePixels(this,
71 left, top, width, height, 71 left, top, width, height,
72 config, buffer, rowBytes, 72 config, buffer, rowBytes,
73 pixelOpsFlags); 73 pixelOpsFlags);
74 } 74 }
75 75
76 void GrTexture::onRelease() { 76 void GrTexture::onRelease() {
77 GrAssert(!this->isSetFlag((GrTextureFlags) kReturnToCache_FlagBit)); 77 SkASSERT(!this->isSetFlag((GrTextureFlags) kReturnToCache_FlagBit));
78 INHERITED::onRelease(); 78 INHERITED::onRelease();
79 } 79 }
80 80
81 void GrTexture::onAbandon() { 81 void GrTexture::onAbandon() {
82 if (NULL != fRenderTarget.get()) { 82 if (NULL != fRenderTarget.get()) {
83 fRenderTarget->abandon(); 83 fRenderTarget->abandon();
84 } 84 }
85 INHERITED::onAbandon(); 85 INHERITED::onAbandon();
86 } 86 }
87 87
88 void GrTexture::validateDesc() const { 88 void GrTexture::validateDesc() const {
89 if (NULL != this->asRenderTarget()) { 89 if (NULL != this->asRenderTarget()) {
90 // This texture has a render target 90 // This texture has a render target
91 GrAssert(0 != (fDesc.fFlags & kRenderTarget_GrTextureFlagBit)); 91 SkASSERT(0 != (fDesc.fFlags & kRenderTarget_GrTextureFlagBit));
92 92
93 if (NULL != this->asRenderTarget()->getStencilBuffer()) { 93 if (NULL != this->asRenderTarget()->getStencilBuffer()) {
94 GrAssert(0 != (fDesc.fFlags & kNoStencil_GrTextureFlagBit)); 94 SkASSERT(0 != (fDesc.fFlags & kNoStencil_GrTextureFlagBit));
95 } else { 95 } else {
96 GrAssert(0 == (fDesc.fFlags & kNoStencil_GrTextureFlagBit)); 96 SkASSERT(0 == (fDesc.fFlags & kNoStencil_GrTextureFlagBit));
97 } 97 }
98 98
99 GrAssert(fDesc.fSampleCnt == this->asRenderTarget()->numSamples()); 99 SkASSERT(fDesc.fSampleCnt == this->asRenderTarget()->numSamples());
100 } else { 100 } else {
101 GrAssert(0 == (fDesc.fFlags & kRenderTarget_GrTextureFlagBit)); 101 SkASSERT(0 == (fDesc.fFlags & kRenderTarget_GrTextureFlagBit));
102 GrAssert(0 == (fDesc.fFlags & kNoStencil_GrTextureFlagBit)); 102 SkASSERT(0 == (fDesc.fFlags & kNoStencil_GrTextureFlagBit));
103 GrAssert(0 == fDesc.fSampleCnt); 103 SkASSERT(0 == fDesc.fSampleCnt);
104 } 104 }
105 } 105 }
106 106
107 // These flags need to fit in a GrResourceKey::ResourceFlags so they can be fold ed into the texture 107 // These flags need to fit in a GrResourceKey::ResourceFlags so they can be fold ed into the texture
108 // key 108 // key
109 enum TextureFlags { 109 enum TextureFlags {
110 /** 110 /**
111 * The kStretchToPOT bit is set when the texture is NPOT and is being repeat ed but the 111 * The kStretchToPOT bit is set when the texture is NPOT and is being repeat ed but the
112 * hardware doesn't support that feature. 112 * hardware doesn't support that feature.
113 */ 113 */
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 const GrCacheID& cacheID) { 166 const GrCacheID& cacheID) {
167 GrResourceKey::ResourceFlags flags = get_texture_flags(gpu, params, desc); 167 GrResourceKey::ResourceFlags flags = get_texture_flags(gpu, params, desc);
168 return GrResourceKey(cacheID, texture_resource_type(), flags); 168 return GrResourceKey(cacheID, texture_resource_type(), flags);
169 } 169 }
170 170
171 GrResourceKey GrTexture::ComputeScratchKey(const GrTextureDesc& desc) { 171 GrResourceKey GrTexture::ComputeScratchKey(const GrTextureDesc& desc) {
172 GrCacheID::Key idKey; 172 GrCacheID::Key idKey;
173 // Instead of a client-provided key of the texture contents we create a key from the 173 // Instead of a client-provided key of the texture contents we create a key from the
174 // descriptor. 174 // descriptor.
175 GR_STATIC_ASSERT(sizeof(idKey) >= 16); 175 GR_STATIC_ASSERT(sizeof(idKey) >= 16);
176 GrAssert(desc.fHeight < (1 << 16)); 176 SkASSERT(desc.fHeight < (1 << 16));
177 GrAssert(desc.fWidth < (1 << 16)); 177 SkASSERT(desc.fWidth < (1 << 16));
178 idKey.fData32[0] = (desc.fWidth) | (desc.fHeight << 16); 178 idKey.fData32[0] = (desc.fWidth) | (desc.fHeight << 16);
179 idKey.fData32[1] = desc.fConfig | desc.fSampleCnt << 16; 179 idKey.fData32[1] = desc.fConfig | desc.fSampleCnt << 16;
180 idKey.fData32[2] = desc.fFlags; 180 idKey.fData32[2] = desc.fFlags;
181 idKey.fData32[3] = resolve_origin(desc); // Only needs 2 bits actually 181 idKey.fData32[3] = resolve_origin(desc); // Only needs 2 bits actually
182 static const int kPadSize = sizeof(idKey) - 16; 182 static const int kPadSize = sizeof(idKey) - 16;
183 GR_STATIC_ASSERT(kPadSize >= 0); 183 GR_STATIC_ASSERT(kPadSize >= 0);
184 memset(idKey.fData8 + 16, 0, kPadSize); 184 memset(idKey.fData8 + 16, 0, kPadSize);
185 185
186 GrCacheID cacheID(GrResourceKey::ScratchDomain(), idKey); 186 GrCacheID cacheID(GrResourceKey::ScratchDomain(), idKey);
187 return GrResourceKey(cacheID, texture_resource_type(), 0); 187 return GrResourceKey(cacheID, texture_resource_type(), 0);
188 } 188 }
189 189
190 bool GrTexture::NeedsResizing(const GrResourceKey& key) { 190 bool GrTexture::NeedsResizing(const GrResourceKey& key) {
191 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); 191 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag);
192 } 192 }
193 193
194 bool GrTexture::NeedsBilerp(const GrResourceKey& key) { 194 bool GrTexture::NeedsBilerp(const GrResourceKey& key) {
195 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); 195 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag);
196 } 196 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextStrike_impl.h ('k') | src/gpu/GrTextureAccess.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698