Bug 1102048 (Part 09, Image) - Make image/src files comply with the Mozilla Coding Style Guide. r=seth

This commit is contained in:
Glenn Randers-Pehrson 2015-03-25 19:36:00 -07:00
parent e9092c97e8
commit e14eea766e
2 changed files with 25 additions and 23 deletions

View File

@ -21,51 +21,50 @@ ImageResource::ImageResource(ImageURL* aURI) :
mInitialized(false),
mAnimating(false),
mError(false)
{
}
{ }
// Translates a mimetype into a concrete decoder
Image::eDecoderType
Image::GetDecoderType(const char *aMimeType)
Image::GetDecoderType(const char* aMimeType)
{
// By default we don't know
eDecoderType rv = eDecoderType_unknown;
// PNG
if (!strcmp(aMimeType, IMAGE_PNG))
if (!strcmp(aMimeType, IMAGE_PNG)) {
rv = eDecoderType_png;
else if (!strcmp(aMimeType, IMAGE_X_PNG))
} else if (!strcmp(aMimeType, IMAGE_X_PNG)) {
rv = eDecoderType_png;
// GIF
else if (!strcmp(aMimeType, IMAGE_GIF))
} else if (!strcmp(aMimeType, IMAGE_GIF)) {
rv = eDecoderType_gif;
// JPEG
else if (!strcmp(aMimeType, IMAGE_JPEG))
} else if (!strcmp(aMimeType, IMAGE_JPEG)) {
rv = eDecoderType_jpeg;
else if (!strcmp(aMimeType, IMAGE_PJPEG))
} else if (!strcmp(aMimeType, IMAGE_PJPEG)) {
rv = eDecoderType_jpeg;
else if (!strcmp(aMimeType, IMAGE_JPG))
} else if (!strcmp(aMimeType, IMAGE_JPG)) {
rv = eDecoderType_jpeg;
// BMP
else if (!strcmp(aMimeType, IMAGE_BMP))
} else if (!strcmp(aMimeType, IMAGE_BMP)) {
rv = eDecoderType_bmp;
else if (!strcmp(aMimeType, IMAGE_BMP_MS))
} else if (!strcmp(aMimeType, IMAGE_BMP_MS)) {
rv = eDecoderType_bmp;
// ICO
else if (!strcmp(aMimeType, IMAGE_ICO))
} else if (!strcmp(aMimeType, IMAGE_ICO)) {
rv = eDecoderType_ico;
else if (!strcmp(aMimeType, IMAGE_ICO_MS))
} else if (!strcmp(aMimeType, IMAGE_ICO_MS)) {
rv = eDecoderType_ico;
// Icon
else if (!strcmp(aMimeType, IMAGE_ICON_MS))
} else if (!strcmp(aMimeType, IMAGE_ICON_MS)) {
rv = eDecoderType_icon;
}
return rv;
}
@ -83,15 +82,17 @@ ImageResource::DecrementAnimationConsumers()
{
MOZ_ASSERT(NS_IsMainThread(), "Main thread only to encourage serialization "
"with IncrementAnimationConsumers");
MOZ_ASSERT(mAnimationConsumers >= 1, "Invalid no. of animation consumers!");
MOZ_ASSERT(mAnimationConsumers >= 1,
"Invalid no. of animation consumers!");
mAnimationConsumers--;
}
nsresult
ImageResource::GetAnimationModeInternal(uint16_t* aAnimationMode)
{
if (mError)
if (mError) {
return NS_ERROR_FAILURE;
}
NS_ENSURE_ARG_POINTER(aAnimationMode);
@ -102,8 +103,9 @@ ImageResource::GetAnimationModeInternal(uint16_t* aAnimationMode)
nsresult
ImageResource::SetAnimationModeInternal(uint16_t aAnimationMode)
{
if (mError)
if (mError) {
return NS_ERROR_FAILURE;
}
NS_ASSERTION(aAnimationMode == kNormalAnimMode ||
aAnimationMode == kDontAnimMode ||

View File

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_IMAGELIB_IMAGE_H_
#define MOZILLA_IMAGELIB_IMAGE_H_
#ifndef mozilla_image_src_Image_h
#define mozilla_image_src_Image_h
#include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h"
@ -81,7 +81,7 @@ public:
* ensure that something reasonable is always returned.
*/
virtual size_t SizeOfSourceWithComputedFallback(
MallocSizeOf aMallocSizeOf) const = 0;
MallocSizeOf aMallocSizeOf) const = 0;
/**
* The size, in bytes, occupied by the image's decoded data.
@ -235,4 +235,4 @@ protected:
} // namespace image
} // namespace mozilla
#endif // MOZILLA_IMAGELIB_IMAGE_H_
#endif // mozilla_image_src_Image_h