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
This commit is contained in:
bsalomon@google.com 2011-11-05 14:51:01 +00:00
Родитель 9d6cfd80a0
Коммит 64c4fe4113
6 изменённых файлов: 24 добавлений и 22 удалений

Просмотреть файл

@ -376,7 +376,12 @@ struct GrTextureDesc {
* Format of source data of the texture. Not guaraunteed to be the same as
* internal format used by 3D API.
*/
GrPixelConfig fFormat;
// This union exists because WebKit uses the deprecated name fFormat. Once
// WebKit has been changed fFormat will be dropped.
union {
GrPixelConfig fFormat;
GrPixelConfig fConfig;
};
};
/**

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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;
};

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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(),