Keeping asserts in release.

We have a bug that is showing up occasionally in Canary.
I want to see if these asserts could provide insight into why the bug
happens.

BUG=643845
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2342903003

Review-Url: https://codereview.chromium.org/2342903003
This commit is contained in:
cblume 2016-09-16 10:07:32 -07:00 committed by Commit bot
parent faf8203ea7
commit 94ddf54a6d

View File

@ -583,7 +583,6 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
FILL_MEMBER(dtiBufferFiller, fColorTableCnt, &ctCount); FILL_MEMBER(dtiBufferFiller, fColorTableCnt, &ctCount);
FILL_MEMBER(dtiBufferFiller, fColorTableData, &ct); FILL_MEMBER(dtiBufferFiller, fColorTableData, &ct);
FILL_MEMBER(dtiBufferFiller, fMipMapLevelCount, &mipMapLevelCount); FILL_MEMBER(dtiBufferFiller, fMipMapLevelCount, &mipMapLevelCount);
// FILL_MEMBER(dtiBufferFiller, fMipMapLevelCount[0].fPixelData, &pixels);
memcpy(reinterpret_cast<void*>(bufferAsInt + memcpy(reinterpret_cast<void*>(bufferAsInt +
offsetof(DeferredTextureImage, fMipMapLevelData[0].fPixelData)), offsetof(DeferredTextureImage, fMipMapLevelData[0].fPixelData)),
&pixels, sizeof(pixels)); &pixels, sizeof(pixels));
@ -605,11 +604,11 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
} }
// Fill in the mipmap levels if they exist // Fill in the mipmap levels if they exist
intptr_t mipLevelPtr = bufferAsInt + pixelOffset + SkAlign8(pixmap.getSafeSize()); intptr_t mipLevelPtr = pixelsAsInt + SkAlign8(pixmap.getSafeSize());
if (useMipMaps) { if (useMipMaps) {
// offsetof, which we use below, requires the type have standard layout static_assert(std::is_standard_layout<MipMapLevelData>::value,
SkASSERT(std::is_standard_layout<MipMapLevelData>::value); "offsetof, which we use below, requires the type have a standard layout");
SkAutoTDelete<SkMipMap> mipmaps(SkMipMap::Build(pixmap, gammaTreatment, nullptr)); SkAutoTDelete<SkMipMap> mipmaps(SkMipMap::Build(pixmap, gammaTreatment, nullptr));
// SkMipMap holds only the mipmap levels it generates. // SkMipMap holds only the mipmap levels it generates.
@ -626,11 +625,11 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
mipmaps->getLevel(generatedMipLevelIndex, &mipLevel); mipmaps->getLevel(generatedMipLevelIndex, &mipLevel);
// Make sure the mipmap data is after the start of the buffer // Make sure the mipmap data is after the start of the buffer
SkASSERT(mipLevelPtr > bufferAsInt); SkASSERT_RELEASE(mipLevelPtr > bufferAsInt);
// Make sure the mipmap data starts before the end of the buffer // Make sure the mipmap data starts before the end of the buffer
SkASSERT(static_cast<size_t>(mipLevelPtr) < bufferAsInt + pixelOffset + pixelSize); SkASSERT_RELEASE(static_cast<size_t>(mipLevelPtr) < bufferAsInt + pixelOffset + pixelSize);
// Make sure the mipmap data ends before the end of the buffer // Make sure the mipmap data ends before the end of the buffer
SkASSERT(mipLevelPtr + mipLevel.fPixmap.getSafeSize() <= SkASSERT_RELEASE(mipLevelPtr + mipLevel.fPixmap.getSafeSize() <=
bufferAsInt + pixelOffset + pixelSize); bufferAsInt + pixelOffset + pixelSize);
// getSafeSize includes rowbyte padding except for the last row, // getSafeSize includes rowbyte padding except for the last row,