зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1297907 - Wrap long lines in nsPNGDecoder.cpp. r=tn
--HG-- extra : rebase_source : 01aba31d91a42a3afe30ea2ddc21118ae779ef79
This commit is contained in:
Родитель
863342e741
Коммит
d0f907ce9b
|
@ -190,7 +190,8 @@ nsPNGDecoder::CreateFrame(const FrameInfo& aFrameInfo)
|
|||
MOZ_ASSERT(!IsMetadataDecode());
|
||||
|
||||
// Check if we have transparency, and send notifications if needed.
|
||||
auto transparency = GetTransparencyType(aFrameInfo.mFormat, aFrameInfo.mFrameRect);
|
||||
auto transparency = GetTransparencyType(aFrameInfo.mFormat,
|
||||
aFrameInfo.mFrameRect);
|
||||
PostHasTransparencyIfNeeded(transparency);
|
||||
SurfaceFormat format = transparency == TransparencyType::eNone
|
||||
? SurfaceFormat::B8G8R8X8
|
||||
|
@ -686,13 +687,15 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||
#endif
|
||||
|
||||
if (decoder->IsMetadataDecode()) {
|
||||
// If we are animated then the first frame rect is either: 1) the whole image
|
||||
// if the IDAT chunk is part of the animation 2) the frame rect of the first
|
||||
// fDAT chunk otherwise. If we are not animated then we want to make sure to
|
||||
// call PostHasTransparency in the metadata decode if we need to. So it's okay
|
||||
// to pass IntRect(0, 0, width, height) here for animated images; they will
|
||||
// call with the proper first frame rect in the full decode.
|
||||
auto transparency = decoder->GetTransparencyType(decoder->format, frameRect);
|
||||
// If we are animated then the first frame rect is either:
|
||||
// 1) the whole image if the IDAT chunk is part of the animation
|
||||
// 2) the frame rect of the first fDAT chunk otherwise.
|
||||
// If we are not animated then we want to make sure to call
|
||||
// PostHasTransparency in the metadata decode if we need to. So it's
|
||||
// okay to pass IntRect(0, 0, width, height) here for animated images;
|
||||
// they will call with the proper first frame rect in the full decode.
|
||||
auto transparency = decoder->GetTransparencyType(decoder->format,
|
||||
frameRect);
|
||||
decoder->PostHasTransparencyIfNeeded(transparency);
|
||||
|
||||
// We have the metadata we're looking for, so stop here, before we allocate
|
||||
|
@ -757,7 +760,8 @@ static NextPixel<uint32_t>
|
|||
PackRGBPixelAndAdvance(uint8_t*& aRawPixelInOut)
|
||||
{
|
||||
const uint32_t pixel =
|
||||
gfxPackedPixel(0xFF, aRawPixelInOut[0], aRawPixelInOut[1], aRawPixelInOut[2]);
|
||||
gfxPackedPixel(0xFF, aRawPixelInOut[0], aRawPixelInOut[1],
|
||||
aRawPixelInOut[2]);
|
||||
aRawPixelInOut += 3;
|
||||
return AsVariant(pixel);
|
||||
}
|
||||
|
@ -831,7 +835,8 @@ nsPNGDecoder::row_callback(png_structp png_ptr, png_bytep new_row,
|
|||
decoder->mPass++;
|
||||
}
|
||||
|
||||
const png_uint_32 height = static_cast<png_uint_32>(decoder->mFrameRect.height);
|
||||
const png_uint_32 height =
|
||||
static_cast<png_uint_32>(decoder->mFrameRect.height);
|
||||
|
||||
if (row_num >= height) {
|
||||
// Bail if we receive extra rows. This is especially important because if we
|
||||
|
@ -936,7 +941,8 @@ nsPNGDecoder::DoYield(png_structp aPNGStruct)
|
|||
// the data that was passed to png_process_data() have not been consumed yet.
|
||||
// We use this information to tell StreamingLexer where to place us in the
|
||||
// input stream when we come back from the yield.
|
||||
png_size_t pendingBytes = png_process_data_pause(aPNGStruct, /* save = */ false);
|
||||
png_size_t pendingBytes = png_process_data_pause(aPNGStruct,
|
||||
/* save = */ false);
|
||||
|
||||
MOZ_ASSERT(pendingBytes < mLastChunkLength);
|
||||
size_t consumedBytes = mLastChunkLength - min(pendingBytes, mLastChunkLength);
|
||||
|
@ -978,10 +984,12 @@ nsPNGDecoder::frame_info_callback(png_structp png_ptr, png_uint_32 frame_num)
|
|||
|
||||
#ifndef MOZ_EMBEDDED_LIBPNG
|
||||
// if using system library, check frame_width and height against 0
|
||||
if (frameRect.width == 0)
|
||||
if (frameRect.width == 0) {
|
||||
png_error(png_ptr, "Frame width must not be 0");
|
||||
if (frameRect.height == 0)
|
||||
}
|
||||
if (frameRect.height == 0) {
|
||||
png_error(png_ptr, "Frame height must not be 0");
|
||||
}
|
||||
#endif
|
||||
|
||||
const FrameInfo info { decoder->format, frameRect, isInterlaced };
|
||||
|
@ -1068,7 +1076,7 @@ nsPNGDecoder::IsValidICO() const
|
|||
|
||||
// If there are errors in the call to png_get_IHDR, the error_callback in
|
||||
// nsPNGDecoder.cpp is called. In this error callback we do a longjmp, so
|
||||
// we need to save the jump buffer here. Oterwise we'll end up without a
|
||||
// we need to save the jump buffer here. Otherwise we'll end up without a
|
||||
// proper callstack.
|
||||
if (setjmp(png_jmpbuf(mPNG))) {
|
||||
// We got here from a longjmp call indirectly from png_get_IHDR
|
||||
|
|
Загрузка…
Ссылка в новой задаче