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

Unified Diff: src/gpu/GrTexture.cpp

Issue 275903002: Factor GrTexture into public GrTexture and private GrTextureImpl. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Move functions called by Chrome back to GrTexture Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/gl/GrGLTexture.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTexture.cpp
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 3186d89d77535cf734c2cc70319a2d0a21e5e892..8651d1090ec96529f08d19008f7eb8ae008e8fa7 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -26,13 +26,12 @@ GrTexture::~GrTexture() {
* textures back in the texture cache when their ref count goes to zero.
*/
void GrTexture::internal_dispose() const {
-
- if (this->isSetFlag((GrTextureFlags) kReturnToCache_FlagBit) &&
+ if (this->impl()->isSetFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit) &&
NULL != this->INHERITED::getContext()) {
GrTexture* nonConstThis = const_cast<GrTexture *>(this);
this->fRefCnt = 1; // restore ref count to initial setting
- nonConstThis->resetFlag((GrTextureFlags) kReturnToCache_FlagBit);
+ nonConstThis->impl()->resetFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit);
nonConstThis->INHERITED::getContext()->addExistingTextureToCache(nonConstThis);
// Note: "this" texture might be freed inside addExistingTextureToCache
@@ -44,7 +43,7 @@ void GrTexture::internal_dispose() const {
this->INHERITED::internal_dispose();
}
-void GrTexture::dirtyMipMaps(bool mipMapsDirty) {
+void GrTextureImpl::dirtyMipMaps(bool mipMapsDirty) {
if (mipMapsDirty) {
if (kValid_MipMapsStatus == fMipMapsStatus) {
fMipMapsStatus = kAllocated_MipMapsStatus;
@@ -63,7 +62,7 @@ size_t GrTexture::gpuMemorySize() const {
size_t textureSize = (size_t) fDesc.fWidth *
fDesc.fHeight *
GrBytesPerPixel(fDesc.fConfig);
- if (kNotAllocated_MipMapsStatus != fMipMapsStatus) {
+ if (this->impl()->hasMipMaps()) {
// We don't have to worry about the mipmaps being a different size than
// we'd expect because we never change fDesc.fWidth/fHeight.
textureSize *= 2;
@@ -100,7 +99,7 @@ void GrTexture::writePixels(int left, int top, int width, int height,
}
void GrTexture::onRelease() {
- SkASSERT(!this->isSetFlag((GrTextureFlags) kReturnToCache_FlagBit));
+ SkASSERT(!this->impl()->isSetFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit));
INHERITED::onRelease();
}
@@ -130,6 +129,8 @@ void GrTexture::validateDesc() const {
}
}
+//////////////////////////////////////////////////////////////////////////////
+
// These flags need to fit in a GrResourceKey::ResourceFlags so they can be folded into the texture
// key
enum TextureFlags {
@@ -186,7 +187,9 @@ GrSurfaceOrigin resolve_origin(const GrTextureDesc& desc) {
}
}
-GrResourceKey GrTexture::ComputeKey(const GrGpu* gpu,
+//////////////////////////////////////////////////////////////////////////////
+
+GrResourceKey GrTextureImpl::ComputeKey(const GrGpu* gpu,
const GrTextureParams* params,
const GrTextureDesc& desc,
const GrCacheID& cacheID) {
@@ -194,7 +197,7 @@ GrResourceKey GrTexture::ComputeKey(const GrGpu* gpu,
return GrResourceKey(cacheID, texture_resource_type(), flags);
}
-GrResourceKey GrTexture::ComputeScratchKey(const GrTextureDesc& desc) {
+GrResourceKey GrTextureImpl::ComputeScratchKey(const GrTextureDesc& desc) {
GrCacheID::Key idKey;
// Instead of a client-provided key of the texture contents we create a key from the
// descriptor.
@@ -213,10 +216,10 @@ GrResourceKey GrTexture::ComputeScratchKey(const GrTextureDesc& desc) {
return GrResourceKey(cacheID, texture_resource_type(), 0);
}
-bool GrTexture::NeedsResizing(const GrResourceKey& key) {
+bool GrTextureImpl::NeedsResizing(const GrResourceKey& key) {
return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag);
}
-bool GrTexture::NeedsBilerp(const GrResourceKey& key) {
+bool GrTextureImpl::NeedsBilerp(const GrResourceKey& key) {
return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag);
}
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/gl/GrGLTexture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698