uint32_t -> int for texture extents
Review URL: http://codereview.appspot.com/4584053/ git-svn-id: http://skia.googlecode.com/svn/trunk@1574 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
5a23424b40
commit
79d2dbed5a
@ -141,10 +141,10 @@ public:
|
||||
};
|
||||
|
||||
struct GLTextureDesc {
|
||||
uint32_t fContentWidth;
|
||||
uint32_t fContentHeight;
|
||||
uint32_t fAllocWidth;
|
||||
uint32_t fAllocHeight;
|
||||
int fContentWidth;
|
||||
int fContentHeight;
|
||||
int fAllocWidth;
|
||||
int fAllocHeight;
|
||||
GrPixelConfig fFormat;
|
||||
GrGLuint fTextureID;
|
||||
bool fOwnsID;
|
||||
@ -165,10 +165,10 @@ public:
|
||||
virtual ~GrGLTexture() { this->release(); }
|
||||
|
||||
// overrides of GrTexture
|
||||
virtual void uploadTextureData(uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
virtual void uploadTextureData(int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
const void* srcData);
|
||||
virtual intptr_t getTextureHandle();
|
||||
|
||||
|
@ -208,10 +208,10 @@ public:
|
||||
* @param srcData width*height texels of data in same format that was used
|
||||
* at texture creation.
|
||||
*/
|
||||
virtual void uploadTextureData(uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
virtual void uploadTextureData(int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
const void* srcData) = 0;
|
||||
|
||||
/**
|
||||
|
@ -359,8 +359,8 @@ struct GrTextureDesc {
|
||||
* fFlags contains kRenderTarget_GrTextureFlag.
|
||||
*/
|
||||
GrAALevels fAALevel;
|
||||
uint32_t fWidth; //!< Width of the texture
|
||||
uint32_t fHeight; //!< Height of the texture
|
||||
int fWidth; //!< Width of the texture
|
||||
int fHeight; //!< Height of the texture
|
||||
/**
|
||||
* Format of source data of the texture. Not guaraunteed to be the same as
|
||||
* internal format used by 3D API.
|
||||
|
@ -153,10 +153,10 @@ void GrGLTexture::onAbandon() {
|
||||
}
|
||||
}
|
||||
|
||||
void GrGLTexture::uploadTextureData(uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
void GrGLTexture::uploadTextureData(int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
const void* srcData) {
|
||||
|
||||
GPUGL->setSpareTextureUnit();
|
||||
|
@ -770,7 +770,7 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
|
||||
size_t trimSize = desc.fHeight * trimRowBytes;
|
||||
const char* src = (const char*)srcData;
|
||||
char* dst = (char*)trimStorage.realloc(trimSize);
|
||||
for (uint32_t y = 0; y < desc.fHeight; y++) {
|
||||
for (int y = 0; y < desc.fHeight; y++) {
|
||||
memcpy(dst, src, trimRowBytes);
|
||||
src += rowBytes;
|
||||
dst += trimRowBytes;
|
||||
@ -786,19 +786,19 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
|
||||
glDesc.fAllocHeight = GrNextPow2(desc.fHeight);
|
||||
}
|
||||
|
||||
glDesc.fAllocWidth = GrMax<int>(fMinRenderTargetWidth,
|
||||
glDesc.fAllocWidth);
|
||||
glDesc.fAllocHeight = GrMax<int>(fMinRenderTargetHeight,
|
||||
glDesc.fAllocHeight);
|
||||
if ((int)glDesc.fAllocWidth > fMaxRenderTargetSize ||
|
||||
(int)glDesc.fAllocHeight > fMaxRenderTargetSize) {
|
||||
glDesc.fAllocWidth = GrMax(fMinRenderTargetWidth,
|
||||
glDesc.fAllocWidth);
|
||||
glDesc.fAllocHeight = GrMax(fMinRenderTargetHeight,
|
||||
glDesc.fAllocHeight);
|
||||
if (glDesc.fAllocWidth > fMaxRenderTargetSize ||
|
||||
glDesc.fAllocHeight > fMaxRenderTargetSize) {
|
||||
return return_null_texture();
|
||||
}
|
||||
} else if (!this->npotTextureSupport()) {
|
||||
glDesc.fAllocWidth = GrNextPow2(desc.fWidth);
|
||||
glDesc.fAllocHeight = GrNextPow2(desc.fHeight);
|
||||
if ((int)glDesc.fAllocWidth > fMaxTextureSize ||
|
||||
(int)glDesc.fAllocHeight > fMaxTextureSize) {
|
||||
if (glDesc.fAllocWidth > fMaxTextureSize ||
|
||||
glDesc.fAllocHeight > fMaxTextureSize) {
|
||||
return return_null_texture();
|
||||
}
|
||||
}
|
||||
@ -840,9 +840,9 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
|
||||
glDesc.fUploadType, srcData));
|
||||
GrGLRestoreResetRowLength();
|
||||
|
||||
uint32_t extraW = glDesc.fAllocWidth - desc.fWidth;
|
||||
uint32_t extraH = glDesc.fAllocHeight - desc.fHeight;
|
||||
uint32_t maxTexels = extraW * extraH;
|
||||
int extraW = glDesc.fAllocWidth - desc.fWidth;
|
||||
int extraH = glDesc.fAllocHeight - desc.fHeight;
|
||||
int maxTexels = extraW * extraH;
|
||||
maxTexels = GrMax(extraW * desc.fHeight, maxTexels);
|
||||
maxTexels = GrMax(desc.fWidth * extraH, maxTexels);
|
||||
|
||||
@ -854,7 +854,7 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
|
||||
(desc.fHeight - 1) * rowSize;
|
||||
uint8_t* extraRowStart = (uint8_t*)texels.get();
|
||||
|
||||
for (uint32_t i = 0; i < extraH; ++i) {
|
||||
for (int i = 0; i < extraH; ++i) {
|
||||
memcpy(extraRowStart, lastRowStart, rowSize);
|
||||
extraRowStart += rowSize;
|
||||
}
|
||||
@ -865,8 +865,8 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
|
||||
if (extraW) {
|
||||
uint8_t* edgeTexel = (uint8_t*)srcData + rowSize - glDesc.fUploadByteCount;
|
||||
uint8_t* extraTexel = (uint8_t*)texels.get();
|
||||
for (uint32_t j = 0; j < desc.fHeight; ++j) {
|
||||
for (uint32_t i = 0; i < extraW; ++i) {
|
||||
for (int j = 0; j < desc.fHeight; ++j) {
|
||||
for (int i = 0; i < extraW; ++i) {
|
||||
memcpy(extraTexel, edgeTexel, glDesc.fUploadByteCount);
|
||||
extraTexel += glDesc.fUploadByteCount;
|
||||
}
|
||||
@ -880,7 +880,7 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
|
||||
uint8_t* cornerTexel = (uint8_t*)srcData + desc.fHeight * rowSize
|
||||
- glDesc.fUploadByteCount;
|
||||
uint8_t* extraTexel = (uint8_t*)texels.get();
|
||||
for (uint32_t i = 0; i < extraW*extraH; ++i) {
|
||||
for (int i = 0; i < extraW*extraH; ++i) {
|
||||
memcpy(extraTexel, cornerTexel, glDesc.fUploadByteCount);
|
||||
extraTexel += glDesc.fUploadByteCount;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user