Bug 1102048 - Make image/src files comply with the Mozilla Coding Style Guide. r=seth

This commit is contained in:
Glenn Randers-Pehrson 2014-12-05 15:58:00 -08:00
parent 219d9e1072
commit 86d650039c
5 changed files with 48 additions and 27 deletions

View File

@ -31,7 +31,8 @@ MOZ_END_ENUM_CLASS(Flip)
*/
struct Orientation
{
explicit Orientation(Angle aRotation = Angle::D0, Flip mFlip = Flip::Unflipped)
explicit Orientation(Angle aRotation = Angle::D0,
Flip mFlip = Flip::Unflipped)
: rotation(aRotation)
, flip(mFlip)
{ }

View File

@ -141,12 +141,13 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
gfxUtils::DrawPixelSnapped(ctx, drawable, size,
ImageRegion::Create(size),
surfaceFormat, GraphicsFilter::FILTER_FAST);
return target->Snapshot();
}
NS_IMETHODIMP
OrientedImage::GetImageContainer(LayerManager* aManager, ImageContainer** _retval)
OrientedImage::GetImageContainer(LayerManager* aManager,
ImageContainer** _retval)
{
// XXX(seth): We currently don't have a way of orienting the result of
// GetImageContainer. We work around this by always returning null, but if it
@ -168,7 +169,8 @@ struct MatrixBuilder
gfxMatrix Build() { return mMatrix; }
void Scale(gfxFloat aX, gfxFloat aY) {
void Scale(gfxFloat aX, gfxFloat aY)
{
if (mInvert) {
mMatrix *= gfxMatrix::Scaling(1.0 / aX, 1.0 / aY);
} else {
@ -176,7 +178,8 @@ struct MatrixBuilder
}
}
void Rotate(gfxFloat aPhi) {
void Rotate(gfxFloat aPhi)
{
if (mInvert) {
mMatrix *= gfxMatrix::Rotation(-aPhi);
} else {
@ -184,7 +187,8 @@ struct MatrixBuilder
}
}
void Translate(gfxPoint aDelta) {
void Translate(gfxPoint aDelta)
{
if (mInvert) {
mMatrix *= gfxMatrix::Translation(-aDelta);
} else {
@ -310,11 +314,13 @@ OrientedImage::Draw(gfxContext* aContext,
}
nsIntSize
OrientedImage::OptimalImageSizeForDest(const gfxSize& aDest, uint32_t aWhichFrame,
OrientedImage::OptimalImageSizeForDest(const gfxSize& aDest,
uint32_t aWhichFrame,
GraphicsFilter aFilter, uint32_t aFlags)
{
if (!mOrientation.SwapsWidthAndHeight()) {
return InnerImage()->OptimalImageSizeForDest(aDest, aWhichFrame, aFilter, aFlags);
return InnerImage()->OptimalImageSizeForDest(aDest, aWhichFrame, aFilter,
aFlags);
}
// Swap the size for the calculation, then swap it back for the caller.

View File

@ -45,12 +45,13 @@ public:
GraphicsFilter aFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) MOZ_OVERRIDE;
NS_IMETHOD_(nsIntRect) GetImageSpaceInvalidationRect(const nsIntRect& aRect) MOZ_OVERRIDE;
NS_IMETHOD_(nsIntRect) GetImageSpaceInvalidationRect(
const nsIntRect& aRect) MOZ_OVERRIDE;
nsIntSize OptimalImageSizeForDest(const gfxSize& aDest,
uint32_t aWhichFrame,
GraphicsFilter aFilter,
uint32_t aFlags) MOZ_OVERRIDE;
protected:
OrientedImage(Image* aImage, Orientation aOrientation)
: ImageWrapper(aImage)

View File

@ -107,7 +107,8 @@ ProgressTracker::ResetImage()
mImage = nullptr;
}
void ProgressTracker::SetIsMultipart()
void
ProgressTracker::SetIsMultipart()
{
if (mProgress & FLAG_IS_MULTIPART) {
return;
@ -218,9 +219,11 @@ ProgressTracker::Notify(imgRequestProxy* proxy)
nsRefPtr<ImageURL> uri(mImage->GetURI());
nsAutoCString spec;
uri->GetSpec(spec);
LOG_FUNC_WITH_PARAM(GetImgLog(), "ProgressTracker::Notify async", "uri", spec.get());
LOG_FUNC_WITH_PARAM(GetImgLog(),
"ProgressTracker::Notify async", "uri", spec.get());
} else {
LOG_FUNC_WITH_PARAM(GetImgLog(), "ProgressTracker::Notify async", "uri", "<unknown>");
LOG_FUNC_WITH_PARAM(GetImgLog(),
"ProgressTracker::Notify async", "uri", "<unknown>");
}
#endif
@ -283,7 +286,8 @@ ProgressTracker::NotifyCurrentState(imgRequestProxy* proxy)
proxy->GetURI(getter_AddRefs(uri));
nsAutoCString spec;
uri->GetSpec(spec);
LOG_FUNC_WITH_PARAM(GetImgLog(), "ProgressTracker::NotifyCurrentState", "uri", spec.get());
LOG_FUNC_WITH_PARAM(GetImgLog(),
"ProgressTracker::NotifyCurrentState", "uri", spec.get());
#endif
proxy->SetNotificationsDeferred(true);
@ -311,31 +315,38 @@ ProgressTracker::SyncNotifyInternal(ProxyArray& aProxies,
{
MOZ_ASSERT(NS_IsMainThread());
if (aProgress & FLAG_SIZE_AVAILABLE)
if (aProgress & FLAG_SIZE_AVAILABLE) {
NOTIFY_IMAGE_OBSERVERS(aProxies, OnSizeAvailable());
}
if (aProgress & FLAG_DECODE_STARTED)
if (aProgress & FLAG_DECODE_STARTED) {
NOTIFY_IMAGE_OBSERVERS(aProxies, OnStartDecode());
}
if (aProgress & FLAG_ONLOAD_BLOCKED)
if (aProgress & FLAG_ONLOAD_BLOCKED) {
NOTIFY_IMAGE_OBSERVERS(aProxies, BlockOnload());
}
if (aHasImage) {
// OnFrameUpdate
// If there's any content in this frame at all (always true for
// vector images, true for raster images that have decoded at
// least one frame) then send OnFrameUpdate.
if (!aDirtyRect.IsEmpty())
if (!aDirtyRect.IsEmpty()) {
NOTIFY_IMAGE_OBSERVERS(aProxies, OnFrameUpdate(&aDirtyRect));
}
if (aProgress & FLAG_FRAME_COMPLETE)
if (aProgress & FLAG_FRAME_COMPLETE) {
NOTIFY_IMAGE_OBSERVERS(aProxies, OnFrameComplete());
}
if (aProgress & FLAG_HAS_TRANSPARENCY)
if (aProgress & FLAG_HAS_TRANSPARENCY) {
NOTIFY_IMAGE_OBSERVERS(aProxies, OnImageHasTransparency());
}
if (aProgress & FLAG_IS_ANIMATED)
if (aProgress & FLAG_IS_ANIMATED) {
NOTIFY_IMAGE_OBSERVERS(aProxies, OnImageIsAnimated());
}
}
// Send UnblockOnload before OnStopDecode and OnStopRequest. This allows
@ -358,7 +369,8 @@ ProgressTracker::SyncNotifyInternal(ProxyArray& aProxies,
void
ProgressTracker::SyncNotifyProgress(Progress aProgress,
const nsIntRect& aInvalidRect /* = nsIntRect() */)
const nsIntRect& aInvalidRect
/* = nsIntRect() */)
{
MOZ_ASSERT(NS_IsMainThread(), "Use mConsumers on main thread only");
@ -390,7 +402,8 @@ ProgressTracker::SyncNotify(imgRequestProxy* proxy)
proxy->GetURI(getter_AddRefs(uri));
nsAutoCString spec;
uri->GetSpec(spec);
LOG_SCOPE_WITH_PARAM(GetImgLog(), "ProgressTracker::SyncNotify", "uri", spec.get());
LOG_SCOPE_WITH_PARAM(GetImgLog(),
"ProgressTracker::SyncNotify", "uri", spec.get());
#endif
nsIntRect r;

View File

@ -103,7 +103,7 @@ public:
// Get the current Progress.
Progress GetProgress() const { return mProgress; }
// Schedule an asynchronous "replaying" of all the notifications that would
// have to happen to put us in the current state.
// We will also take note of any notifications that happen between the time
@ -164,9 +164,9 @@ public:
return mConsumers.Length();
}
// This is intentionally non-general because its sole purpose is to support an
// some obscure network priority logic in imgRequest. That stuff could probably
// be improved, but it's too scary to mess with at the moment.
// This is intentionally non-general because its sole purpose is to support
// some obscure network priority logic in imgRequest. That stuff could
// probably be improved, but it's too scary to mess with at the moment.
bool FirstConsumerIs(imgRequestProxy* aConsumer);
void AdoptConsumers(ProgressTracker* aTracker) {