aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-05 14:51:01 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-05 14:51:01 +0000
commit64c4fe4113424bcfab8b3e0c7049887fda5ab4ff (patch)
tree4f40d3e3a2f5f328aa2bcb5e051a4c804873de00 /src
parent9d6cfd80a06e5efde1fc865c5e65c0ad27389a3f (diff)
More removal of texture fUploadByteCount and rename fFormat to fConfig for consistency.
git-svn-id: http://skia.googlecode.com/svn/trunk@2608 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrContext.cpp8
-rw-r--r--src/gpu/GrGLTexture.cpp4
-rw-r--r--src/gpu/GrGLTexture.h3
-rw-r--r--src/gpu/GrGpuGL.cpp22
-rw-r--r--src/gpu/SkGr.cpp2
5 files changed, 18 insertions, 21 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 3fc5d7d773..607ade8244 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -374,7 +374,7 @@ GrContext::TextureCacheEntry GrContext::createAndLockTexture(TextureKey key,
// no longer need to clamp at min RT size.
rtDesc.fWidth = GrNextPow2(desc.fWidth);
rtDesc.fHeight = GrNextPow2(desc.fHeight);
- int bpp = GrBytesPerPixel(desc.fFormat);
+ int bpp = GrBytesPerPixel(desc.fConfig);
SkAutoSMalloc<128*128*4> stretchedPixels(bpp *
rtDesc.fWidth *
rtDesc.fHeight);
@@ -408,7 +408,7 @@ inline void gen_scratch_tex_key_values(const GrGpu* gpu,
// we create a key of from the descriptor.
GrContext::TextureKey descKey = desc.fAALevel |
(desc.fFlags << 8) |
- ((uint64_t) desc.fFormat << 32);
+ ((uint64_t) desc.fConfig << 32);
// this code path isn't friendly to tiling with NPOT restricitons
// We just pass ClampNoFilter()
gen_texture_key_values(gpu, GrSamplerState::ClampNoFilter(), descKey,
@@ -428,7 +428,7 @@ GrContext::TextureCacheEntry GrContext::lockScratchTexture(
desc.fHeight = GrMax(MIN_SIZE, GrNextPow2(desc.fHeight));
}
- uint32_t p0 = desc.fFormat;
+ uint32_t p0 = desc.fConfig;
uint32_t p1 = (desc.fAALevel << 16) | desc.fFlags;
GrResourceEntry* entry;
@@ -710,7 +710,7 @@ bool GrContext::prepareForOffscreenAA(GrDrawTarget* target,
kNoStencil_GrTextureFlagBit;
}
- desc.fFormat = kRGBA_8888_GrPixelConfig;
+ desc.fConfig = kRGBA_8888_GrPixelConfig;
if (PREFER_MSAA_OFFSCREEN_AA && fGpu->getCaps().fFSAASupport) {
record->fDownsample = OffscreenRecord::kFSAA_Downsample;
diff --git a/src/gpu/GrGLTexture.cpp b/src/gpu/GrGLTexture.cpp
index 29c69b1358..7ff6588084 100644
--- a/src/gpu/GrGLTexture.cpp
+++ b/src/gpu/GrGLTexture.cpp
@@ -74,7 +74,7 @@ GrGLTexture::GrGLTexture(GrGpuGL* gpu,
textureDesc.fContentHeight,
textureDesc.fAllocWidth,
textureDesc.fAllocHeight,
- textureDesc.fFormat) {
+ textureDesc.fConfig) {
this->init(gpu, textureDesc, NULL, initialTexParams);
}
@@ -87,7 +87,7 @@ GrGLTexture::GrGLTexture(GrGpuGL* gpu,
textureDesc.fContentHeight,
textureDesc.fAllocWidth,
textureDesc.fAllocHeight,
- textureDesc.fFormat) {
+ textureDesc.fConfig) {
this->init(gpu, textureDesc, &rtDesc, initialTexParams);
}
diff --git a/src/gpu/GrGLTexture.h b/src/gpu/GrGLTexture.h
index 8c35430a69..49002af62a 100644
--- a/src/gpu/GrGLTexture.h
+++ b/src/gpu/GrGLTexture.h
@@ -64,11 +64,10 @@ public:
int fContentHeight;
int fAllocWidth;
int fAllocHeight;
- GrPixelConfig fFormat;
+ GrPixelConfig fConfig;
GrGLuint fTextureID;
bool fOwnsID;
GrGLenum fUploadFormat;
- GrGLenum fUploadByteCount;
GrGLenum fUploadType;
Orientation fOrientation;
};
diff --git a/src/gpu/GrGpuGL.cpp b/src/gpu/GrGpuGL.cpp
index cfacb402eb..1b06a4d588 100644
--- a/src/gpu/GrGpuGL.cpp
+++ b/src/gpu/GrGpuGL.cpp
@@ -687,7 +687,7 @@ GrResource* GrGpuGL::onCreatePlatformSurface(const GrPlatformSurfaceDesc& desc)
texDesc.fAllocWidth = texDesc.fContentWidth = desc.fWidth;
texDesc.fAllocHeight = texDesc.fContentHeight = desc.fHeight;
- texDesc.fFormat = desc.fConfig;
+ texDesc.fConfig = desc.fConfig;
texDesc.fOrientation = GrGLTexture::kBottomUp_Orientation;
texDesc.fTextureID = desc.fPlatformTexture;
texDesc.fOwnsID = false;
@@ -722,8 +722,8 @@ void GrGpuGL::allocateAndUploadTexData(const GrGLTexture::Desc& desc,
size_t rowBytes) {
// we assume the texture is bound
- size_t bpp = GrBytesPerPixel(desc.fFormat);
- size_t trimRowBytes = desc.fContentWidth * desc.fUploadByteCount;
+ size_t bpp = GrBytesPerPixel(desc.fConfig);
+ size_t trimRowBytes = desc.fContentWidth * bpp;
if (!rowBytes) {
rowBytes = trimRowBytes;
@@ -769,7 +769,7 @@ void GrGpuGL::allocateAndUploadTexData(const GrGLTexture::Desc& desc,
}
GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, static_cast<GrGLint>(bpp)));
- if (kIndex_8_GrPixelConfig == desc.fFormat &&
+ if (kIndex_8_GrPixelConfig == desc.fConfig &&
this->getCaps().f8BitPaletteSupport) {
// ES only supports CompressedTexImage2D, not CompressedTexSubimage2D
GrAssert(desc.fContentWidth == desc.fAllocWidth);
@@ -833,7 +833,7 @@ void GrGpuGL::allocateAndUploadTexData(const GrGLTexture::Desc& desc,
desc.fContentHeight * rowBytes - bpp;
uint8_t* extraTexel = (uint8_t*)texels.get();
for (int i = 0; i < extraW*extraH; ++i) {
- memcpy(extraTexel, cornerTexel, desc.fUploadByteCount);
+ memcpy(extraTexel, cornerTexel, bpp);
extraTexel += bpp;
}
GL_CALL(TexSubImage2D(GR_GL_TEXTURE_2D, 0, desc.fContentWidth,
@@ -967,17 +967,17 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
glTexDesc.fContentHeight = desc.fHeight;
glTexDesc.fAllocWidth = desc.fWidth;
glTexDesc.fAllocHeight = desc.fHeight;
- glTexDesc.fFormat = desc.fFormat;
+ glTexDesc.fConfig = desc.fConfig;
glTexDesc.fOwnsID = true;
glRTDesc.fMSColorRenderbufferID = 0;
glRTDesc.fRTFBOID = 0;
glRTDesc.fTexFBOID = 0;
glRTDesc.fOwnIDs = true;
- glRTDesc.fConfig = glTexDesc.fFormat;
+ glRTDesc.fConfig = glTexDesc.fConfig;
bool renderTarget = 0 != (desc.fFlags & kRenderTarget_GrTextureFlagBit);
- if (!canBeTexture(desc.fFormat,
+ if (!canBeTexture(desc.fConfig,
&internalFormat,
&glTexDesc.fUploadFormat,
&glTexDesc.fUploadType)) {
@@ -999,8 +999,6 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
GrPrintf("AA RT requested but not supported on this platform.");
}
- glTexDesc.fUploadByteCount = GrBytesPerPixel(desc.fFormat);
-
if (renderTarget) {
if (!caps.fNPOTRenderTargetSupport) {
glTexDesc.fAllocWidth = GrNextPow2(desc.fWidth);
@@ -1064,8 +1062,8 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
tex = new GrGLTexture(this, glTexDesc, DEFAULT_PARAMS);
}
#ifdef TRACE_TEXTURE_CREATION
- GrPrintf("--- new texture [%d] size=(%d %d) bpp=%d\n",
- tex->fTextureID, width, height, tex->fUploadByteCount);
+ GrPrintf("--- new texture [%d] size=(%d %d) config=%d\n",
+ glTexDesc.fTextureID, desc.fWidth, desc.fHeight, desc.fConfig);
#endif
return tex;
}
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 72a23a65cc..bbb55c8a83 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -111,7 +111,7 @@ GrContext::TextureCacheEntry sk_gr_create_bitmap_texture(GrContext* ctx,
}
}
- desc.fFormat = SkGr::Bitmap2PixelConfig(*bitmap);
+ desc.fConfig = SkGr::Bitmap2PixelConfig(*bitmap);
if (gUNCACHED_KEY != key) {
return ctx->createAndLockTexture(key, sampler, desc,
bitmap->getPixels(),