Bug 1351447 - Rename imagelib's DrawResult to ImgDrawResult r+tnikkel r=tnikkel

Renamed to imgDrawResult

MozReview-Commit-ID: 5ESSgIhhU41
This commit is contained in:
Samathy Barratt
2017-12-11 15:37:59 +00:00
parent 00c507d005
commit 6e82a231e6
60 changed files with 347 additions and 347 deletions

View File

@@ -5426,7 +5426,7 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
ImageRegion::Create(gfxRect(aSrc.x, aSrc.y, aSrc.width, aSrc.height)), ImageRegion::Create(gfxRect(aSrc.x, aSrc.y, aSrc.width, aSrc.height)),
aImage.mWhichFrame, SamplingFilter::GOOD, Some(svgContext), modifiedFlags, CurrentState().globalAlpha); aImage.mWhichFrame, SamplingFilter::GOOD, Some(svgContext), modifiedFlags, CurrentState().globalAlpha);
if (result != DrawResult::SUCCESS) { if (result != ImgDrawResult::SUCCESS) {
NS_WARNING("imgIContainer::Draw failed"); NS_WARNING("imgIContainer::Draw failed");
} }
} }

View File

@@ -43,7 +43,7 @@ public:
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
float aFrame, float aFrame,
uint32_t aFlags, uint32_t aFlags,
DrawResult aDrawResult) ImgDrawResult aDrawResult)
: mSurface(aSurface) : mSurface(aSurface)
, mSize(aSize) , mSize(aSize)
, mSVGContext(aSVGContext) , mSVGContext(aSVGContext)
@@ -71,15 +71,15 @@ public:
return surf.forget(); return surf.forget();
} }
DrawResult GetDrawResult() const ImgDrawResult GetDrawResult() const
{ {
return mDrawResult; return mDrawResult;
} }
bool NeedsRedraw() const bool NeedsRedraw() const
{ {
return mDrawResult != DrawResult::SUCCESS && return mDrawResult != ImgDrawResult::SUCCESS &&
mDrawResult != DrawResult::BAD_IMAGE; mDrawResult != ImgDrawResult::BAD_IMAGE;
} }
private: private:
@@ -88,7 +88,7 @@ private:
Maybe<SVGImageContext> mSVGContext; Maybe<SVGImageContext> mSVGContext;
const float mFrame; const float mFrame;
const uint32_t mFlags; const uint32_t mFlags;
const DrawResult mDrawResult; const ImgDrawResult mDrawResult;
}; };
class DrawSingleTileCallback : public gfxDrawingCallback class DrawSingleTileCallback : public gfxDrawingCallback
@@ -105,7 +105,7 @@ public:
, mSVGContext(aSVGContext) , mSVGContext(aSVGContext)
, mWhichFrame(aWhichFrame) , mWhichFrame(aWhichFrame)
, mFlags(aFlags) , mFlags(aFlags)
, mDrawResult(DrawResult::NOT_READY) , mDrawResult(ImgDrawResult::NOT_READY)
, mOpacity(aOpacity) , mOpacity(aOpacity)
{ {
MOZ_ASSERT(mImage, "Must have an image to clip"); MOZ_ASSERT(mImage, "Must have an image to clip");
@@ -130,7 +130,7 @@ public:
return true; return true;
} }
DrawResult GetDrawResult() { return mDrawResult; } ImgDrawResult GetDrawResult() { return mDrawResult; }
private: private:
RefPtr<ClippedImage> mImage; RefPtr<ClippedImage> mImage;
@@ -138,7 +138,7 @@ private:
const Maybe<SVGImageContext>& mSVGContext; const Maybe<SVGImageContext>& mSVGContext;
const uint32_t mWhichFrame; const uint32_t mWhichFrame;
const uint32_t mFlags; const uint32_t mFlags;
DrawResult mDrawResult; ImgDrawResult mDrawResult;
float mOpacity; float mOpacity;
}; };
@@ -260,7 +260,7 @@ NS_IMETHODIMP_(already_AddRefed<SourceSurface>)
ClippedImage::GetFrame(uint32_t aWhichFrame, ClippedImage::GetFrame(uint32_t aWhichFrame,
uint32_t aFlags) uint32_t aFlags)
{ {
DrawResult result; ImgDrawResult result;
RefPtr<SourceSurface> surface; RefPtr<SourceSurface> surface;
Tie(result, surface) = GetFrameInternal(mClip.Size(), Nothing(), aWhichFrame, aFlags, 1.0); Tie(result, surface) = GetFrameInternal(mClip.Size(), Nothing(), aWhichFrame, aFlags, 1.0);
return surface.forget(); return surface.forget();
@@ -276,7 +276,7 @@ ClippedImage::GetFrameAtSize(const IntSize& aSize,
return GetFrame(aWhichFrame, aFlags); return GetFrame(aWhichFrame, aFlags);
} }
Pair<DrawResult, RefPtr<SourceSurface>> Pair<ImgDrawResult, RefPtr<SourceSurface>>
ClippedImage::GetFrameInternal(const nsIntSize& aSize, ClippedImage::GetFrameInternal(const nsIntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame, uint32_t aWhichFrame,
@@ -285,7 +285,7 @@ ClippedImage::GetFrameInternal(const nsIntSize& aSize,
{ {
if (!ShouldClip()) { if (!ShouldClip()) {
RefPtr<SourceSurface> surface = InnerImage()->GetFrame(aWhichFrame, aFlags); RefPtr<SourceSurface> surface = InnerImage()->GetFrame(aWhichFrame, aFlags);
return MakePair(surface ? DrawResult::SUCCESS : DrawResult::NOT_READY, return MakePair(surface ? ImgDrawResult::SUCCESS : ImgDrawResult::NOT_READY,
Move(surface)); Move(surface));
} }
@@ -299,7 +299,7 @@ ClippedImage::GetFrameInternal(const nsIntSize& aSize,
SurfaceFormat::B8G8R8A8); SurfaceFormat::B8G8R8A8);
if (!target || !target->IsValid()) { if (!target || !target->IsValid()) {
NS_ERROR("Could not create a DrawTarget"); NS_ERROR("Could not create a DrawTarget");
return MakePair(DrawResult::TEMPORARY_ERROR, RefPtr<SourceSurface>()); return MakePair(ImgDrawResult::TEMPORARY_ERROR, RefPtr<SourceSurface>());
} }
RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(target); RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(target);
@@ -401,7 +401,7 @@ MustCreateSurface(gfxContext* aContext,
return willTile || willResample; return willTile || willResample;
} }
NS_IMETHODIMP_(DrawResult) NS_IMETHODIMP_(ImgDrawResult)
ClippedImage::Draw(gfxContext* aContext, ClippedImage::Draw(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,
@@ -421,12 +421,12 @@ ClippedImage::Draw(gfxContext* aContext,
if (MustCreateSurface(aContext, aSize, aRegion, aFlags)) { if (MustCreateSurface(aContext, aSize, aRegion, aFlags)) {
// Create a temporary surface containing a single tile of this image. // Create a temporary surface containing a single tile of this image.
// GetFrame will call DrawSingleTile internally. // GetFrame will call DrawSingleTile internally.
DrawResult result; ImgDrawResult result;
RefPtr<SourceSurface> surface; RefPtr<SourceSurface> surface;
Tie(result, surface) = Tie(result, surface) =
GetFrameInternal(aSize, aSVGContext, aWhichFrame, aFlags, aOpacity); GetFrameInternal(aSize, aSVGContext, aWhichFrame, aFlags, aOpacity);
if (!surface) { if (!surface) {
MOZ_ASSERT(result != DrawResult::SUCCESS); MOZ_ASSERT(result != ImgDrawResult::SUCCESS);
return result; return result;
} }
@@ -446,7 +446,7 @@ ClippedImage::Draw(gfxContext* aContext,
aSamplingFilter, aSVGContext, aFlags, aOpacity); aSamplingFilter, aSVGContext, aFlags, aOpacity);
} }
DrawResult ImgDrawResult
ClippedImage::DrawSingleTile(gfxContext* aContext, ClippedImage::DrawSingleTile(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,

View File

@@ -56,7 +56,7 @@ public:
const gfx::IntSize& aSize, const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) override; uint32_t aFlags) override;
NS_IMETHOD_(DrawResult) Draw(gfxContext* aContext, NS_IMETHOD_(ImgDrawResult) Draw(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,
uint32_t aWhichFrame, uint32_t aWhichFrame,
@@ -80,14 +80,14 @@ protected:
virtual ~ClippedImage(); virtual ~ClippedImage();
private: private:
Pair<DrawResult, RefPtr<SourceSurface>> Pair<ImgDrawResult, RefPtr<SourceSurface>>
GetFrameInternal(const nsIntSize& aSize, GetFrameInternal(const nsIntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame, uint32_t aWhichFrame,
uint32_t aFlags, uint32_t aFlags,
float aOpacity); float aOpacity);
bool ShouldClip(); bool ShouldClip();
DrawResult DrawSingleTile(gfxContext* aContext, ImgDrawResult DrawSingleTile(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,
uint32_t aWhichFrame, uint32_t aWhichFrame,

View File

@@ -205,7 +205,7 @@ DynamicImage::GetFrameAtSize(const IntSize& aSize,
aWhichFrame, SamplingFilter::POINT, Nothing(), aFlags, aWhichFrame, SamplingFilter::POINT, Nothing(), aFlags,
1.0); 1.0);
return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr; return result == ImgDrawResult::SUCCESS ? dt->Snapshot() : nullptr;
} }
NS_IMETHODIMP_(bool) NS_IMETHODIMP_(bool)
@@ -243,7 +243,7 @@ DynamicImage::GetImageContainerAtSize(LayerManager* aManager,
return nullptr; return nullptr;
} }
NS_IMETHODIMP_(DrawResult) NS_IMETHODIMP_(ImgDrawResult)
DynamicImage::Draw(gfxContext* aContext, DynamicImage::Draw(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,
@@ -261,7 +261,7 @@ DynamicImage::Draw(gfxContext* aContext,
gfxUtils::DrawPixelSnapped(aContext, mDrawable, SizeDouble(drawableSize), aRegion, gfxUtils::DrawPixelSnapped(aContext, mDrawable, SizeDouble(drawableSize), aRegion,
SurfaceFormat::B8G8R8A8, aSamplingFilter, SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity); aOpacity);
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
gfxSize scale(double(aSize.width) / drawableSize.width, gfxSize scale(double(aSize.width) / drawableSize.width,
@@ -276,7 +276,7 @@ DynamicImage::Draw(gfxContext* aContext,
gfxUtils::DrawPixelSnapped(aContext, mDrawable, SizeDouble(drawableSize), region, gfxUtils::DrawPixelSnapped(aContext, mDrawable, SizeDouble(drawableSize), region,
SurfaceFormat::B8G8R8A8, aSamplingFilter, SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity); aOpacity);
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -93,7 +93,7 @@ FrozenImage::GetImageContainerAtSize(layers::LayerManager* aManager,
return nullptr; return nullptr;
} }
NS_IMETHODIMP_(DrawResult) NS_IMETHODIMP_(ImgDrawResult)
FrozenImage::Draw(gfxContext* aContext, FrozenImage::Draw(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,

View File

@@ -55,7 +55,7 @@ public:
const gfx::IntSize& aSize, const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) override; uint32_t aFlags) override;
NS_IMETHOD_(DrawResult) Draw(gfxContext* aContext, NS_IMETHOD_(ImgDrawResult) Draw(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,
uint32_t aWhichFrame, uint32_t aWhichFrame,

View File

@@ -136,19 +136,19 @@ ImageResource::GetImageContainerImpl(LayerManager* aManager,
if (container) { if (container) {
switch (entry->mLastDrawResult) { switch (entry->mLastDrawResult) {
case DrawResult::SUCCESS: case ImgDrawResult::SUCCESS:
case DrawResult::BAD_IMAGE: case ImgDrawResult::BAD_IMAGE:
case DrawResult::BAD_ARGS: case ImgDrawResult::BAD_ARGS:
return container.forget(); return container.forget();
case DrawResult::NOT_READY: case ImgDrawResult::NOT_READY:
case DrawResult::INCOMPLETE: case ImgDrawResult::INCOMPLETE:
case DrawResult::TEMPORARY_ERROR: case ImgDrawResult::TEMPORARY_ERROR:
// Temporary conditions where we need to rerequest the frame to recover. // Temporary conditions where we need to rerequest the frame to recover.
break; break;
case DrawResult::WRONG_SIZE: case ImgDrawResult::WRONG_SIZE:
// Unused by GetFrameInternal // Unused by GetFrameInternal
default: default:
MOZ_ASSERT_UNREACHABLE("Unhandled DrawResult type!"); MOZ_ASSERT_UNREACHABLE("Unhandled ImgDrawResult type!");
return container.forget(); return container.forget();
} }
} }
@@ -157,7 +157,7 @@ ImageResource::GetImageContainerImpl(LayerManager* aManager,
NotifyDrawingObservers(); NotifyDrawingObservers();
#endif #endif
DrawResult drawResult; ImgDrawResult drawResult;
IntSize bestSize; IntSize bestSize;
RefPtr<SourceSurface> surface; RefPtr<SourceSurface> surface;
Tie(drawResult, bestSize, surface) = Tie(drawResult, bestSize, surface) =
@@ -193,17 +193,17 @@ ImageResource::GetImageContainerImpl(LayerManager* aManager,
container = entry->mContainer.get(); container = entry->mContainer.get();
if (container) { if (container) {
switch (entry->mLastDrawResult) { switch (entry->mLastDrawResult) {
case DrawResult::SUCCESS: case ImgDrawResult::SUCCESS:
case DrawResult::BAD_IMAGE: case ImgDrawResult::BAD_IMAGE:
case DrawResult::BAD_ARGS: case ImgDrawResult::BAD_ARGS:
return container.forget(); return container.forget();
case DrawResult::NOT_READY: case ImgDrawResult::NOT_READY:
case DrawResult::INCOMPLETE: case ImgDrawResult::INCOMPLETE:
case DrawResult::TEMPORARY_ERROR: case ImgDrawResult::TEMPORARY_ERROR:
// Temporary conditions where we need to rerequest the frame to // Temporary conditions where we need to rerequest the frame to
// recover. We have already done so! // recover. We have already done so!
break; break;
case DrawResult::WRONG_SIZE: case ImgDrawResult::WRONG_SIZE:
// Unused by GetFrameInternal // Unused by GetFrameInternal
default: default:
MOZ_ASSERT_UNREACHABLE("Unhandled DrawResult type!"); MOZ_ASSERT_UNREACHABLE("Unhandled DrawResult type!");

View File

@@ -337,13 +337,13 @@ protected:
bool mAnimating:1; // Are we currently animating? bool mAnimating:1; // Are we currently animating?
bool mError:1; // Error handling bool mError:1; // Error handling
virtual Tuple<DrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>> virtual Tuple<ImgDrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>>
GetFrameInternal(const gfx::IntSize& aSize, GetFrameInternal(const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame, uint32_t aWhichFrame,
uint32_t aFlags) uint32_t aFlags)
{ {
return MakeTuple(DrawResult::BAD_IMAGE, aSize, return MakeTuple(ImgDrawResult::BAD_IMAGE, aSize,
RefPtr<gfx::SourceSurface>()); RefPtr<gfx::SourceSurface>());
} }
@@ -383,7 +383,7 @@ private:
: mSize(aSize) : mSize(aSize)
, mSVGContext(aSVGContext) , mSVGContext(aSVGContext)
, mContainer(aContainer) , mContainer(aContainer)
, mLastDrawResult(DrawResult::NOT_READY) , mLastDrawResult(ImgDrawResult::NOT_READY)
, mFlags(aFlags) , mFlags(aFlags)
{ } { }
@@ -392,9 +392,9 @@ private:
// A weak pointer to our ImageContainer, which stays alive only as long as // A weak pointer to our ImageContainer, which stays alive only as long as
// the layer system needs it. // the layer system needs it.
WeakPtr<layers::ImageContainer> mContainer; WeakPtr<layers::ImageContainer> mContainer;
// If mContainer is non-null, this contains the DrawResult we obtained // If mContainer is non-null, this contains the ImgDrawResult we obtained
// the last time we updated it. // the last time we updated it.
DrawResult mLastDrawResult; ImgDrawResult mLastDrawResult;
// Cached flags to use for decoding. FLAG_ASYNC_NOTIFY should always be set // Cached flags to use for decoding. FLAG_ASYNC_NOTIFY should always be set
// but FLAG_HIGH_QUALITY_SCALING may vary. // but FLAG_HIGH_QUALITY_SCALING may vary.
uint32_t mFlags; uint32_t mFlags;

View File

@@ -232,7 +232,7 @@ ImageWrapper::GetImageContainerAtSize(LayerManager* aManager,
aSVGContext, aFlags); aSVGContext, aFlags);
} }
NS_IMETHODIMP_(DrawResult) NS_IMETHODIMP_(ImgDrawResult)
ImageWrapper::Draw(gfxContext* aContext, ImageWrapper::Draw(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,

View File

@@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_image_DrawResult_h #ifndef mozilla_image_ImgDrawResult_h
#define mozilla_image_DrawResult_h #define mozilla_image_ImgDrawResult_h
#include <cstdint> // for uint8_t #include <cstdint> // for uint8_t
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
@@ -16,7 +16,7 @@ namespace image {
/** /**
* An enumeration representing the result of a drawing operation. * An enumeration representing the result of a drawing operation.
* *
* Most users of DrawResult will only be interested in whether the value is * Most users of ImgDrawResult will only be interested in whether the value is
* SUCCESS or not. The other values are primarily useful for debugging and error * SUCCESS or not. The other values are primarily useful for debugging and error
* handling. * handling.
* *
@@ -46,7 +46,7 @@ namespace image {
* *
* BAD_ARGS: We failed to draw because bad arguments were passed to draw(). * BAD_ARGS: We failed to draw because bad arguments were passed to draw().
*/ */
enum class MOZ_MUST_USE_TYPE DrawResult : uint8_t enum class MOZ_MUST_USE_TYPE ImgDrawResult : uint8_t
{ {
SUCCESS, SUCCESS,
INCOMPLETE, INCOMPLETE,
@@ -58,27 +58,27 @@ enum class MOZ_MUST_USE_TYPE DrawResult : uint8_t
}; };
/** /**
* You can combine DrawResults with &. By analogy to bitwise-&, the result is * You can combine ImgDrawResults with &. By analogy to bitwise-&, the result is
* DrawResult::SUCCESS only if both operands are DrawResult::SUCCESS. Otherwise, * ImgDrawResult::SUCCESS only if both operands are ImgDrawResult::SUCCESS. Otherwise,
* a failing DrawResult is returned; we favor the left operand's failure when * a failing ImgDrawResult is returned; we favor the left operand's failure when
* deciding which failure to return, with the exception that we always prefer * deciding which failure to return, with the exception that we always prefer
* any other kind of failure over DrawResult::BAD_IMAGE, since other failures * any other kind of failure over ImgDrawResult::BAD_IMAGE, since other failures
* are recoverable and we want to know if any recoverable failures occurred. * are recoverable and we want to know if any recoverable failures occurred.
*/ */
inline DrawResult inline ImgDrawResult
operator&(const DrawResult aLeft, const DrawResult aRight) operator&(const ImgDrawResult aLeft, const ImgDrawResult aRight)
{ {
if (MOZ_LIKELY(aLeft == DrawResult::SUCCESS)) { if (MOZ_LIKELY(aLeft == ImgDrawResult::SUCCESS)) {
return aRight; return aRight;
} }
if (aLeft == DrawResult::BAD_IMAGE && aRight != DrawResult::SUCCESS) { if (aLeft == ImgDrawResult::BAD_IMAGE && aRight != ImgDrawResult::SUCCESS) {
return aRight; return aRight;
} }
return aLeft; return aLeft;
} }
inline DrawResult& inline ImgDrawResult&
operator&=(DrawResult& aLeft, const DrawResult aRight) operator&=(ImgDrawResult& aLeft, const ImgDrawResult aRight)
{ {
aLeft = aLeft & aRight; aLeft = aLeft & aRight;
return aLeft; return aLeft;
@@ -86,21 +86,21 @@ operator&=(DrawResult& aLeft, const DrawResult aRight)
/** /**
* A struct used during painting to provide input flags to determine how * A struct used during painting to provide input flags to determine how
* imagelib draw calls should behave and an output DrawResult to return * imagelib draw calls should behave and an output ImgDrawResult to return
* information about the result of any imagelib draw calls that may have * information about the result of any imagelib draw calls that may have
* occurred. * occurred.
*/ */
struct imgDrawingParams { struct imgDrawingParams {
explicit imgDrawingParams(uint32_t aImageFlags = 0) explicit imgDrawingParams(uint32_t aImageFlags = 0)
: imageFlags(aImageFlags), result(DrawResult::SUCCESS) : imageFlags(aImageFlags), result(ImgDrawResult::SUCCESS)
{} {}
const uint32_t imageFlags; // imgIContainer::FLAG_* image flags to pass to const uint32_t imageFlags; // imgIContainer::FLAG_* image flags to pass to
// image lib draw calls. // image lib draw calls.
DrawResult result; // To return results from image lib painting. ImgDrawResult result; // To return results from image lib painting.
}; };
} // namespace image } // namespace image
} // namespace mozilla } // namespace mozilla
#endif // mozilla_image_DrawResult_h #endif // mozilla_image_ImgDrawResult_h

View File

@@ -303,7 +303,7 @@ OrientedImage::OrientationMatrix(const nsIntSize& aSize,
return builder.Build(); return builder.Build();
} }
NS_IMETHODIMP_(DrawResult) NS_IMETHODIMP_(ImgDrawResult)
OrientedImage::Draw(gfxContext* aContext, OrientedImage::Draw(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,

View File

@@ -53,7 +53,7 @@ public:
const gfx::IntSize& aSize, const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags) override; uint32_t aFlags) override;
NS_IMETHOD_(DrawResult) Draw(gfxContext* aContext, NS_IMETHOD_(ImgDrawResult) Draw(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,
uint32_t aWhichFrame, uint32_t aWhichFrame,

View File

@@ -585,7 +585,7 @@ RasterImage::GetFrameAtSize(const IntSize& aSize,
return surf.forget(); return surf.forget();
} }
Tuple<DrawResult, IntSize, RefPtr<SourceSurface>> Tuple<ImgDrawResult, IntSize, RefPtr<SourceSurface>>
RasterImage::GetFrameInternal(const IntSize& aSize, RasterImage::GetFrameInternal(const IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame, uint32_t aWhichFrame,
@@ -594,12 +594,12 @@ RasterImage::GetFrameInternal(const IntSize& aSize,
MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE); MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE);
if (aSize.IsEmpty() || aWhichFrame > FRAME_MAX_VALUE) { if (aSize.IsEmpty() || aWhichFrame > FRAME_MAX_VALUE) {
return MakeTuple(DrawResult::BAD_ARGS, aSize, return MakeTuple(ImgDrawResult::BAD_ARGS, aSize,
RefPtr<SourceSurface>()); RefPtr<SourceSurface>());
} }
if (mError) { if (mError) {
return MakeTuple(DrawResult::BAD_IMAGE, aSize, return MakeTuple(ImgDrawResult::BAD_IMAGE, aSize,
RefPtr<SourceSurface>()); RefPtr<SourceSurface>());
} }
@@ -619,16 +619,16 @@ RasterImage::GetFrameInternal(const IntSize& aSize,
if (!result) { if (!result) {
// The OS threw this frame away and we couldn't redecode it. // The OS threw this frame away and we couldn't redecode it.
return MakeTuple(DrawResult::TEMPORARY_ERROR, suggestedSize, return MakeTuple(ImgDrawResult::TEMPORARY_ERROR, suggestedSize,
RefPtr<SourceSurface>()); RefPtr<SourceSurface>());
} }
RefPtr<SourceSurface> surface = result.Surface()->GetSourceSurface(); RefPtr<SourceSurface> surface = result.Surface()->GetSourceSurface();
if (!result.Surface()->IsFinished()) { if (!result.Surface()->IsFinished()) {
return MakeTuple(DrawResult::INCOMPLETE, suggestedSize, Move(surface)); return MakeTuple(ImgDrawResult::INCOMPLETE, suggestedSize, Move(surface));
} }
return MakeTuple(DrawResult::SUCCESS, suggestedSize, Move(surface)); return MakeTuple(ImgDrawResult::SUCCESS, suggestedSize, Move(surface));
} }
IntSize IntSize
@@ -1376,7 +1376,7 @@ RasterImage::CanDownscaleDuringDecode(const IntSize& aSize, uint32_t aFlags)
return true; return true;
} }
DrawResult ImgDrawResult
RasterImage::DrawInternal(DrawableSurface&& aSurface, RasterImage::DrawInternal(DrawableSurface&& aSurface,
gfxContext* aContext, gfxContext* aContext,
const IntSize& aSize, const IntSize& aSize,
@@ -1408,19 +1408,19 @@ RasterImage::DrawInternal(DrawableSurface&& aSurface,
if (!aSurface->Draw(aContext, region, aSamplingFilter, aFlags, aOpacity)) { if (!aSurface->Draw(aContext, region, aSamplingFilter, aFlags, aOpacity)) {
RecoverFromInvalidFrames(aSize, aFlags); RecoverFromInvalidFrames(aSize, aFlags);
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
if (!frameIsFinished) { if (!frameIsFinished) {
return DrawResult::INCOMPLETE; return ImgDrawResult::INCOMPLETE;
} }
if (couldRedecodeForBetterFrame) { if (couldRedecodeForBetterFrame) {
return DrawResult::WRONG_SIZE; return ImgDrawResult::WRONG_SIZE;
} }
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
//****************************************************************************** //******************************************************************************
NS_IMETHODIMP_(DrawResult) NS_IMETHODIMP_(ImgDrawResult)
RasterImage::Draw(gfxContext* aContext, RasterImage::Draw(gfxContext* aContext,
const IntSize& aSize, const IntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,
@@ -1431,22 +1431,22 @@ RasterImage::Draw(gfxContext* aContext,
float aOpacity) float aOpacity)
{ {
if (aWhichFrame > FRAME_MAX_VALUE) { if (aWhichFrame > FRAME_MAX_VALUE) {
return DrawResult::BAD_ARGS; return ImgDrawResult::BAD_ARGS;
} }
if (mError) { if (mError) {
return DrawResult::BAD_IMAGE; return ImgDrawResult::BAD_IMAGE;
} }
// Illegal -- you can't draw with non-default decode flags. // Illegal -- you can't draw with non-default decode flags.
// (Disabling colorspace conversion might make sense to allow, but // (Disabling colorspace conversion might make sense to allow, but
// we don't currently.) // we don't currently.)
if (ToSurfaceFlags(aFlags) != DefaultSurfaceFlags()) { if (ToSurfaceFlags(aFlags) != DefaultSurfaceFlags()) {
return DrawResult::BAD_ARGS; return ImgDrawResult::BAD_ARGS;
} }
if (!aContext) { if (!aContext) {
return DrawResult::BAD_ARGS; return ImgDrawResult::BAD_ARGS;
} }
if (mAnimationConsumers == 0) { if (mAnimationConsumers == 0) {
@@ -1467,7 +1467,7 @@ RasterImage::Draw(gfxContext* aContext,
if (mDrawStartTime.IsNull()) { if (mDrawStartTime.IsNull()) {
mDrawStartTime = TimeStamp::Now(); mDrawStartTime = TimeStamp::Now();
} }
return DrawResult::NOT_READY; return ImgDrawResult::NOT_READY;
} }
bool shouldRecordTelemetry = !mDrawStartTime.IsNull() && bool shouldRecordTelemetry = !mDrawStartTime.IsNull() &&

View File

@@ -299,7 +299,7 @@ private:
uint32_t aFlags, uint32_t aFlags,
PlaybackType aPlaybackType); PlaybackType aPlaybackType);
DrawResult DrawInternal(DrawableSurface&& aFrameRef, ImgDrawResult DrawInternal(DrawableSurface&& aFrameRef,
gfxContext* aContext, gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,
@@ -307,7 +307,7 @@ private:
uint32_t aFlags, uint32_t aFlags,
float aOpacity); float aOpacity);
Tuple<DrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>> Tuple<ImgDrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>>
GetFrameInternal(const gfx::IntSize& aSize, GetFrameInternal(const gfx::IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame, uint32_t aWhichFrame,

View File

@@ -784,7 +784,7 @@ VectorImage::GetFrameAtSize(const IntSize& aSize,
return surf.forget(); return surf.forget();
} }
Tuple<DrawResult, IntSize, RefPtr<SourceSurface>> Tuple<ImgDrawResult, IntSize, RefPtr<SourceSurface>>
VectorImage::GetFrameInternal(const IntSize& aSize, VectorImage::GetFrameInternal(const IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame, uint32_t aWhichFrame,
@@ -793,29 +793,29 @@ VectorImage::GetFrameInternal(const IntSize& aSize,
MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE); MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE);
if (aSize.IsEmpty() || aWhichFrame > FRAME_MAX_VALUE) { if (aSize.IsEmpty() || aWhichFrame > FRAME_MAX_VALUE) {
return MakeTuple(DrawResult::BAD_ARGS, aSize, return MakeTuple(ImgDrawResult::BAD_ARGS, aSize,
RefPtr<SourceSurface>()); RefPtr<SourceSurface>());
} }
if (mError) { if (mError) {
return MakeTuple(DrawResult::BAD_IMAGE, aSize, return MakeTuple(ImgDrawResult::BAD_IMAGE, aSize,
RefPtr<SourceSurface>()); RefPtr<SourceSurface>());
} }
if (!mIsFullyLoaded) { if (!mIsFullyLoaded) {
return MakeTuple(DrawResult::NOT_READY, aSize, return MakeTuple(ImgDrawResult::NOT_READY, aSize,
RefPtr<SourceSurface>()); RefPtr<SourceSurface>());
} }
RefPtr<SourceSurface> sourceSurface = RefPtr<SourceSurface> sourceSurface =
LookupCachedSurface(aSize, aSVGContext, aFlags); LookupCachedSurface(aSize, aSVGContext, aFlags);
if (sourceSurface) { if (sourceSurface) {
return MakeTuple(DrawResult::SUCCESS, aSize, Move(sourceSurface)); return MakeTuple(ImgDrawResult::SUCCESS, aSize, Move(sourceSurface));
} }
if (mIsDrawing) { if (mIsDrawing) {
NS_WARNING("Refusing to make re-entrant call to VectorImage::Draw"); NS_WARNING("Refusing to make re-entrant call to VectorImage::Draw");
return MakeTuple(DrawResult::TEMPORARY_ERROR, aSize, return MakeTuple(ImgDrawResult::TEMPORARY_ERROR, aSize,
RefPtr<SourceSurface>()); RefPtr<SourceSurface>());
} }
@@ -840,12 +840,12 @@ VectorImage::GetFrameInternal(const IntSize& aSize,
CreateSurface(params, svgDrawable, didCache); CreateSurface(params, svgDrawable, didCache);
if (!surface) { if (!surface) {
MOZ_ASSERT(!didCache); MOZ_ASSERT(!didCache);
return MakeTuple(DrawResult::TEMPORARY_ERROR, aSize, return MakeTuple(ImgDrawResult::TEMPORARY_ERROR, aSize,
RefPtr<SourceSurface>()); RefPtr<SourceSurface>());
} }
SendFrameComplete(didCache, params.flags); SendFrameComplete(didCache, params.flags);
return MakeTuple(DrawResult::SUCCESS, aSize, Move(surface)); return MakeTuple(ImgDrawResult::SUCCESS, aSize, Move(surface));
} }
//****************************************************************************** //******************************************************************************
@@ -955,7 +955,7 @@ VectorImage::MaybeRestrictSVGContext(Maybe<SVGImageContext>& aNewSVGContext,
} }
//****************************************************************************** //******************************************************************************
NS_IMETHODIMP_(DrawResult) NS_IMETHODIMP_(ImgDrawResult)
VectorImage::Draw(gfxContext* aContext, VectorImage::Draw(gfxContext* aContext,
const nsIntSize& aSize, const nsIntSize& aSize,
const ImageRegion& aRegion, const ImageRegion& aRegion,
@@ -966,19 +966,19 @@ VectorImage::Draw(gfxContext* aContext,
float aOpacity) float aOpacity)
{ {
if (aWhichFrame > FRAME_MAX_VALUE) { if (aWhichFrame > FRAME_MAX_VALUE) {
return DrawResult::BAD_ARGS; return ImgDrawResult::BAD_ARGS;
} }
if (!aContext) { if (!aContext) {
return DrawResult::BAD_ARGS; return ImgDrawResult::BAD_ARGS;
} }
if (mError) { if (mError) {
return DrawResult::BAD_IMAGE; return ImgDrawResult::BAD_IMAGE;
} }
if (!mIsFullyLoaded) { if (!mIsFullyLoaded) {
return DrawResult::NOT_READY; return ImgDrawResult::NOT_READY;
} }
if (mAnimationConsumers == 0) { if (mAnimationConsumers == 0) {
@@ -1016,14 +1016,14 @@ VectorImage::Draw(gfxContext* aContext,
RefPtr<gfxDrawable> svgDrawable = RefPtr<gfxDrawable> svgDrawable =
new gfxSurfaceDrawable(sourceSurface, sourceSurface->GetSize()); new gfxSurfaceDrawable(sourceSurface, sourceSurface->GetSize());
Show(svgDrawable, params); Show(svgDrawable, params);
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
// else, we need to paint the image: // else, we need to paint the image:
if (mIsDrawing) { if (mIsDrawing) {
NS_WARNING("Refusing to make re-entrant call to VectorImage::Draw"); NS_WARNING("Refusing to make re-entrant call to VectorImage::Draw");
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
AutoRestoreSVGState autoRestore(params, mSVGDocumentWrapper, AutoRestoreSVGState autoRestore(params, mSVGDocumentWrapper,
@@ -1035,7 +1035,7 @@ VectorImage::Draw(gfxContext* aContext,
if (!sourceSurface) { if (!sourceSurface) {
MOZ_ASSERT(!didCache); MOZ_ASSERT(!didCache);
Show(svgDrawable, params); Show(svgDrawable, params);
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
RefPtr<gfxDrawable> drawable = RefPtr<gfxDrawable> drawable =
@@ -1046,7 +1046,7 @@ VectorImage::Draw(gfxContext* aContext,
// Image got put into a painted layer, it will not be shared with another // Image got put into a painted layer, it will not be shared with another
// process. // process.
MarkSurfaceShared(sourceSurface); MarkSurfaceShared(sourceSurface);
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
already_AddRefed<gfxDrawable> already_AddRefed<gfxDrawable>

View File

@@ -81,7 +81,7 @@ protected:
virtual bool ShouldAnimate() override; virtual bool ShouldAnimate() override;
private: private:
Tuple<DrawResult, IntSize, RefPtr<SourceSurface>> Tuple<ImgDrawResult, IntSize, RefPtr<SourceSurface>>
GetFrameInternal(const IntSize& aSize, GetFrameInternal(const IntSize& aSize,
const Maybe<SVGImageContext>& aSVGContext, const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame, uint32_t aWhichFrame,

View File

@@ -7,7 +7,7 @@
#include "nsISupports.idl" #include "nsISupports.idl"
%{C++ %{C++
#include "DrawResult.h" #include "ImgDrawResult.h"
#include "gfxContext.h" #include "gfxContext.h"
#include "gfxMatrix.h" #include "gfxMatrix.h"
#include "gfxRect.h" #include "gfxRect.h"
@@ -45,7 +45,7 @@ struct Orientation;
%} %}
native DrawResult(mozilla::image::DrawResult); native ImgDrawResult(mozilla::image::ImgDrawResult);
[ptr] native gfxContext(gfxContext); [ptr] native gfxContext(gfxContext);
[ref] native gfxMatrix(gfxMatrix); [ref] native gfxMatrix(gfxMatrix);
[ref] native gfxRect(gfxRect); [ref] native gfxRect(gfxRect);
@@ -432,10 +432,10 @@ interface imgIContainer : nsISupports
* node, and the size of the viewport that the full image * node, and the size of the viewport that the full image
* would occupy. Ignored for raster images. * would occupy. Ignored for raster images.
* @param aFlags Flags of the FLAG_* variety * @param aFlags Flags of the FLAG_* variety
* @return A DrawResult value indicating whether and to what degree the * @return A ImgDrawResult value indicating whether and to what degree the
* drawing operation was successful. * drawing operation was successful.
*/ */
[noscript, notxpcom] DrawResult [noscript, notxpcom] ImgDrawResult
draw(in gfxContext aContext, draw(in gfxContext aContext,
[const] in nsIntSize aSize, [const] in nsIntSize aSize,
[const] in ImageRegion aRegion, [const] in ImageRegion aRegion,

View File

@@ -38,13 +38,13 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'imglib2' XPIDL_MODULE = 'imglib2'
EXPORTS += [ EXPORTS += [
'DrawResult.h',
'FrameTimeout.h', 'FrameTimeout.h',
'ImageCacheKey.h', 'ImageCacheKey.h',
'ImageLogging.h', 'ImageLogging.h',
'ImageMetadata.h', 'ImageMetadata.h',
'ImageOps.h', 'ImageOps.h',
'ImageRegion.h', 'ImageRegion.h',
'ImgDrawResult.h',
'imgLoader.h', 'imgLoader.h',
'imgRequest.h', 'imgRequest.h',
'imgRequestProxy.h', 'imgRequestProxy.h',

View File

@@ -6930,7 +6930,7 @@ ComputeSnappedImageDrawingParameters(gfxContext* aCtx,
svgViewportSize.height)); svgViewportSize.height));
} }
static DrawResult static ImgDrawResult
DrawImageInternal(gfxContext& aContext, DrawImageInternal(gfxContext& aContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,
imgIContainer* aImage, imgIContainer* aImage,
@@ -6944,7 +6944,7 @@ DrawImageInternal(gfxContext& aContext,
ExtendMode aExtendMode = ExtendMode::CLAMP, ExtendMode aExtendMode = ExtendMode::CLAMP,
float aOpacity = 1.0) float aOpacity = 1.0)
{ {
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
aImageFlags |= imgIContainer::FLAG_ASYNC_NOTIFY; aImageFlags |= imgIContainer::FLAG_ASYNC_NOTIFY;
@@ -6989,7 +6989,7 @@ DrawImageInternal(gfxContext& aContext,
return result; return result;
} }
/* static */ DrawResult /* static */ ImgDrawResult
nsLayoutUtils::DrawSingleUnscaledImage(gfxContext& aContext, nsLayoutUtils::DrawSingleUnscaledImage(gfxContext& aContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,
imgIContainer* aImage, imgIContainer* aImage,
@@ -7004,7 +7004,7 @@ nsLayoutUtils::DrawSingleUnscaledImage(gfxContext& aContext,
aImage->GetHeight(&imageSize.height); aImage->GetHeight(&imageSize.height);
if (imageSize.width < 1 || imageSize.height < 1) { if (imageSize.width < 1 || imageSize.height < 1) {
NS_WARNING("Image width or height is non-positive"); NS_WARNING("Image width or height is non-positive");
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
nsSize size(CSSPixel::ToAppUnits(imageSize)); nsSize size(CSSPixel::ToAppUnits(imageSize));
@@ -7027,7 +7027,7 @@ nsLayoutUtils::DrawSingleUnscaledImage(gfxContext& aContext,
/* no SVGImageContext */ Nothing(), aImageFlags); /* no SVGImageContext */ Nothing(), aImageFlags);
} }
/* static */ DrawResult /* static */ ImgDrawResult
nsLayoutUtils::DrawSingleImage(gfxContext& aContext, nsLayoutUtils::DrawSingleImage(gfxContext& aContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,
imgIContainer* aImage, imgIContainer* aImage,
@@ -7044,7 +7044,7 @@ nsLayoutUtils::DrawSingleImage(gfxContext& aContext,
if (pixelImageSize.width < 1 || pixelImageSize.height < 1) { if (pixelImageSize.width < 1 || pixelImageSize.height < 1) {
NS_ASSERTION(pixelImageSize.width >= 0 && pixelImageSize.height >= 0, NS_ASSERTION(pixelImageSize.width >= 0 && pixelImageSize.height >= 0,
"Image width or height is negative"); "Image width or height is negative");
return DrawResult::SUCCESS; // no point in drawing a zero size image return ImgDrawResult::SUCCESS; // no point in drawing a zero size image
} }
nsSize imageSize(CSSPixel::ToAppUnits(pixelImageSize)); nsSize imageSize(CSSPixel::ToAppUnits(pixelImageSize));
@@ -7234,7 +7234,7 @@ nsLayoutUtils::GetBackgroundFirstTilePos(const nsPoint& aDest,
aDest; aDest;
} }
/* static */ DrawResult /* static */ ImgDrawResult
nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext, nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -7267,20 +7267,20 @@ nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
for (int32_t i = firstTilePos.x; i < aFill.XMost(); i += aRepeatSize.width) { for (int32_t i = firstTilePos.x; i < aFill.XMost(); i += aRepeatSize.width) {
for (int32_t j = firstTilePos.y; j < aFill.YMost(); j += aRepeatSize.height) { for (int32_t j = firstTilePos.y; j < aFill.YMost(); j += aRepeatSize.height) {
nsRect dest(i, j, aDest.width, aDest.height); nsRect dest(i, j, aDest.width, aDest.height);
DrawResult result = DrawImageInternal(aContext, aPresContext, aImage, aSamplingFilter, ImgDrawResult result = DrawImageInternal(aContext, aPresContext, aImage, aSamplingFilter,
dest, dest, aAnchor, aDirty, svgContext, dest, dest, aAnchor, aDirty, svgContext,
aImageFlags, ExtendMode::CLAMP, aImageFlags, ExtendMode::CLAMP,
aOpacity); aOpacity);
if (result != DrawResult::SUCCESS) { if (result != ImgDrawResult::SUCCESS) {
return result; return result;
} }
} }
} }
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
/* static */ DrawResult /* static */ ImgDrawResult
nsLayoutUtils::DrawImage(gfxContext& aContext, nsLayoutUtils::DrawImage(gfxContext& aContext,
nsStyleContext* aStyleContext, nsStyleContext* aStyleContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,

View File

@@ -156,7 +156,7 @@ class nsLayoutUtils
typedef mozilla::gfx::Matrix4x4 Matrix4x4; typedef mozilla::gfx::Matrix4x4 Matrix4x4;
typedef mozilla::gfx::RectCornerRadii RectCornerRadii; typedef mozilla::gfx::RectCornerRadii RectCornerRadii;
typedef mozilla::gfx::StrokeOptions StrokeOptions; typedef mozilla::gfx::StrokeOptions StrokeOptions;
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
public: public:
typedef mozilla::layers::FrameMetrics FrameMetrics; typedef mozilla::layers::FrameMetrics FrameMetrics;
@@ -1806,7 +1806,7 @@ public:
* @param aImageFlags Image flags of the imgIContainer::FLAG_* variety. * @param aImageFlags Image flags of the imgIContainer::FLAG_* variety.
* @param aExtendMode How to extend the image over the dest rect. * @param aExtendMode How to extend the image over the dest rect.
*/ */
static DrawResult DrawBackgroundImage(gfxContext& aContext, static ImgDrawResult DrawBackgroundImage(gfxContext& aContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
nsPresContext* aPresContext, nsPresContext* aPresContext,
imgIContainer* aImage, imgIContainer* aImage,
@@ -1839,7 +1839,7 @@ public:
* @param aDirty Pixels outside this area may be skipped. * @param aDirty Pixels outside this area may be skipped.
* @param aImageFlags Image flags of the imgIContainer::FLAG_* variety * @param aImageFlags Image flags of the imgIContainer::FLAG_* variety
*/ */
static DrawResult DrawImage(gfxContext& aContext, static ImgDrawResult DrawImage(gfxContext& aContext,
nsStyleContext* aStyleContext, nsStyleContext* aStyleContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,
imgIContainer* aImage, imgIContainer* aImage,
@@ -1867,7 +1867,7 @@ public:
* in appunits. For best results it should * in appunits. For best results it should
* be aligned with image pixels. * be aligned with image pixels.
*/ */
static DrawResult DrawSingleUnscaledImage(gfxContext& aContext, static ImgDrawResult DrawSingleUnscaledImage(gfxContext& aContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,
imgIContainer* aImage, imgIContainer* aImage,
const SamplingFilter aSamplingFilter, const SamplingFilter aSamplingFilter,
@@ -1902,7 +1902,7 @@ public:
* in appunits. For best results it should * in appunits. For best results it should
* be aligned with image pixels. * be aligned with image pixels.
*/ */
static DrawResult DrawSingleImage(gfxContext& aContext, static ImgDrawResult DrawSingleImage(gfxContext& aContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,
imgIContainer* aImage, imgIContainer* aImage,
const SamplingFilter aSamplingFilter, const SamplingFilter aSamplingFilter,

View File

@@ -356,7 +356,7 @@ nsDisplayButtonBorder::Paint(nsDisplayListBuilder* aBuilder,
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize()); nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
// draw the border and background inside the focus and outline borders // draw the border and background inside the focus and outline borders
DrawResult result = ImgDrawResult result =
mBFR->PaintBorder(aBuilder, pc, *aCtx, mVisibleRect, r); mBFR->PaintBorder(aBuilder, pc, *aCtx, mVisibleRect, r);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result); nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
@@ -436,7 +436,7 @@ void nsDisplayButtonForeground::Paint(nsDisplayListBuilder* aBuilder,
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize()); nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
// Draw the -moz-focus-inner border // Draw the -moz-focus-inner border
DrawResult result = ImgDrawResult result =
mBFR->PaintInnerFocusBorder(aBuilder, presContext, *aCtx, mVisibleRect, r); mBFR->PaintInnerFocusBorder(aBuilder, presContext, *aCtx, mVisibleRect, r);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result); nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
@@ -523,7 +523,7 @@ nsButtonFrameRenderer::GetButtonInnerFocusRect(const nsRect& aRect, nsRect& aRes
aResult.Inflate(innerFocusPadding); aResult.Inflate(innerFocusPadding);
} }
DrawResult ImgDrawResult
nsButtonFrameRenderer::PaintInnerFocusBorder( nsButtonFrameRenderer::PaintInnerFocusBorder(
nsDisplayListBuilder* aBuilder, nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -540,7 +540,7 @@ nsButtonFrameRenderer::PaintInnerFocusBorder(
? PaintBorderFlags::SYNC_DECODE_IMAGES ? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags(); : PaintBorderFlags();
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
if (mInnerFocusStyle) { if (mInnerFocusStyle) {
GetButtonInnerFocusRect(aRect, rect); GetButtonInnerFocusRect(aRect, rect);
@@ -579,7 +579,7 @@ nsButtonFrameRenderer::CreateInnerFocusBorderRenderer(
return Nothing(); return Nothing();
} }
DrawResult ImgDrawResult
nsButtonFrameRenderer::PaintBorder( nsButtonFrameRenderer::PaintBorder(
nsDisplayListBuilder* aBuilder, nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -598,7 +598,7 @@ nsButtonFrameRenderer::PaintBorder(
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext, nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext,
mFrame, buttonRect); mFrame, buttonRect);
DrawResult result = ImgDrawResult result =
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
aDirtyRect, buttonRect, context, borderFlags); aDirtyRect, buttonRect, context, borderFlags);

View File

@@ -25,7 +25,7 @@ class nsStyleContext;
#define NS_BUTTON_RENDERER_LAST_CONTEXT_INDEX NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX #define NS_BUTTON_RENDERER_LAST_CONTEXT_INDEX NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX
class nsButtonFrameRenderer { class nsButtonFrameRenderer {
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
public: public:
@@ -39,7 +39,7 @@ public:
nsDisplayList* aBackground, nsDisplayList* aForeground); nsDisplayList* aBackground, nsDisplayList* aForeground);
DrawResult PaintInnerFocusBorder(nsDisplayListBuilder* aBuilder, ImgDrawResult PaintInnerFocusBorder(nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext, nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
@@ -52,7 +52,7 @@ public:
const nsRect& aRect, const nsRect& aRect,
bool* aBorderIsEmpty); bool* aBorderIsEmpty);
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder, ImgDrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext, nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,

View File

@@ -111,7 +111,7 @@ void
nsDisplayFieldSetBorder::Paint(nsDisplayListBuilder* aBuilder, nsDisplayFieldSetBorder::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) gfxContext* aCtx)
{ {
image::DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)-> image::ImgDrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
PaintBorder(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect); PaintBorder(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result); nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
@@ -240,7 +240,7 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
contentDisplayItems.MoveTo(aLists); contentDisplayItems.MoveTo(aLists);
} }
image::DrawResult image::ImgDrawResult
nsFieldSetFrame::PaintBorder( nsFieldSetFrame::PaintBorder(
nsDisplayListBuilder* aBuilder, nsDisplayListBuilder* aBuilder,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
@@ -259,7 +259,7 @@ nsFieldSetFrame::PaintBorder(
? PaintBorderFlags::SYNC_DECODE_IMAGES ? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags(); : PaintBorderFlags();
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext, nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
this, rect); this, rect);

View File

@@ -8,12 +8,12 @@
#define nsFieldSetFrame_h___ #define nsFieldSetFrame_h___
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "DrawResult.h" #include "ImgDrawResult.h"
#include "nsContainerFrame.h" #include "nsContainerFrame.h"
class nsFieldSetFrame final : public nsContainerFrame class nsFieldSetFrame final : public nsContainerFrame
{ {
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
public: public:
NS_DECL_FRAMEARENA_HELPERS(nsFieldSetFrame) NS_DECL_FRAMEARENA_HELPERS(nsFieldSetFrame)
@@ -47,7 +47,7 @@ public:
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override; const nsDisplayListSet& aLists) override;
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder, ImgDrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect); nsPoint aPt, const nsRect& aDirtyRect);

View File

@@ -246,7 +246,7 @@ nsDisplayRangeFocusRing::Paint(nsDisplayListBuilder* aBuilder,
? PaintBorderFlags::SYNC_DECODE_IMAGES ? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags(); : PaintBorderFlags();
DrawResult result = ImgDrawResult result =
nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame, nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame,
mVisibleRect, GetBounds(aBuilder, &unused), mVisibleRect, GetBounds(aBuilder, &unused),
styleContext, flags); styleContext, flags);

View File

@@ -246,7 +246,7 @@ public:
mozilla::layers::WebRenderLayerManager* aManager, mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder); nsDisplayListBuilder* aDisplayListBuilder);
DrawResult ImgDrawResult
Paint(gfxContext& aRenderingContext, nsPoint aPt, Paint(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags, const nsRect& aDirtyRect, uint32_t aFlags,
bool aDisableSubpixelAA, nsIFrame* aFrame); bool aDisableSubpixelAA, nsIFrame* aFrame);
@@ -370,7 +370,7 @@ BulletRenderer::CreateWebRenderCommands(nsDisplayItem* aItem,
} }
} }
DrawResult ImgDrawResult
BulletRenderer::Paint(gfxContext& aRenderingContext, nsPoint aPt, BulletRenderer::Paint(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags, const nsRect& aDirtyRect, uint32_t aFlags,
bool aDisableSubpixelAA, nsIFrame* aFrame) bool aDisableSubpixelAA, nsIFrame* aFrame)
@@ -422,7 +422,7 @@ BulletRenderer::Paint(gfxContext& aRenderingContext, nsPoint aPt,
PaintTextToContext(aFrame, &aRenderingContext, aDisableSubpixelAA); PaintTextToContext(aFrame, &aRenderingContext, aDisableSubpixelAA);
} }
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
bool bool
@@ -770,7 +770,7 @@ void nsDisplayBullet::Paint(nsDisplayListBuilder* aBuilder,
flags |= imgIContainer::FLAG_SYNC_DECODE; flags |= imgIContainer::FLAG_SYNC_DECODE;
} }
DrawResult result = static_cast<nsBulletFrame*>(mFrame)-> ImgDrawResult result = static_cast<nsBulletFrame*>(mFrame)->
PaintBullet(*aCtx, ToReferenceFrame(), mVisibleRect, flags, PaintBullet(*aCtx, ToReferenceFrame(), mVisibleRect, flags,
mDisableSubpixelAA); mDisableSubpixelAA);
@@ -939,7 +939,7 @@ nsBulletFrame::CreateBulletRenderer(gfxContext& aRenderingContext, nsPoint aPt)
return Nothing(); return Nothing();
} }
DrawResult ImgDrawResult
nsBulletFrame::PaintBullet(gfxContext& aRenderingContext, nsPoint aPt, nsBulletFrame::PaintBullet(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags, const nsRect& aDirtyRect, uint32_t aFlags,
bool aDisableSubpixelAA) bool aDisableSubpixelAA)
@@ -947,7 +947,7 @@ nsBulletFrame::PaintBullet(gfxContext& aRenderingContext, nsPoint aPt,
Maybe<BulletRenderer> br = CreateBulletRenderer(aRenderingContext, aPt); Maybe<BulletRenderer> br = CreateBulletRenderer(aRenderingContext, aPt);
if (!br) { if (!br) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
return br->Paint(aRenderingContext, aPt, aDirtyRect, return br->Paint(aRenderingContext, aPt, aDirtyRect,

View File

@@ -42,7 +42,7 @@ private:
* This class also supports the CSS list-style properties. * This class also supports the CSS list-style properties.
*/ */
class nsBulletFrame final : public nsFrame { class nsBulletFrame final : public nsFrame {
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
public: public:
NS_DECL_FRAMEARENA_HELPERS(nsBulletFrame) NS_DECL_FRAMEARENA_HELPERS(nsBulletFrame)
@@ -101,7 +101,7 @@ public:
Maybe<BulletRenderer> Maybe<BulletRenderer>
CreateBulletRenderer(gfxContext& aRenderingContext, nsPoint aPt); CreateBulletRenderer(gfxContext& aRenderingContext, nsPoint aPt);
DrawResult PaintBullet(gfxContext& aRenderingContext, nsPoint aPt, ImgDrawResult PaintBullet(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags, const nsRect& aDirtyRect, uint32_t aFlags,
bool aDisableSubpixelAA); bool aDisableSubpixelAA);

View File

@@ -280,7 +280,7 @@ nsColumnSetFrame::CreateBorderRenderers(nsTArray<nsCSSBorderRenderer>& aBorderRe
(const nsRect& aLineRect) (const nsRect& aLineRect)
{ {
// Assert that we're not drawing a border-image here; if we were, we // Assert that we're not drawing a border-image here; if we were, we
// couldn't ignore the DrawResult that PaintBorderWithStyleBorder returns. // couldn't ignore the ImgDrawResult that PaintBorderWithStyleBorder returns.
MOZ_ASSERT(border.mBorderImageSource.GetType() == eStyleImageType_Null); MOZ_ASSERT(border.mBorderImageSource.GetType() == eStyleImageType_Null);
gfx::DrawTarget* dt = aCtx ? aCtx->GetDrawTarget() : nullptr; gfx::DrawTarget* dt = aCtx ? aCtx->GetDrawTarget() : nullptr;

View File

@@ -1342,7 +1342,7 @@ public:
uint32_t flags = imgIContainer::FLAG_SYNC_DECODE; uint32_t flags = imgIContainer::FLAG_SYNC_DECODE;
nsImageFrame* f = static_cast<nsImageFrame*>(mFrame); nsImageFrame* f = static_cast<nsImageFrame*>(mFrame);
DrawResult result = ImgDrawResult result =
f->DisplayAltFeedback(*aCtx, f->DisplayAltFeedback(*aCtx,
mVisibleRect, mVisibleRect,
ToReferenceFrame(), ToReferenceFrame(),
@@ -1354,7 +1354,7 @@ public:
NS_DISPLAY_DECL_NAME("AltFeedback", TYPE_ALT_FEEDBACK) NS_DISPLAY_DECL_NAME("AltFeedback", TYPE_ALT_FEEDBACK)
}; };
DrawResult ImgDrawResult
nsImageFrame::DisplayAltFeedback(gfxContext& aRenderingContext, nsImageFrame::DisplayAltFeedback(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsPoint aPt, nsPoint aPt,
@@ -1381,7 +1381,7 @@ nsImageFrame::DisplayAltFeedback(gfxContext& aRenderingContext,
// Make sure we have enough room to actually render the border within // Make sure we have enough room to actually render the border within
// our frame bounds // our frame bounds
if ((inner.width < 2 * borderEdgeWidth) || (inner.height < 2 * borderEdgeWidth)) { if ((inner.width < 2 * borderEdgeWidth) || (inner.height < 2 * borderEdgeWidth)) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
// Paint the border // Paint the border
@@ -1389,7 +1389,7 @@ nsImageFrame::DisplayAltFeedback(gfxContext& aRenderingContext,
nsRecessedBorder recessedBorder(borderEdgeWidth, PresContext()); nsRecessedBorder recessedBorder(borderEdgeWidth, PresContext());
// Assert that we're not drawing a border-image here; if we were, we // Assert that we're not drawing a border-image here; if we were, we
// couldn't ignore the DrawResult that PaintBorderWithStyleBorder returns. // couldn't ignore the ImgDrawResult that PaintBorderWithStyleBorder returns.
MOZ_ASSERT(recessedBorder.mBorderImageSource.GetType() == eStyleImageType_Null); MOZ_ASSERT(recessedBorder.mBorderImageSource.GetType() == eStyleImageType_Null);
Unused << Unused <<
@@ -1404,7 +1404,7 @@ nsImageFrame::DisplayAltFeedback(gfxContext& aRenderingContext,
inner.Deflate(nsPresContext::CSSPixelsToAppUnits(ICON_PADDING+ALT_BORDER_WIDTH), inner.Deflate(nsPresContext::CSSPixelsToAppUnits(ICON_PADDING+ALT_BORDER_WIDTH),
nsPresContext::CSSPixelsToAppUnits(ICON_PADDING+ALT_BORDER_WIDTH)); nsPresContext::CSSPixelsToAppUnits(ICON_PADDING+ALT_BORDER_WIDTH));
if (inner.IsEmpty()) { if (inner.IsEmpty()) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget(); DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
@@ -1414,12 +1414,12 @@ nsImageFrame::DisplayAltFeedback(gfxContext& aRenderingContext,
aRenderingContext.Clip( aRenderingContext.Clip(
NSRectToSnappedRect(inner, PresContext()->AppUnitsPerDevPixel(), *drawTarget)); NSRectToSnappedRect(inner, PresContext()->AppUnitsPerDevPixel(), *drawTarget));
DrawResult result = DrawResult::NOT_READY; ImgDrawResult result = ImgDrawResult::NOT_READY;
// Check if we should display image placeholders // Check if we should display image placeholders
if (!gIconLoad->mPrefShowPlaceholders || if (!gIconLoad->mPrefShowPlaceholders ||
(isLoading && !gIconLoad->mPrefShowLoadingPlaceholder)) { (isLoading && !gIconLoad->mPrefShowLoadingPlaceholder)) {
result = DrawResult::SUCCESS; result = ImgDrawResult::SUCCESS;
} else { } else {
nscoord size = nsPresContext::CSSPixelsToAppUnits(ICON_SIZE); nscoord size = nsPresContext::CSSPixelsToAppUnits(ICON_SIZE);
@@ -1456,7 +1456,7 @@ nsImageFrame::DisplayAltFeedback(gfxContext& aRenderingContext,
} }
// If we could not draw the icon, just draw some graffiti in the mean time. // If we could not draw the icon, just draw some graffiti in the mean time.
if (result == DrawResult::NOT_READY) { if (result == ImgDrawResult::NOT_READY) {
ColorPattern color(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f))); ColorPattern color(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f)));
nscoord iconXPos = flushRight ? inner.XMost() - size : inner.x; nscoord iconXPos = flushRight ? inner.XMost() - size : inner.x;
@@ -1540,12 +1540,12 @@ nsDisplayImage::Paint(nsDisplayListBuilder* aBuilder,
flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING; flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
} }
DrawResult result = static_cast<nsImageFrame*>(mFrame)-> ImgDrawResult result = static_cast<nsImageFrame*>(mFrame)->
PaintImage(*aCtx, ToReferenceFrame(), mVisibleRect, mImage, flags); PaintImage(*aCtx, ToReferenceFrame(), mVisibleRect, mImage, flags);
if (result == DrawResult::NOT_READY || if (result == ImgDrawResult::NOT_READY ||
result == DrawResult::INCOMPLETE || result == ImgDrawResult::INCOMPLETE ||
result == DrawResult::TEMPORARY_ERROR) { result == ImgDrawResult::TEMPORARY_ERROR) {
// If the current image failed to paint because it's still loading or // If the current image failed to paint because it's still loading or
// decoding, try painting the previous image. // decoding, try painting the previous image.
if (mPrevImage) { if (mPrevImage) {
@@ -1742,7 +1742,7 @@ nsDisplayImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilde
return aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, destRect); return aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources, aSc, destRect);
} }
DrawResult ImgDrawResult
nsImageFrame::PaintImage(gfxContext& aRenderingContext, nsPoint aPt, nsImageFrame::PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, imgIContainer* aImage, const nsRect& aDirtyRect, imgIContainer* aImage,
uint32_t aFlags) uint32_t aFlags)
@@ -1775,7 +1775,7 @@ nsImageFrame::PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
Maybe<SVGImageContext> svgContext; Maybe<SVGImageContext> svgContext;
SVGImageContext::MaybeStoreContextPaint(svgContext, this, aImage); SVGImageContext::MaybeStoreContextPaint(svgContext, this, aImage);
DrawResult result = ImgDrawResult result =
nsLayoutUtils::DrawSingleImage(aRenderingContext, nsLayoutUtils::DrawSingleImage(aRenderingContext,
PresContext(), aImage, PresContext(), aImage,
nsLayoutUtils::GetSamplingFilterForFrame(this), dest, aDirtyRect, nsLayoutUtils::GetSamplingFilterForFrame(this), dest, aDirtyRect,
@@ -1800,9 +1800,9 @@ nsImageFrame::PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
map->Draw(this, *drawTarget, black, strokeOptions); map->Draw(this, *drawTarget, black, strokeOptions);
} }
if (result == DrawResult::SUCCESS) { if (result == ImgDrawResult::SUCCESS) {
mPrevImage = aImage; mPrevImage = aImage;
} else if (result == DrawResult::BAD_IMAGE) { } else if (result == ImgDrawResult::BAD_IMAGE) {
mPrevImage = nullptr; mPrevImage = nullptr;
} }

View File

@@ -65,7 +65,7 @@ public:
using Nothing = mozilla::Nothing; using Nothing = mozilla::Nothing;
using Visibility = mozilla::Visibility; using Visibility = mozilla::Visibility;
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef mozilla::layers::ImageContainer ImageContainer; typedef mozilla::layers::ImageContainer ImageContainer;
typedef mozilla::layers::ImageLayer ImageLayer; typedef mozilla::layers::ImageLayer ImageLayer;
typedef mozilla::layers::LayerManager LayerManager; typedef mozilla::layers::LayerManager LayerManager;
@@ -147,7 +147,7 @@ public:
static bool ShouldCreateImageFrameFor(mozilla::dom::Element* aElement, static bool ShouldCreateImageFrameFor(mozilla::dom::Element* aElement,
nsStyleContext* aStyleContext); nsStyleContext* aStyleContext);
DrawResult DisplayAltFeedback(gfxContext& aRenderingContext, ImgDrawResult DisplayAltFeedback(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsPoint aPt, nsPoint aPt,
uint32_t aFlags); uint32_t aFlags);
@@ -225,7 +225,7 @@ protected:
const nsString& aAltText, const nsString& aAltText,
const nsRect& aRect); const nsRect& aRect);
DrawResult PaintImage(gfxContext& aRenderingContext, nsPoint aPt, ImgDrawResult PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, imgIContainer* aImage, const nsRect& aDirtyRect, imgIContainer* aImage,
uint32_t aFlags); uint32_t aFlags);

View File

@@ -1953,7 +1953,7 @@ void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder,
: PaintBorderFlags(); : PaintBorderFlags();
// Since this is used only for debugging, we don't need to worry about // Since this is used only for debugging, we don't need to worry about
// tracking the DrawResult. // tracking the ImgDrawResult.
Unused << Unused <<
nsCSSRendering::PaintBorder(presContext, *aCtx, mFrame, mVisibleRect, nsCSSRendering::PaintBorder(presContext, *aCtx, mFrame, mVisibleRect,
rect, styleContext, flags, skipSides); rect, styleContext, flags, skipSides);

View File

@@ -320,7 +320,7 @@ public:
? PaintBorderFlags::SYNC_DECODE_IMAGES ? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags(); : PaintBorderFlags();
DrawResult result = ImgDrawResult result =
nsCSSRendering::PaintBorderWithStyleBorder(mFrame->PresContext(), *aCtx, nsCSSRendering::PaintBorderWithStyleBorder(mFrame->PresContext(), *aCtx,
mFrame, mVisibleRect, mFrame, mVisibleRect,
bounds, bounds,

View File

@@ -626,7 +626,7 @@ nsCSSRendering::ComputePixelRadii(const nscoord *aAppUnitsRadii,
radii[eCornerBottomLeftY]); radii[eCornerBottomLeftY]);
} }
DrawResult ImgDrawResult
nsCSSRendering::PaintBorder(nsPresContext* aPresContext, nsCSSRendering::PaintBorder(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
@@ -762,7 +762,7 @@ nsCSSRendering::CreateWebRenderCommandsForBorder(nsDisplayItem* aItem,
flags |= nsImageRenderer::FLAG_SYNC_DECODE_IMAGES; flags |= nsImageRenderer::FLAG_SYNC_DECODE_IMAGES;
} }
image::DrawResult result; image::ImgDrawResult result;
Maybe<nsCSSBorderImageRenderer> bir = Maybe<nsCSSBorderImageRenderer> bir =
nsCSSBorderImageRenderer::CreateBorderImageRenderer(aForFrame->PresContext(), nsCSSBorderImageRenderer::CreateBorderImageRenderer(aForFrame->PresContext(),
aForFrame, aForFrame,
@@ -886,7 +886,7 @@ ConstructBorderRenderer(nsPresContext* aPresContext,
} }
DrawResult ImgDrawResult
nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext, nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
@@ -910,12 +910,12 @@ nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
if (theme && if (theme &&
theme->ThemeSupportsWidget(aPresContext, aForFrame, theme->ThemeSupportsWidget(aPresContext, aForFrame,
displayData->mAppearance)) { displayData->mAppearance)) {
return DrawResult::SUCCESS; // Let the theme handle it. return ImgDrawResult::SUCCESS; // Let the theme handle it.
} }
} }
if (!aStyleBorder.mBorderImageSource.IsEmpty()) { if (!aStyleBorder.mBorderImageSource.IsEmpty()) {
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
uint32_t irFlags = 0; uint32_t irFlags = 0;
if (aFlags & PaintBorderFlags::SYNC_DECODE_IMAGES) { if (aFlags & PaintBorderFlags::SYNC_DECODE_IMAGES) {
@@ -931,19 +931,19 @@ nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
// renderer was created successfully, which means border image is ready to // renderer was created successfully, which means border image is ready to
// be used. // be used.
if (renderer) { if (renderer) {
MOZ_ASSERT(result == DrawResult::SUCCESS); MOZ_ASSERT(result == ImgDrawResult::SUCCESS);
return renderer->DrawBorderImage(aPresContext, aRenderingContext, return renderer->DrawBorderImage(aPresContext, aRenderingContext,
aForFrame, aDirtyRect); aForFrame, aDirtyRect);
} }
} }
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
// If we had a border-image, but it wasn't loaded, then we should return // If we had a border-image, but it wasn't loaded, then we should return
// DrawResult::NOT_READY; we'll want to try again if we do a paint with sync // ImgDrawResult::NOT_READY; we'll want to try again if we do a paint with sync
// decoding enabled. // decoding enabled.
if (aStyleBorder.mBorderImageSource.GetType() != eStyleImageType_Null) { if (aStyleBorder.mBorderImageSource.GetType() != eStyleImageType_Null) {
result = DrawResult::NOT_READY; result = ImgDrawResult::NOT_READY;
} }
nsMargin border = aStyleBorder.GetComputedBorder(); nsMargin border = aStyleBorder.GetComputedBorder();
@@ -2018,7 +2018,7 @@ nsCSSRendering::PaintBGParams::ForSingleLayer(nsPresContext& aPresCtx,
return result; return result;
} }
DrawResult ImgDrawResult
nsCSSRendering::PaintStyleImageLayer(const PaintBGParams& aParams, nsCSSRendering::PaintStyleImageLayer(const PaintBGParams& aParams,
gfxContext& aRenderingCtx) gfxContext& aRenderingCtx)
{ {
@@ -2035,12 +2035,12 @@ nsCSSRendering::PaintStyleImageLayer(const PaintBGParams& aParams,
// draw the background. The canvas really should be drawing the // draw the background. The canvas really should be drawing the
// bg, but there's no way to hook that up via css. // bg, but there's no way to hook that up via css.
if (!aParams.frame->StyleDisplay()->mAppearance) { if (!aParams.frame->StyleDisplay()->mAppearance) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
nsIContent* content = aParams.frame->GetContent(); nsIContent* content = aParams.frame->GetContent();
if (!content || content->GetParent()) { if (!content || content->GetParent()) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
sc = aParams.frame->StyleContext(); sc = aParams.frame->StyleContext();
@@ -2103,7 +2103,7 @@ nsCSSRendering::CanBuildWebRenderDisplayItemsForStyleImageLayer(LayerManager* aM
return false; return false;
} }
DrawResult ImgDrawResult
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams, nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources, mozilla::wr::IpcResourceUpdateQueue& aResources,
@@ -2122,12 +2122,12 @@ nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams
// draw the background. The canvas really should be drawing the // draw the background. The canvas really should be drawing the
// bg, but there's no way to hook that up via css. // bg, but there's no way to hook that up via css.
if (!aParams.frame->StyleDisplay()->mAppearance) { if (!aParams.frame->StyleDisplay()->mAppearance) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
nsIContent* content = aParams.frame->GetContent(); nsIContent* content = aParams.frame->GetContent();
if (!content || content->GetParent()) { if (!content || content->GetParent()) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
sc = aParams.frame->StyleContext(); sc = aParams.frame->StyleContext();
@@ -2612,7 +2612,7 @@ DetermineCompositionOp(const nsCSSRendering::PaintBGParams& aParams,
return nsCSSRendering::GetGFXBlendMode(layer.mBlendMode); return nsCSSRendering::GetGFXBlendMode(layer.mBlendMode);
} }
DrawResult ImgDrawResult
nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams, nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
gfxContext& aRenderingCtx, gfxContext& aRenderingCtx,
nsStyleContext *aBackgroundSC, nsStyleContext *aBackgroundSC,
@@ -2643,7 +2643,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
theme->DrawWidgetBackground(&aRenderingCtx, aParams.frame, theme->DrawWidgetBackground(&aRenderingCtx, aParams.frame,
displayData->mAppearance, aParams.borderArea, displayData->mAppearance, aParams.borderArea,
drawing); drawing);
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
} }
@@ -2681,7 +2681,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
// true if and only if we are actually supposed to paint an image or // true if and only if we are actually supposed to paint an image or
// color into aDirtyRect, respectively. // color into aDirtyRect, respectively.
if (!drawBackgroundImage && !drawBackgroundColor) if (!drawBackgroundImage && !drawBackgroundColor)
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
// The 'bgClipArea' (used only by the image tiling logic, far below) // The 'bgClipArea' (used only by the image tiling logic, far below)
// is the caller-provided aParams.bgClipRect if any, or else the area // is the caller-provided aParams.bgClipRect if any, or else the area
@@ -2719,13 +2719,13 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
if (!isCanvasFrame) { if (!isCanvasFrame) {
DrawBackgroundColor(clipState, &aRenderingCtx, appUnitsPerPixel); DrawBackgroundColor(clipState, &aRenderingCtx, appUnitsPerPixel);
} }
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
if (layers.mImageCount < 1) { if (layers.mImageCount < 1) {
// Return if there are no background layers, all work from this point // Return if there are no background layers, all work from this point
// onwards happens iteratively on these. // onwards happens iteratively on these.
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
MOZ_ASSERT((aParams.layer < 0) || MOZ_ASSERT((aParams.layer < 0) ||
@@ -2762,7 +2762,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
::BoxDecorationRectForBorder(aParams.frame, aParams.borderArea, ::BoxDecorationRectForBorder(aParams.frame, aParams.borderArea,
skipSides, &aBorder); skipSides, &aBorder);
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
StyleGeometryBox currentBackgroundClip = StyleGeometryBox::BorderBox; StyleGeometryBox currentBackgroundClip = StyleGeometryBox::BorderBox;
uint32_t count = drawAllLayers uint32_t count = drawAllLayers
? layers.mImageCount // iterate all image layers. ? layers.mImageCount // iterate all image layers.
@@ -2849,7 +2849,7 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
return result; return result;
} }
DrawResult ImgDrawResult
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams, nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources, mozilla::wr::IpcResourceUpdateQueue& aResources,
@@ -2884,10 +2884,10 @@ nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBG
// Skip the following layer painting code if we found the dirty region is // Skip the following layer painting code if we found the dirty region is
// empty or the current layer is not selected for drawing. // empty or the current layer is not selected for drawing.
if (clipState.mDirtyRectInDevPx.IsEmpty()) { if (clipState.mDirtyRectInDevPx.IsEmpty()) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
nsBackgroundLayerState state = nsBackgroundLayerState state =
PrepareImageLayer(&aParams.presCtx, aParams.frame, PrepareImageLayer(&aParams.presCtx, aParams.frame,
aParams.paintFlags, paintBorderArea, aParams.paintFlags, paintBorderArea,

View File

@@ -107,7 +107,7 @@ struct nsCSSRendering {
typedef mozilla::gfx::Size Size; typedef mozilla::gfx::Size Size;
typedef mozilla::gfx::RectCornerRadii RectCornerRadii; typedef mozilla::gfx::RectCornerRadii RectCornerRadii;
typedef mozilla::layers::LayerManager LayerManager; typedef mozilla::layers::LayerManager LayerManager;
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef nsIFrame::Sides Sides; typedef nsIFrame::Sides Sides;
/** /**
@@ -162,7 +162,7 @@ struct nsCSSRendering {
* for borders. aSkipSides says which sides to skip * for borders. aSkipSides says which sides to skip
* when rendering, the default is to skip none. * when rendering, the default is to skip none.
*/ */
static DrawResult PaintBorder(nsPresContext* aPresContext, static ImgDrawResult PaintBorder(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
@@ -176,7 +176,7 @@ struct nsCSSRendering {
* getting it from aStyleContext. aSkipSides says which sides to skip * getting it from aStyleContext. aSkipSides says which sides to skip
* when rendering, the default is to skip none. * when rendering, the default is to skip none.
*/ */
static DrawResult PaintBorderWithStyleBorder(nsPresContext* aPresContext, static ImgDrawResult PaintBorderWithStyleBorder(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
@@ -494,7 +494,7 @@ struct nsCSSRendering {
opacity(aOpacity) {} opacity(aOpacity) {}
}; };
static DrawResult PaintStyleImageLayer(const PaintBGParams& aParams, static ImgDrawResult PaintStyleImageLayer(const PaintBGParams& aParams,
gfxContext& aRenderingCtx); gfxContext& aRenderingCtx);
/** /**
@@ -510,7 +510,7 @@ struct nsCSSRendering {
* If all layers are painted, the image layer's blend mode (or the mask * If all layers are painted, the image layer's blend mode (or the mask
* layer's composition mode) will be used. * layer's composition mode) will be used.
*/ */
static DrawResult PaintStyleImageLayerWithSC(const PaintBGParams& aParams, static ImgDrawResult PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
gfxContext& aRenderingCtx, gfxContext& aRenderingCtx,
nsStyleContext *mBackgroundSC, nsStyleContext *mBackgroundSC,
const nsStyleBorder& aBorder); const nsStyleBorder& aBorder);
@@ -520,14 +520,14 @@ struct nsCSSRendering {
nsIFrame *aFrame, nsIFrame *aFrame,
const nsStyleBackground* aBackgroundStyle, const nsStyleBackground* aBackgroundStyle,
int32_t aLayer); int32_t aLayer);
static DrawResult BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams, static ImgDrawResult BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources, mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc, const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager, mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem); nsDisplayItem* aItem);
static DrawResult BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams, static ImgDrawResult BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources, mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc, const mozilla::layers::StackingContextHelper& aSc,

View File

@@ -3645,12 +3645,12 @@ nsCSSBorderImageRenderer::CreateBorderImageRenderer(nsPresContext* aPresContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
Sides aSkipSides, Sides aSkipSides,
uint32_t aFlags, uint32_t aFlags,
DrawResult* aDrawResult) ImgDrawResult* aDrawResult)
{ {
MOZ_ASSERT(aDrawResult); MOZ_ASSERT(aDrawResult);
if (aDirtyRect.IsEmpty()) { if (aDirtyRect.IsEmpty()) {
*aDrawResult = DrawResult::SUCCESS; *aDrawResult = ImgDrawResult::SUCCESS;
return Nothing(); return Nothing();
} }
@@ -3670,11 +3670,11 @@ nsCSSBorderImageRenderer::CreateBorderImageRenderer(nsPresContext* aPresContext,
nsCSSBorderImageRenderer renderer(aForFrame, aBorderArea, nsCSSBorderImageRenderer renderer(aForFrame, aBorderArea,
aStyleBorder, aSkipSides, imgRenderer); aStyleBorder, aSkipSides, imgRenderer);
*aDrawResult = DrawResult::SUCCESS; *aDrawResult = ImgDrawResult::SUCCESS;
return Some(renderer); return Some(renderer);
} }
DrawResult ImgDrawResult
nsCSSBorderImageRenderer::DrawBorderImage(nsPresContext* aPresContext, nsCSSBorderImageRenderer::DrawBorderImage(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,
@@ -3750,7 +3750,7 @@ nsCSSBorderImageRenderer::DrawBorderImage(nsPresContext* aPresContext,
mSlice.bottom, mSlice.bottom,
}; };
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
for (int i = LEFT; i <= RIGHT; i++) { for (int i = LEFT; i <= RIGHT; i++) {
for (int j = TOP; j <= BOTTOM; j++) { for (int j = TOP; j <= BOTTOM; j++) {

View File

@@ -303,9 +303,9 @@ public:
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsIFrame::Sides aSkipSides, nsIFrame::Sides aSkipSides,
uint32_t aFlags, uint32_t aFlags,
mozilla::image::DrawResult* aDrawResult); mozilla::image::ImgDrawResult* aDrawResult);
mozilla::image::DrawResult mozilla::image::ImgDrawResult
DrawBorderImage(nsPresContext* aPresContext, DrawBorderImage(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
nsIFrame* aForFrame, nsIFrame* aForFrame,

View File

@@ -4037,7 +4037,7 @@ nsDisplayBackgroundImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilde
StyleFrame(), mImageFlags, mLayer, StyleFrame(), mImageFlags, mLayer,
CompositionOp::OP_OVER); CompositionOp::OP_OVER);
params.bgClipRect = &mBounds; params.bgClipRect = &mBounds;
DrawResult result = ImgDrawResult result =
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aResources, aSc, aManager, this); nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aResources, aSc, aManager, this);
nsDisplayBackgroundGeometry::UpdateDrawResult(this, result); nsDisplayBackgroundGeometry::UpdateDrawResult(this, result);
@@ -4200,7 +4200,7 @@ nsDisplayBackgroundImage::PaintInternal(nsDisplayListBuilder* aBuilder,
StyleFrame(), mImageFlags, mLayer, StyleFrame(), mImageFlags, mLayer,
CompositionOp::OP_OVER); CompositionOp::OP_OVER);
params.bgClipRect = aClipRect; params.bgClipRect = aClipRect;
DrawResult result = nsCSSRendering::PaintStyleImageLayer(params, *aCtx); ImgDrawResult result = nsCSSRendering::PaintStyleImageLayer(params, *aCtx);
if (clip == StyleGeometryBox::Text) { if (clip == StyleGeometryBox::Text) {
ctx->PopGroupAndBlend(); ctx->PopGroupAndBlend();
@@ -4501,7 +4501,7 @@ nsDisplayImageContainer::ConfigureLayer(ImageLayer* aLayer,
if (imageWidth > 0 && imageHeight > 0) { if (imageWidth > 0 && imageHeight > 0) {
// We're actually using the ImageContainer. Let our frame know that it // We're actually using the ImageContainer. Let our frame know that it
// should consider itself to have painted successfully. // should consider itself to have painted successfully.
nsDisplayBackgroundGeometry::UpdateDrawResult(this, DrawResult::SUCCESS); nsDisplayBackgroundGeometry::UpdateDrawResult(this, ImgDrawResult::SUCCESS);
} }
// XXX(seth): Right now we ignore aParameters.Scale() and // XXX(seth): Right now we ignore aParameters.Scale() and
@@ -5677,7 +5677,7 @@ nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
? PaintBorderFlags::SYNC_DECODE_IMAGES ? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags(); : PaintBorderFlags();
DrawResult result = ImgDrawResult result =
nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame, nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame,
mVisibleRect, mVisibleRect,
nsRect(offset, mFrame->GetSize()), nsRect(offset, mFrame->GetSize()),
@@ -9584,7 +9584,7 @@ nsDisplayMask::PaintMask(nsDisplayListBuilder* aBuilder,
nsDisplayMaskGeometry::UpdateDrawResult(this, imgParmas.result); nsDisplayMaskGeometry::UpdateDrawResult(this, imgParmas.result);
return imgParmas.result == mozilla::image::DrawResult::SUCCESS; return imgParmas.result == mozilla::image::ImgDrawResult::SUCCESS;
} }
LayerState LayerState

View File

@@ -1884,7 +1884,7 @@ public:
typedef mozilla::layers::WebRenderParentCommand WebRenderParentCommand; typedef mozilla::layers::WebRenderParentCommand WebRenderParentCommand;
typedef mozilla::LayerState LayerState; typedef mozilla::LayerState LayerState;
typedef mozilla::image::imgDrawingParams imgDrawingParams; typedef mozilla::image::imgDrawingParams imgDrawingParams;
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef class mozilla::gfx::DrawTarget DrawTarget; typedef class mozilla::gfx::DrawTarget DrawTarget;
// This is never instantiated directly (it has pure virtual methods), so no // This is never instantiated directly (it has pure virtual methods), so no

View File

@@ -105,7 +105,7 @@ class nsImageGeometryMixin
{ {
public: public:
nsImageGeometryMixin(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder) nsImageGeometryMixin(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
: mLastDrawResult(mozilla::image::DrawResult::NOT_READY) : mLastDrawResult(mozilla::image::ImgDrawResult::NOT_READY)
, mWaitingForPaint(false) , mWaitingForPaint(false)
{ {
// Transfer state from the previous version of this geometry item. // Transfer state from the previous version of this geometry item.
@@ -126,7 +126,7 @@ public:
} }
static void UpdateDrawResult(nsDisplayItem* aItem, static void UpdateDrawResult(nsDisplayItem* aItem,
mozilla::image::DrawResult aResult) mozilla::image::ImgDrawResult aResult)
{ {
auto lastGeometry = auto lastGeometry =
static_cast<T*>(mozilla::FrameLayerBuilder::GetMostRecentGeometry(aItem)); static_cast<T*>(mozilla::FrameLayerBuilder::GetMostRecentGeometry(aItem));
@@ -147,8 +147,8 @@ public:
return false; return false;
} }
if (mLastDrawResult == mozilla::image::DrawResult::SUCCESS || if (mLastDrawResult == mozilla::image::ImgDrawResult::SUCCESS ||
mLastDrawResult == mozilla::image::DrawResult::BAD_IMAGE) { mLastDrawResult == mozilla::image::ImgDrawResult::BAD_IMAGE) {
return false; return false;
} }
@@ -156,7 +156,7 @@ public:
} }
private: private:
mozilla::image::DrawResult mLastDrawResult; mozilla::image::ImgDrawResult mLastDrawResult;
bool mWaitingForPaint; bool mWaitingForPaint;
}; };

View File

@@ -60,7 +60,7 @@ nsImageRenderer::nsImageRenderer(nsIFrame* aForFrame,
, mImageContainer(nullptr) , mImageContainer(nullptr)
, mGradientData(nullptr) , mGradientData(nullptr)
, mPaintServerFrame(nullptr) , mPaintServerFrame(nullptr)
, mPrepareResult(DrawResult::NOT_READY) , mPrepareResult(ImgDrawResult::NOT_READY)
, mSize(0, 0) , mSize(0, 0)
, mFlags(aFlags) , mFlags(aFlags)
, mExtendMode(ExtendMode::CLAMP) , mExtendMode(ExtendMode::CLAMP)
@@ -115,7 +115,7 @@ bool
nsImageRenderer::PrepareImage() nsImageRenderer::PrepareImage()
{ {
if (mImage->IsEmpty()) { if (mImage->IsEmpty()) {
mPrepareResult = DrawResult::BAD_IMAGE; mPrepareResult = ImgDrawResult::BAD_IMAGE;
return false; return false;
} }
@@ -129,7 +129,7 @@ nsImageRenderer::PrepareImage()
// on through because the Draw() will do a sync decode then. // on through because the Draw() will do a sync decode then.
if (!(frameComplete || mImage->IsComplete()) && if (!(frameComplete || mImage->IsComplete()) &&
!ShouldTreatAsCompleteDueToSyncDecode(mImage, mFlags)) { !ShouldTreatAsCompleteDueToSyncDecode(mImage, mFlags)) {
mPrepareResult = DrawResult::NOT_READY; mPrepareResult = ImgDrawResult::NOT_READY;
return false; return false;
} }
} }
@@ -154,7 +154,7 @@ nsImageRenderer::PrepareImage()
mImage->ComputeActualCropRect(actualCropRect, &isEntireImage); mImage->ComputeActualCropRect(actualCropRect, &isEntireImage);
if (!success || actualCropRect.IsEmpty()) { if (!success || actualCropRect.IsEmpty()) {
// The cropped image has zero size // The cropped image has zero size
mPrepareResult = DrawResult::BAD_IMAGE; mPrepareResult = ImgDrawResult::BAD_IMAGE;
return false; return false;
} }
if (isEntireImage) { if (isEntireImage) {
@@ -167,12 +167,12 @@ nsImageRenderer::PrepareImage()
mImageContainer.swap(subImage); mImageContainer.swap(subImage);
} }
} }
mPrepareResult = DrawResult::SUCCESS; mPrepareResult = ImgDrawResult::SUCCESS;
break; break;
} }
case eStyleImageType_Gradient: case eStyleImageType_Gradient:
mGradientData = mImage->GetGradientData(); mGradientData = mImage->GetGradientData();
mPrepareResult = DrawResult::SUCCESS; mPrepareResult = ImgDrawResult::SUCCESS;
break; break;
case eStyleImageType_Element: case eStyleImageType_Element:
{ {
@@ -186,7 +186,7 @@ nsImageRenderer::PrepareImage()
targetURI, mForFrame->FirstContinuation(), targetURI, mForFrame->FirstContinuation(),
SVGObserverUtils::BackgroundImageProperty()); SVGObserverUtils::BackgroundImageProperty());
if (!property) { if (!property) {
mPrepareResult = DrawResult::BAD_IMAGE; mPrepareResult = ImgDrawResult::BAD_IMAGE;
return false; return false;
} }
@@ -202,13 +202,13 @@ nsImageRenderer::PrepareImage()
(paintServerFrame->IsFrameOfType(nsIFrame::eSVG) && (paintServerFrame->IsFrameOfType(nsIFrame::eSVG) &&
!paintServerFrame->IsFrameOfType(nsIFrame::eSVGPaintServer) && !paintServerFrame->IsFrameOfType(nsIFrame::eSVGPaintServer) &&
!static_cast<nsSVGDisplayableFrame*>(do_QueryFrame(paintServerFrame)))) { !static_cast<nsSVGDisplayableFrame*>(do_QueryFrame(paintServerFrame)))) {
mPrepareResult = DrawResult::BAD_IMAGE; mPrepareResult = ImgDrawResult::BAD_IMAGE;
return false; return false;
} }
mPaintServerFrame = paintServerFrame; mPaintServerFrame = paintServerFrame;
} }
mPrepareResult = DrawResult::SUCCESS; mPrepareResult = ImgDrawResult::SUCCESS;
break; break;
} }
case eStyleImageType_Null: case eStyleImageType_Null:
@@ -441,7 +441,7 @@ ConvertImageRendererToDrawFlags(uint32_t aImageRendererFlags)
return drawFlags; return drawFlags;
} }
DrawResult ImgDrawResult
nsImageRenderer::Draw(nsPresContext* aPresContext, nsImageRenderer::Draw(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
@@ -454,15 +454,15 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
{ {
if (!IsReady()) { if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me"); NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
if (aDest.IsEmpty() || aFill.IsEmpty() || if (aDest.IsEmpty() || aFill.IsEmpty() ||
mSize.width <= 0 || mSize.height <= 0) { mSize.width <= 0 || mSize.height <= 0) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
SamplingFilter samplingFilter = nsLayoutUtils::GetSamplingFilterForFrame(mForFrame); SamplingFilter samplingFilter = nsLayoutUtils::GetSamplingFilterForFrame(mForFrame);
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
RefPtr<gfxContext> ctx = &aRenderingContext; RefPtr<gfxContext> ctx = &aRenderingContext;
IntRect tmpDTRect; IntRect tmpDTRect;
@@ -470,7 +470,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
gfxRect clipRect = ctx->GetClipExtents(gfxContext::eDeviceSpace); gfxRect clipRect = ctx->GetClipExtents(gfxContext::eDeviceSpace);
tmpDTRect = RoundedOut(ToRect(clipRect)); tmpDTRect = RoundedOut(ToRect(clipRect));
if (tmpDTRect.IsEmpty()) { if (tmpDTRect.IsEmpty()) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
RefPtr<DrawTarget> tempDT = RefPtr<DrawTarget> tempDT =
gfxPlatform::GetPlatform()->CreateSimilarSoftwareDrawTarget(ctx->GetDrawTarget(), gfxPlatform::GetPlatform()->CreateSimilarSoftwareDrawTarget(ctx->GetDrawTarget(),
@@ -478,13 +478,13 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
SurfaceFormat::B8G8R8A8); SurfaceFormat::B8G8R8A8);
if (!tempDT || !tempDT->IsValid()) { if (!tempDT || !tempDT->IsValid()) {
gfxDevCrash(LogReason::InvalidContext) << "ImageRenderer::Draw problem " << gfx::hexa(tempDT); gfxDevCrash(LogReason::InvalidContext) << "ImageRenderer::Draw problem " << gfx::hexa(tempDT);
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
tempDT->SetTransform(ctx->GetDrawTarget()->GetTransform() * Matrix::Translation(-tmpDTRect.TopLeft())); tempDT->SetTransform(ctx->GetDrawTarget()->GetTransform() * Matrix::Translation(-tmpDTRect.TopLeft()));
ctx = gfxContext::CreatePreservingTransformOrNull(tempDT); ctx = gfxContext::CreatePreservingTransformOrNull(tempDT);
if (!ctx) { if (!ctx) {
gfxDevCrash(LogReason::InvalidContext) << "ImageRenderer::Draw problem " << gfx::hexa(tempDT); gfxDevCrash(LogReason::InvalidContext) << "ImageRenderer::Draw problem " << gfx::hexa(tempDT);
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
} }
@@ -517,7 +517,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
RefPtr<gfxDrawable> drawable = DrawableForElement(aDest, *ctx); RefPtr<gfxDrawable> drawable = DrawableForElement(aDest, *ctx);
if (!drawable) { if (!drawable) {
NS_WARNING("Could not create drawable for element"); NS_WARNING("Could not create drawable for element");
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
nsCOMPtr<imgIContainer> image(ImageOps::CreateFromDrawable(drawable)); nsCOMPtr<imgIContainer> image(ImageOps::CreateFromDrawable(drawable));
@@ -556,7 +556,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
return result; return result;
} }
DrawResult ImgDrawResult
nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext, nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources, mozilla::wr::IpcResourceUpdateQueue& aResources,
@@ -573,11 +573,11 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
{ {
if (!IsReady()) { if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me"); NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
return DrawResult::NOT_READY; return ImgDrawResult::NOT_READY;
} }
if (aDest.IsEmpty() || aFill.IsEmpty() || if (aDest.IsEmpty() || aFill.IsEmpty() ||
mSize.width <= 0 || mSize.height <= 0) { mSize.width <= 0 || mSize.height <= 0) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
switch (mType) { switch (mType) {
@@ -611,7 +611,7 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mImageContainer->GetImageContainerAtSize(aManager, decodeSize, svgContext, containerFlags); mImageContainer->GetImageContainerAtSize(aManager, decodeSize, svgContext, containerFlags);
if (!container) { if (!container) {
NS_WARNING("Failed to get image container"); NS_WARNING("Failed to get image container");
return DrawResult::NOT_READY; return ImgDrawResult::NOT_READY;
} }
gfx::IntSize size; gfx::IntSize size;
@@ -619,7 +619,7 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
aResources, aSc, size, Nothing()); aResources, aSc, size, Nothing());
if (key.isNothing()) { if (key.isNothing()) {
return DrawResult::BAD_IMAGE; return ImgDrawResult::BAD_IMAGE;
} }
nsPoint firstTilePos = nsLayoutUtils::GetBackgroundFirstTilePos(aDest.TopLeft(), nsPoint firstTilePos = nsLayoutUtils::GetBackgroundFirstTilePos(aDest.TopLeft(),
@@ -646,7 +646,7 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
break; break;
} }
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
already_AddRefed<gfxDrawable> already_AddRefed<gfxDrawable>
@@ -657,7 +657,7 @@ nsImageRenderer::DrawableForElement(const nsRect& aImageRect,
"DrawableForElement only makes sense if backed by an element"); "DrawableForElement only makes sense if backed by an element");
if (mPaintServerFrame) { if (mPaintServerFrame) {
// XXX(seth): In order to not pass FLAG_SYNC_DECODE_IMAGES here, // XXX(seth): In order to not pass FLAG_SYNC_DECODE_IMAGES here,
// DrawableFromPaintServer would have to return a DrawResult indicating // DrawableFromPaintServer would have to return a ImgDrawResult indicating
// whether any images could not be painted because they weren't fully // whether any images could not be painted because they weren't fully
// decoded. Even always passing FLAG_SYNC_DECODE_IMAGES won't eliminate all // decoded. Even always passing FLAG_SYNC_DECODE_IMAGES won't eliminate all
// problems, as it won't help if there are image which haven't finished // problems, as it won't help if there are image which haven't finished
@@ -682,7 +682,7 @@ nsImageRenderer::DrawableForElement(const nsRect& aImageRect,
return drawable.forget(); return drawable.forget();
} }
DrawResult ImgDrawResult
nsImageRenderer::DrawLayer(nsPresContext* aPresContext, nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDest, const nsRect& aDest,
@@ -694,11 +694,11 @@ nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
{ {
if (!IsReady()) { if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me"); NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
if (aDest.IsEmpty() || aFill.IsEmpty() || if (aDest.IsEmpty() || aFill.IsEmpty() ||
mSize.width <= 0 || mSize.height <= 0) { mSize.width <= 0 || mSize.height <= 0) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
return Draw(aPresContext, aRenderingContext, return Draw(aPresContext, aRenderingContext,
@@ -709,7 +709,7 @@ nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
aOpacity); aOpacity);
} }
DrawResult ImgDrawResult
nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext, nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources, mozilla::wr::IpcResourceUpdateQueue& aResources,
@@ -729,7 +729,7 @@ nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresCo
} }
if (aDest.IsEmpty() || aFill.IsEmpty() || if (aDest.IsEmpty() || aFill.IsEmpty() ||
mSize.width <= 0 || mSize.height <= 0) { mSize.width <= 0 || mSize.height <= 0) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
return BuildWebRenderDisplayItems(aPresContext, aBuilder, aResources, aSc, return BuildWebRenderDisplayItems(aPresContext, aBuilder, aResources, aSc,
aManager, aItem, aManager, aItem,
@@ -844,7 +844,7 @@ RequiresScaling(const nsRect& aFill,
aUnitSize.height != aFill.height); aUnitSize.height != aFill.height);
} }
DrawResult ImgDrawResult
nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext, nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
@@ -859,10 +859,10 @@ nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
{ {
if (!IsReady()) { if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me"); NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
return DrawResult::BAD_ARGS; return ImgDrawResult::BAD_ARGS;
} }
if (aFill.IsEmpty() || aSrc.IsEmpty()) { if (aFill.IsEmpty() || aSrc.IsEmpty()) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
if (mType == eStyleImageType_Image || mType == eStyleImageType_Element) { if (mType == eStyleImageType_Image || mType == eStyleImageType_Element) {
@@ -903,7 +903,7 @@ nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
aRenderingContext); aRenderingContext);
if (!drawable) { if (!drawable) {
NS_WARNING("Could not create drawable for element"); NS_WARNING("Could not create drawable for element");
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
nsCOMPtr<imgIContainer> image(ImageOps::CreateFromDrawable(drawable)); nsCOMPtr<imgIContainer> image(ImageOps::CreateFromDrawable(drawable));

View File

@@ -101,7 +101,7 @@ struct CSSSizeOrRatio
*/ */
class nsImageRenderer { class nsImageRenderer {
public: public:
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef mozilla::layers::LayerManager LayerManager; typedef mozilla::layers::LayerManager LayerManager;
typedef mozilla::layers::ImageContainer ImageContainer; typedef mozilla::layers::ImageContainer ImageContainer;
@@ -195,7 +195,7 @@ public:
* {background|mask}-specific arguments. * {background|mask}-specific arguments.
* @see nsLayoutUtils::DrawImage() for parameters. * @see nsLayoutUtils::DrawImage() for parameters.
*/ */
DrawResult DrawLayer(nsPresContext* aPresContext, ImgDrawResult DrawLayer(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDest, const nsRect& aDest,
const nsRect& aFill, const nsRect& aFill,
@@ -209,7 +209,7 @@ public:
* {background|mask}-specific arguments. * {background|mask}-specific arguments.
* @see nsLayoutUtils::DrawImage() for parameters. * @see nsLayoutUtils::DrawImage() for parameters.
*/ */
DrawResult BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext, ImgDrawResult BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResource, mozilla::wr::IpcResourceUpdateQueue& aResource,
const mozilla::layers::StackingContextHelper& aSc, const mozilla::layers::StackingContextHelper& aSc,
@@ -241,7 +241,7 @@ public:
* aHasIntrinsicRatio is used to record if the source image has fixed * aHasIntrinsicRatio is used to record if the source image has fixed
* intrinsic ratio. * intrinsic ratio.
*/ */
DrawResult ImgDrawResult
DrawBorderImageComponent(nsPresContext* aPresContext, DrawBorderImageComponent(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
@@ -261,8 +261,8 @@ public:
already_AddRefed<imgIContainer> GetImage(); already_AddRefed<imgIContainer> GetImage();
bool IsImageContainerAvailable(layers::LayerManager* aManager, uint32_t aFlags); bool IsImageContainerAvailable(layers::LayerManager* aManager, uint32_t aFlags);
bool IsReady() const { return mPrepareResult == DrawResult::SUCCESS; } bool IsReady() const { return mPrepareResult == ImgDrawResult::SUCCESS; }
DrawResult PrepareResult() const { return mPrepareResult; } ImgDrawResult PrepareResult() const { return mPrepareResult; }
void SetExtendMode(mozilla::gfx::ExtendMode aMode) { mExtendMode = aMode; } void SetExtendMode(mozilla::gfx::ExtendMode aMode) { mExtendMode = aMode; }
void SetMaskOp(uint8_t aMaskOp) { mMaskOp = aMaskOp; } void SetMaskOp(uint8_t aMaskOp) { mMaskOp = aMaskOp; }
void PurgeCacheForViewportChange(const mozilla::Maybe<nsSize>& aSVGViewportSize, void PurgeCacheForViewportChange(const mozilla::Maybe<nsSize>& aSVGViewportSize,
@@ -278,7 +278,7 @@ private:
* *
* @see nsLayoutUtils::DrawImage() for other parameters. * @see nsLayoutUtils::DrawImage() for other parameters.
*/ */
DrawResult Draw(nsPresContext* aPresContext, ImgDrawResult Draw(nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
const nsRect& aDest, const nsRect& aDest,
@@ -295,7 +295,7 @@ private:
* *
* @see nsLayoutUtils::DrawImage() for other parameters. * @see nsLayoutUtils::DrawImage() for other parameters.
*/ */
DrawResult BuildWebRenderDisplayItems(nsPresContext* aPresContext, ImgDrawResult BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources, mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc, const mozilla::layers::StackingContextHelper& aSc,
@@ -325,7 +325,7 @@ private:
RefPtr<nsStyleGradient> mGradientData; RefPtr<nsStyleGradient> mGradientData;
nsIFrame* mPaintServerFrame; nsIFrame* mPaintServerFrame;
nsLayoutUtils::SurfaceFromElementResult mImageElementSurface; nsLayoutUtils::SurfaceFromElementResult mImageElementSurface;
DrawResult mPrepareResult; ImgDrawResult mPrepareResult;
nsSize mSize; // unscaled size of the image, in app units nsSize mSize; // unscaled size of the image, in app units
uint32_t mFlags; uint32_t mFlags;
mozilla::gfx::ExtendMode mExtendMode; mozilla::gfx::ExtendMode mExtendMode;

View File

@@ -18,7 +18,7 @@
#include "nsColor.h" #include "nsColor.h"
#include "nsStyleStruct.h" #include "nsStyleStruct.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "DrawResult.h" #include "ImgDrawResult.h"
class gfxContext; class gfxContext;
class nsIDocument; class nsIDocument;

View File

@@ -11,7 +11,7 @@
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
// Keep others in (case-insensitive) order: // Keep others in (case-insensitive) order:
#include "DrawResult.h" #include "ImgDrawResult.h"
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#include "gfxContext.h" #include "gfxContext.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"

View File

@@ -9,7 +9,7 @@
// Keep others in (case-insensitive) order: // Keep others in (case-insensitive) order:
#include "AutoReferenceChainGuard.h" #include "AutoReferenceChainGuard.h"
#include "DrawResult.h" #include "ImgDrawResult.h"
#include "gfxContext.h" #include "gfxContext.h"
#include "mozilla/dom/SVGClipPathElement.h" #include "mozilla/dom/SVGClipPathElement.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"

View File

@@ -8,7 +8,7 @@
#include "nsSVGContainerFrame.h" #include "nsSVGContainerFrame.h"
// Keep others in (case-insensitive) order: // Keep others in (case-insensitive) order:
#include "DrawResult.h" #include "ImgDrawResult.h"
#include "mozilla/RestyleManager.h" #include "mozilla/RestyleManager.h"
#include "mozilla/RestyleManagerInlines.h" #include "mozilla/RestyleManagerInlines.h"
#include "nsCSSFrameConstructor.h" #include "nsCSSFrameConstructor.h"

View File

@@ -8,7 +8,7 @@
#include "nsSVGForeignObjectFrame.h" #include "nsSVGForeignObjectFrame.h"
// Keep others in (case-insensitive) order: // Keep others in (case-insensitive) order:
#include "DrawResult.h" #include "ImgDrawResult.h"
#include "gfxContext.h" #include "gfxContext.h"
#include "nsDisplayList.h" #include "nsDisplayList.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"

View File

@@ -504,7 +504,7 @@ PaintMaskSurface(const PaintFramesParams& aParams,
nsCSSRendering::PaintStyleImageLayerWithSC(params, *maskContext, aSC, nsCSSRendering::PaintStyleImageLayerWithSC(params, *maskContext, aSC,
*aParams.frame->StyleBorder()); *aParams.frame->StyleBorder());
} else { } else {
aParams.imgParams.result &= DrawResult::NOT_READY; aParams.imgParams.result &= ImgDrawResult::NOT_READY;
} }
} }
} }
@@ -581,7 +581,7 @@ CreateAndPaintMaskSurface(const PaintFramesParams& aParams,
aSC, aMaskFrames, maskSurfaceMatrix, aSC, aMaskFrames, maskSurfaceMatrix,
aOffsetToUserSpace); aOffsetToUserSpace);
if (aParams.imgParams.result != DrawResult::SUCCESS) { if (aParams.imgParams.result != ImgDrawResult::SUCCESS) {
// Now we know the status of mask resource since we used it while painting. // Now we know the status of mask resource since we used it while painting.
// According to the return value of PaintMaskSurface, we know whether mask // According to the return value of PaintMaskSurface, we know whether mask
// resource is resolvable or not. // resource is resolvable or not.

View File

@@ -7,7 +7,7 @@
#ifndef NSSVGINTEGRATIONUTILS_H_ #ifndef NSSVGINTEGRATIONUTILS_H_
#define NSSVGINTEGRATIONUTILS_H_ #define NSSVGINTEGRATIONUTILS_H_
#include "DrawResult.h" #include "ImgDrawResult.h"
#include "gfxMatrix.h" #include "gfxMatrix.h"
#include "gfxRect.h" #include "gfxRect.h"
#include "nsRegionFwd.h" #include "nsRegionFwd.h"

View File

@@ -73,7 +73,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
nsSVGUtils::ConvertToSurfaceSize(maskSurfaceRect.Size(), &resultOverflows); nsSVGUtils::ConvertToSurfaceSize(maskSurfaceRect.Size(), &resultOverflows);
if (resultOverflows || maskSurfaceSize.IsEmpty()) { if (resultOverflows || maskSurfaceSize.IsEmpty()) {
// Return value other then DrawResult::SUCCESS, so the caller can skip // Return value other then ImgDrawResult::SUCCESS, so the caller can skip
// painting the masked frame(aParams.maskedFrame). // painting the masked frame(aParams.maskedFrame).
return nullptr; return nullptr;
} }

View File

@@ -11,7 +11,7 @@
#include <math.h> #include <math.h>
#include "DrawMode.h" #include "DrawMode.h"
#include "DrawResult.h" #include "ImgDrawResult.h"
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#include "gfxMatrix.h" #include "gfxMatrix.h"
#include "gfxPoint.h" #include "gfxPoint.h"

View File

@@ -366,7 +366,7 @@ nsTableCellFrame::DecorateForSelection(DrawTarget* aDrawTarget, nsPoint aPt)
} }
} }
DrawResult ImgDrawResult
nsTableCellFrame::PaintBackground(gfxContext& aRenderingContext, nsTableCellFrame::PaintBackground(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsPoint aPt, nsPoint aPt,
@@ -426,7 +426,7 @@ public:
void nsDisplayTableCellBackground::Paint(nsDisplayListBuilder* aBuilder, void nsDisplayTableCellBackground::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) gfxContext* aCtx)
{ {
DrawResult result = static_cast<nsTableCellFrame*>(mFrame)-> ImgDrawResult result = static_cast<nsTableCellFrame*>(mFrame)->
PaintBackground(*aCtx, mVisibleRect, ToReferenceFrame(), PaintBackground(*aCtx, mVisibleRect, ToReferenceFrame(),
aBuilder->GetBackgroundPaintFlags()); aBuilder->GetBackgroundPaintFlags());
@@ -1173,7 +1173,7 @@ nsBCTableCellFrame::GetBorderOverflow()
return halfBorder.GetPhysicalMargin(wm); return halfBorder.GetPhysicalMargin(wm);
} }
DrawResult ImgDrawResult
nsBCTableCellFrame::PaintBackground(gfxContext& aRenderingContext, nsBCTableCellFrame::PaintBackground(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsPoint aPt, nsPoint aPt,

View File

@@ -35,7 +35,7 @@ class nsTableCellFrame : public nsContainerFrame,
public nsIPercentBSizeObserver public nsIPercentBSizeObserver
{ {
typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::DrawTarget DrawTarget;
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
friend nsTableCellFrame* NS_NewTableCellFrame(nsIPresShell* aPresShell, friend nsTableCellFrame* NS_NewTableCellFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext, nsStyleContext* aContext,
@@ -229,7 +229,7 @@ public:
virtual LogicalMargin GetBorderWidth(WritingMode aWM) const; virtual LogicalMargin GetBorderWidth(WritingMode aWM) const;
virtual DrawResult PaintBackground(gfxContext& aRenderingContext, virtual ImgDrawResult PaintBackground(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsPoint aPt, nsPoint aPt,
uint32_t aFlags); uint32_t aFlags);
@@ -322,7 +322,7 @@ inline void nsTableCellFrame::SetHasPctOverBSize(bool aValue)
// nsBCTableCellFrame // nsBCTableCellFrame
class nsBCTableCellFrame final : public nsTableCellFrame class nsBCTableCellFrame final : public nsTableCellFrame
{ {
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
public: public:
NS_DECL_FRAMEARENA_HELPERS(nsBCTableCellFrame) NS_DECL_FRAMEARENA_HELPERS(nsBCTableCellFrame)
@@ -347,7 +347,7 @@ public:
virtual nsresult GetFrameName(nsAString& aResult) const override; virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif #endif
virtual DrawResult PaintBackground(gfxContext& aRenderingContext, virtual ImgDrawResult PaintBackground(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsPoint aPt, nsPoint aPt,
uint32_t aFlags) override; uint32_t aFlags) override;

View File

@@ -123,7 +123,7 @@ enum nsTableColType {
*/ */
class nsTableFrame : public nsContainerFrame class nsTableFrame : public nsContainerFrame
{ {
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef mozilla::WritingMode WritingMode; typedef mozilla::WritingMode WritingMode;
typedef mozilla::LogicalMargin LogicalMargin; typedef mozilla::LogicalMargin LogicalMargin;
typedef mozilla::TableReflowInput TableReflowInput; typedef mozilla::TableReflowInput TableReflowInput;

View File

@@ -40,7 +40,7 @@ public:
virtual bool HonorPrintBackgroundSettings() override { return false; } virtual bool HonorPrintBackgroundSettings() override { return false; }
DrawResult PaintBorder(gfxContext& aRenderingContext, ImgDrawResult PaintBorder(gfxContext& aRenderingContext,
nsPoint aPt, nsPoint aPt,
const nsRect& aDirtyRect); const nsRect& aDirtyRect);
nsRect GetBackgroundRectRelativeToSelf(nscoord* aOutYOffset = nullptr, nsRect* aOutGroupRect = nullptr); nsRect GetBackgroundRectRelativeToSelf(nscoord* aOutYOffset = nullptr, nsRect* aOutGroupRect = nullptr);
@@ -138,7 +138,7 @@ void
nsDisplayXULGroupBorder::Paint(nsDisplayListBuilder* aBuilder, nsDisplayXULGroupBorder::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) gfxContext* aCtx)
{ {
DrawResult result = static_cast<nsGroupBoxFrame*>(mFrame) ImgDrawResult result = static_cast<nsGroupBoxFrame*>(mFrame)
->PaintBorder(*aCtx, ToReferenceFrame(), mVisibleRect); ->PaintBorder(*aCtx, ToReferenceFrame(), mVisibleRect);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result); nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
@@ -193,7 +193,7 @@ nsGroupBoxFrame::GetBackgroundRectRelativeToSelf(nscoord* aOutYOffset, nsRect* a
return nsRect(0, yoff, mRect.width, mRect.height - yoff); return nsRect(0, yoff, mRect.width, mRect.height - yoff);
} }
DrawResult ImgDrawResult
nsGroupBoxFrame::PaintBorder(gfxContext& aRenderingContext, nsGroupBoxFrame::PaintBorder(gfxContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect) { nsPoint aPt, const nsRect& aDirtyRect) {
@@ -211,7 +211,7 @@ nsGroupBoxFrame::PaintBorder(gfxContext& aRenderingContext,
nsRect rect = GetBackgroundRectRelativeToSelf(&yoff, &groupRect) + aPt; nsRect rect = GetBackgroundRectRelativeToSelf(&yoff, &groupRect) + aPt;
groupRect += aPt; groupRect += aPt;
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
if (groupBox) { if (groupBox) {
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel(); int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();

View File

@@ -355,13 +355,13 @@ nsImageBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
already_AddRefed<imgIContainer> already_AddRefed<imgIContainer>
nsImageBoxFrame::GetImageContainerForPainting(const nsPoint& aPt, nsImageBoxFrame::GetImageContainerForPainting(const nsPoint& aPt,
DrawResult& aDrawResult, ImgDrawResult& aDrawResult,
Maybe<nsPoint>& aAnchorPoint, Maybe<nsPoint>& aAnchorPoint,
nsRect& aDest) nsRect& aDest)
{ {
if (!mImageRequest) { if (!mImageRequest) {
// This probably means we're drawn by a native theme. // This probably means we're drawn by a native theme.
aDrawResult = DrawResult::SUCCESS; aDrawResult = ImgDrawResult::SUCCESS;
return nullptr; return nullptr;
} }
@@ -369,7 +369,7 @@ nsImageBoxFrame::GetImageContainerForPainting(const nsPoint& aPt,
uint32_t imgStatus; uint32_t imgStatus;
if (!NS_SUCCEEDED(mImageRequest->GetImageStatus(&imgStatus)) || if (!NS_SUCCEEDED(mImageRequest->GetImageStatus(&imgStatus)) ||
!(imgStatus & imgIRequest::STATUS_SIZE_AVAILABLE)) { !(imgStatus & imgIRequest::STATUS_SIZE_AVAILABLE)) {
aDrawResult = DrawResult::NOT_READY; aDrawResult = ImgDrawResult::NOT_READY;
return nullptr; return nullptr;
} }
@@ -377,21 +377,21 @@ nsImageBoxFrame::GetImageContainerForPainting(const nsPoint& aPt,
mImageRequest->GetImage(getter_AddRefs(imgCon)); mImageRequest->GetImage(getter_AddRefs(imgCon));
if (!imgCon) { if (!imgCon) {
aDrawResult = DrawResult::NOT_READY; aDrawResult = ImgDrawResult::NOT_READY;
return nullptr; return nullptr;
} }
aDest = GetDestRect(aPt, aAnchorPoint); aDest = GetDestRect(aPt, aAnchorPoint);
aDrawResult = DrawResult::SUCCESS; aDrawResult = ImgDrawResult::SUCCESS;
return imgCon.forget(); return imgCon.forget();
} }
DrawResult ImgDrawResult
nsImageBoxFrame::PaintImage(gfxContext& aRenderingContext, nsImageBoxFrame::PaintImage(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt, const nsRect& aDirtyRect, nsPoint aPt,
uint32_t aFlags) uint32_t aFlags)
{ {
DrawResult result; ImgDrawResult result;
Maybe<nsPoint> anchorPoint; Maybe<nsPoint> anchorPoint;
nsRect dest; nsRect dest;
nsCOMPtr<imgIContainer> imgCon = GetImageContainerForPainting(aPt, result, nsCOMPtr<imgIContainer> imgCon = GetImageContainerForPainting(aPt, result,
@@ -405,7 +405,7 @@ nsImageBoxFrame::PaintImage(gfxContext& aRenderingContext,
// XXX(seth): Can this actually happen anymore? // XXX(seth): Can this actually happen anymore?
nsRect dirty; nsRect dirty;
if (!dirty.IntersectRect(aDirtyRect, dest)) { if (!dirty.IntersectRect(aDirtyRect, dest)) {
return DrawResult::TEMPORARY_ERROR; return ImgDrawResult::TEMPORARY_ERROR;
} }
bool hasSubRect = !mUseSrcAttr && (mSubRect.width > 0 || mSubRect.height > 0); bool hasSubRect = !mUseSrcAttr && (mSubRect.width > 0 || mSubRect.height > 0);
@@ -422,7 +422,7 @@ nsImageBoxFrame::PaintImage(gfxContext& aRenderingContext,
hasSubRect ? &mSubRect : nullptr); hasSubRect ? &mSubRect : nullptr);
} }
DrawResult ImgDrawResult
nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder, nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources, mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc, const StackingContextHelper& aSc,
@@ -431,7 +431,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
nsPoint aPt, nsPoint aPt,
uint32_t aFlags) uint32_t aFlags)
{ {
DrawResult result; ImgDrawResult result;
Maybe<nsPoint> anchorPoint; Maybe<nsPoint> anchorPoint;
nsRect dest; nsRect dest;
nsCOMPtr<imgIContainer> imgCon = GetImageContainerForPainting(aPt, result, nsCOMPtr<imgIContainer> imgCon = GetImageContainerForPainting(aPt, result,
@@ -460,7 +460,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
imgCon->GetImageContainerAtSize(aManager, decodeSize, svgContext, containerFlags); imgCon->GetImageContainerAtSize(aManager, decodeSize, svgContext, containerFlags);
if (!container) { if (!container) {
NS_WARNING("Failed to get image container"); NS_WARNING("Failed to get image container");
return DrawResult::NOT_READY; return ImgDrawResult::NOT_READY;
} }
gfx::IntSize size; gfx::IntSize size;
@@ -468,7 +468,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
aBuilder, aResources, aBuilder, aResources,
aSc, size, Nothing()); aSc, size, Nothing());
if (key.isNothing()) { if (key.isNothing()) {
return DrawResult::BAD_IMAGE; return ImgDrawResult::BAD_IMAGE;
} }
wr::LayoutRect fill = aSc.ToRelativeLayoutRect(fillRect); wr::LayoutRect fill = aSc.ToRelativeLayoutRect(fillRect);
@@ -478,7 +478,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
wr::ToLayoutSize(fillRect.Size()), wr::ToLayoutSize(gapSize), wr::ToLayoutSize(fillRect.Size()), wr::ToLayoutSize(gapSize),
wr::ToImageRendering(sampleFilter), key.value()); wr::ToImageRendering(sampleFilter), key.value());
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
nsRect nsRect
@@ -539,7 +539,7 @@ void nsDisplayXULImage::Paint(nsDisplayListBuilder* aBuilder,
if (aBuilder->IsPaintingToWindow()) if (aBuilder->IsPaintingToWindow())
flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING; flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
DrawResult result = static_cast<nsImageBoxFrame*>(mFrame)-> ImgDrawResult result = static_cast<nsImageBoxFrame*>(mFrame)->
PaintImage(*aCtx, mVisibleRect, ToReferenceFrame(), flags); PaintImage(*aCtx, mVisibleRect, ToReferenceFrame(), flags);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result); nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
@@ -589,7 +589,7 @@ nsDisplayXULImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBui
flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING; flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
} }
DrawResult result = imageFrame-> ImgDrawResult result = imageFrame->
CreateWebRenderCommands(aBuilder, aResources, aSc, aManager, this, ToReferenceFrame(), flags); CreateWebRenderCommands(aBuilder, aResources, aSc, aManager, this, ToReferenceFrame(), flags);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result); nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);

View File

@@ -37,7 +37,7 @@ private:
class nsImageBoxFrame final : public nsLeafBoxFrame class nsImageBoxFrame final : public nsLeafBoxFrame
{ {
public: public:
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
typedef mozilla::layers::ImageContainer ImageContainer; typedef mozilla::layers::ImageContainer ImageContainer;
typedef mozilla::layers::LayerManager LayerManager; typedef mozilla::layers::LayerManager LayerManager;
@@ -88,15 +88,15 @@ public:
virtual ~nsImageBoxFrame(); virtual ~nsImageBoxFrame();
already_AddRefed<imgIContainer> GetImageContainerForPainting(const nsPoint& aPt, already_AddRefed<imgIContainer> GetImageContainerForPainting(const nsPoint& aPt,
DrawResult& aDrawResult, ImgDrawResult& aDrawResult,
Maybe<nsPoint>& aAnchorPoint, Maybe<nsPoint>& aAnchorPoint,
nsRect& aDest); nsRect& aDest);
DrawResult PaintImage(gfxContext& aRenderingContext, ImgDrawResult PaintImage(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsPoint aPt, uint32_t aFlags); nsPoint aPt, uint32_t aFlags);
DrawResult CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder, ImgDrawResult CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources, mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc, const mozilla::layers::StackingContextHelper& aSc,
mozilla::layers::WebRenderLayerManager* aManager, mozilla::layers::WebRenderLayerManager* aManager,

View File

@@ -2816,7 +2816,7 @@ public:
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(), DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
mDisableSubpixelAA); mDisableSubpixelAA);
DrawResult result = static_cast<nsTreeBodyFrame*>(mFrame) ImgDrawResult result = static_cast<nsTreeBodyFrame*>(mFrame)
->PaintTreeBody(*aCtx, mVisibleRect, ToReferenceFrame(), aBuilder); ->PaintTreeBody(*aCtx, mVisibleRect, ToReferenceFrame(), aBuilder);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result); nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
@@ -2899,7 +2899,7 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
#endif #endif
} }
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintTreeBody(gfxContext& aRenderingContext, nsTreeBodyFrame::PaintTreeBody(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt, const nsRect& aDirtyRect, nsPoint aPt,
nsDisplayListBuilder* aBuilder) nsDisplayListBuilder* aBuilder)
@@ -2928,7 +2928,7 @@ nsTreeBodyFrame::PaintTreeBody(gfxContext& aRenderingContext,
NS_WARNING_ASSERTION(mRowCount == rowCount, "row count changed unexpectedly"); NS_WARNING_ASSERTION(mRowCount == rowCount, "row count changed unexpectedly");
#endif #endif
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
// Loop through our columns and paint them (e.g., for sorting). This is only // Loop through our columns and paint them (e.g., for sorting). This is only
// relevant when painting backgrounds, since columns contain no content. Content // relevant when painting backgrounds, since columns contain no content. Content
@@ -2983,7 +2983,7 @@ nsTreeBodyFrame::PaintTreeBody(gfxContext& aRenderingContext,
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintColumn(nsTreeColumn* aColumn, nsTreeBodyFrame::PaintColumn(nsTreeColumn* aColumn,
const nsRect& aColumnRect, const nsRect& aColumnRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -3013,7 +3013,7 @@ nsTreeBodyFrame::PaintColumn(nsTreeColumn* aColumn,
colRect, aDirtyRect); colRect, aDirtyRect);
} }
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintRow(int32_t aRowIndex, nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
const nsRect& aRowRect, const nsRect& aRowRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -3027,7 +3027,7 @@ nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
// Without a view, we have no data. Check for this up front. // Without a view, we have no data. Check for this up front.
if (!mView) { if (!mView) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
nsresult rv; nsresult rv;
@@ -3051,7 +3051,7 @@ nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
rowContext->StyleMargin()->GetMargin(rowMargin); rowContext->StyleMargin()->GetMargin(rowMargin);
rowRect.Deflate(rowMargin); rowRect.Deflate(rowMargin);
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
// Paint our borders and background for our row rect. // Paint our borders and background for our row rect.
nsITheme* theme = nullptr; nsITheme* theme = nullptr;
@@ -3173,7 +3173,7 @@ nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
return result; return result;
} }
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex, nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
const nsRect& aSeparatorRect, const nsRect& aSeparatorRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -3191,7 +3191,7 @@ nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
useTheme = true; useTheme = true;
} }
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
// use -moz-appearance if provided. // use -moz-appearance if provided.
if (useTheme) { if (useTheme) {
@@ -3230,7 +3230,7 @@ nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
return result; return result;
} }
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintCell(int32_t aRowIndex, nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aCellRect, const nsRect& aCellRect,
@@ -3264,7 +3264,7 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
cellRect.Deflate(cellMargin); cellRect.Deflate(cellMargin);
// Paint our borders and background for our row rect. // Paint our borders and background for our row rect.
DrawResult result = PaintBackgroundLayer(cellContext, aPresContext, ImgDrawResult result = PaintBackgroundLayer(cellContext, aPresContext,
aRenderingContext, cellRect, aRenderingContext, cellRect,
aDirtyRect); aDirtyRect);
@@ -3435,7 +3435,7 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
return result; return result;
} }
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintTwisty(int32_t aRowIndex, nsTreeBodyFrame::PaintTwisty(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aTwistyRect, const nsRect& aTwistyRect,
@@ -3482,7 +3482,7 @@ nsTreeBodyFrame::PaintTwisty(int32_t aRowIndex,
if (!isRTL) if (!isRTL)
aCurrX += copyRect.width; aCurrX += copyRect.width;
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
if (shouldPaint) { if (shouldPaint) {
// Paint our borders and background for our image rect. // Paint our borders and background for our image rect.
@@ -3536,7 +3536,7 @@ nsTreeBodyFrame::PaintTwisty(int32_t aRowIndex,
return result; return result;
} }
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintImage(int32_t aRowIndex, nsTreeBodyFrame::PaintImage(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aImageRect, const nsRect& aImageRect,
@@ -3572,7 +3572,7 @@ nsTreeBodyFrame::PaintImage(int32_t aRowIndex,
// Get the image destination size. // Get the image destination size.
nsSize imageDestSize = GetImageDestSize(imageContext, useImageRegion, image); nsSize imageDestSize = GetImageDestSize(imageContext, useImageRegion, image);
if (!imageDestSize.width || !imageDestSize.height) { if (!imageDestSize.width || !imageDestSize.height) {
return DrawResult::SUCCESS; return ImgDrawResult::SUCCESS;
} }
// Get the borders and padding. // Get the borders and padding.
@@ -3609,7 +3609,7 @@ nsTreeBodyFrame::PaintImage(int32_t aRowIndex,
} }
} }
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
if (image) { if (image) {
if (isRTL) if (isRTL)
@@ -3720,7 +3720,7 @@ nsTreeBodyFrame::PaintImage(int32_t aRowIndex,
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma optimize("g", off) # pragma optimize("g", off)
#endif #endif
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintText(int32_t aRowIndex, nsTreeBodyFrame::PaintText(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aTextRect, const nsRect& aTextRect,
@@ -3745,7 +3745,7 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
// necessary // necessary
CheckTextForBidi(text); CheckTextForBidi(text);
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
if (text.Length() == 0) { if (text.Length() == 0) {
// Don't paint an empty string. XXX What about background/borders? Still paint? // Don't paint an empty string. XXX What about background/borders? Still paint?
@@ -3855,7 +3855,7 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
# pragma optimize("", on) # pragma optimize("", on)
#endif #endif
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex, nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aCheckboxRect, const nsRect& aCheckboxRect,
@@ -3888,7 +3888,7 @@ nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex,
checkboxRect.x = rightEdge - checkboxRect.width; checkboxRect.x = rightEdge - checkboxRect.width;
// Paint our borders and background for our image rect. // Paint our borders and background for our image rect.
DrawResult result = PaintBackgroundLayer(checkboxContext, aPresContext, ImgDrawResult result = PaintBackgroundLayer(checkboxContext, aPresContext,
aRenderingContext, checkboxRect, aRenderingContext, checkboxRect,
aDirtyRect); aDirtyRect);
@@ -3924,7 +3924,7 @@ nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex,
return result; return result;
} }
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintProgressMeter(int32_t aRowIndex, nsTreeBodyFrame::PaintProgressMeter(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aProgressMeterRect, const nsRect& aProgressMeterRect,
@@ -3948,7 +3948,7 @@ nsTreeBodyFrame::PaintProgressMeter(int32_t aRowIndex,
meterRect.Deflate(meterMargin); meterRect.Deflate(meterMargin);
// Paint our borders and background for our progress meter rect. // Paint our borders and background for our progress meter rect.
DrawResult result = PaintBackgroundLayer(meterContext, aPresContext, ImgDrawResult result = PaintBackgroundLayer(meterContext, aPresContext,
aRenderingContext, meterRect, aRenderingContext, meterRect,
aDirtyRect); aDirtyRect);
@@ -4028,7 +4028,7 @@ nsTreeBodyFrame::PaintProgressMeter(int32_t aRowIndex,
} }
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintDropFeedback(const nsRect& aDropFeedbackRect, nsTreeBodyFrame::PaintDropFeedback(const nsRect& aDropFeedbackRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
@@ -4059,7 +4059,7 @@ nsTreeBodyFrame::PaintDropFeedback(const nsRect& aDropFeedbackRect,
// Resolve the style to use for the drop feedback. // Resolve the style to use for the drop feedback.
nsStyleContext* feedbackContext = GetPseudoStyleContext(nsCSSAnonBoxes::mozTreeDropFeedback); nsStyleContext* feedbackContext = GetPseudoStyleContext(nsCSSAnonBoxes::mozTreeDropFeedback);
DrawResult result = DrawResult::SUCCESS; ImgDrawResult result = ImgDrawResult::SUCCESS;
// Paint only if it is visible. // Paint only if it is visible.
if (feedbackContext->StyleVisibility()->IsVisibleOrCollapsed()) { if (feedbackContext->StyleVisibility()->IsVisibleOrCollapsed()) {
@@ -4137,7 +4137,7 @@ nsTreeBodyFrame::PaintDropFeedback(const nsRect& aDropFeedbackRect,
return result; return result;
} }
DrawResult ImgDrawResult
nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext, nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
@@ -4149,7 +4149,7 @@ nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
nsCSSRendering::PaintBGParams::ForAllLayers(*aPresContext, nsCSSRendering::PaintBGParams::ForAllLayers(*aPresContext,
aDirtyRect, aRect, this, aDirtyRect, aRect, this,
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES); nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
DrawResult result = ImgDrawResult result =
nsCSSRendering::PaintStyleImageLayerWithSC(params, aRenderingContext, aStyleContext, nsCSSRendering::PaintStyleImageLayerWithSC(params, aRenderingContext, aStyleContext,
*myBorder); *myBorder);

View File

@@ -53,7 +53,7 @@ class nsTreeBodyFrame final
, public nsIReflowCallback , public nsIReflowCallback
{ {
typedef mozilla::layout::ScrollbarActivity ScrollbarActivity; typedef mozilla::layout::ScrollbarActivity ScrollbarActivity;
typedef mozilla::image::DrawResult DrawResult; typedef mozilla::image::ImgDrawResult ImgDrawResult;
public: public:
explicit nsTreeBodyFrame(nsStyleContext* aContext); explicit nsTreeBodyFrame(nsStyleContext* aContext);
@@ -190,7 +190,7 @@ public:
nsIScrollableFrame* mColumnsScrollFrame; nsIScrollableFrame* mColumnsScrollFrame;
}; };
DrawResult PaintTreeBody(gfxContext& aRenderingContext, ImgDrawResult PaintTreeBody(gfxContext& aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt, const nsRect& aDirtyRect, nsPoint aPt,
nsDisplayListBuilder* aBuilder); nsDisplayListBuilder* aBuilder);
@@ -206,14 +206,14 @@ protected:
friend class nsOverflowChecker; friend class nsOverflowChecker;
// This method paints a specific column background of the tree. // This method paints a specific column background of the tree.
DrawResult PaintColumn(nsTreeColumn* aColumn, ImgDrawResult PaintColumn(nsTreeColumn* aColumn,
const nsRect& aColumnRect, const nsRect& aColumnRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDirtyRect); const nsRect& aDirtyRect);
// This method paints a single row in the tree. // This method paints a single row in the tree.
DrawResult PaintRow(int32_t aRowIndex, ImgDrawResult PaintRow(int32_t aRowIndex,
const nsRect& aRowRect, const nsRect& aRowRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
@@ -222,14 +222,14 @@ protected:
nsDisplayListBuilder* aBuilder); nsDisplayListBuilder* aBuilder);
// This method paints a single separator in the tree. // This method paints a single separator in the tree.
DrawResult PaintSeparator(int32_t aRowIndex, ImgDrawResult PaintSeparator(int32_t aRowIndex,
const nsRect& aSeparatorRect, const nsRect& aSeparatorRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDirtyRect); const nsRect& aDirtyRect);
// This method paints a specific cell in a given row of the tree. // This method paints a specific cell in a given row of the tree.
DrawResult PaintCell(int32_t aRowIndex, ImgDrawResult PaintCell(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aCellRect, const nsRect& aCellRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -240,7 +240,7 @@ protected:
nsDisplayListBuilder* aBuilder); nsDisplayListBuilder* aBuilder);
// This method paints the twisty inside a cell in the primary column of an tree. // This method paints the twisty inside a cell in the primary column of an tree.
DrawResult PaintTwisty(int32_t aRowIndex, ImgDrawResult PaintTwisty(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aTwistyRect, const nsRect& aTwistyRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -250,7 +250,7 @@ protected:
nscoord& aCurrX); nscoord& aCurrX);
// This method paints the image inside the cell of an tree. // This method paints the image inside the cell of an tree.
DrawResult PaintImage(int32_t aRowIndex, ImgDrawResult PaintImage(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aImageRect, const nsRect& aImageRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -261,7 +261,7 @@ protected:
nsDisplayListBuilder* aBuilder); nsDisplayListBuilder* aBuilder);
// This method paints the text string inside a particular cell of the tree. // This method paints the text string inside a particular cell of the tree.
DrawResult PaintText(int32_t aRowIndex, ImgDrawResult PaintText(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aTextRect, const nsRect& aTextRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -270,7 +270,7 @@ protected:
nscoord& aCurrX); nscoord& aCurrX);
// This method paints the checkbox inside a particular cell of the tree. // This method paints the checkbox inside a particular cell of the tree.
DrawResult PaintCheckbox(int32_t aRowIndex, ImgDrawResult PaintCheckbox(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aCheckboxRect, const nsRect& aCheckboxRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -278,7 +278,7 @@ protected:
const nsRect& aDirtyRect); const nsRect& aDirtyRect);
// This method paints the progress meter inside a particular cell of the tree. // This method paints the progress meter inside a particular cell of the tree.
DrawResult PaintProgressMeter(int32_t aRowIndex, ImgDrawResult PaintProgressMeter(int32_t aRowIndex,
nsTreeColumn* aColumn, nsTreeColumn* aColumn,
const nsRect& aProgressMeterRect, const nsRect& aProgressMeterRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@@ -287,7 +287,7 @@ protected:
nsDisplayListBuilder* aBuilder); nsDisplayListBuilder* aBuilder);
// This method paints a drop feedback of the tree. // This method paints a drop feedback of the tree.
DrawResult PaintDropFeedback(const nsRect& aDropFeedbackRect, ImgDrawResult PaintDropFeedback(const nsRect& aDropFeedbackRect,
nsPresContext* aPresContext, nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
@@ -295,7 +295,7 @@ protected:
// This method is called with a specific style context and rect to // This method is called with a specific style context and rect to
// paint the background rect as if it were a full-blown frame. // paint the background rect as if it were a full-blown frame.
DrawResult PaintBackgroundLayer(nsStyleContext* aStyleContext, ImgDrawResult PaintBackgroundLayer(nsStyleContext* aStyleContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,
gfxContext& aRenderingContext, gfxContext& aRenderingContext,
const nsRect& aRect, const nsRect& aRect,

View File

@@ -489,13 +489,13 @@ nsresult nsCocoaUtils::CreateNSImageFromImageContainer(imgIContainer *aImage, ui
RefPtr<gfxContext> context = gfxContext::CreateOrNull(drawTarget); RefPtr<gfxContext> context = gfxContext::CreateOrNull(drawTarget);
MOZ_ASSERT(context); MOZ_ASSERT(context);
mozilla::image::DrawResult res = mozilla::image::ImgDrawResult res =
aImage->Draw(context, scaledSize, ImageRegion::Create(scaledSize), aImage->Draw(context, scaledSize, ImageRegion::Create(scaledSize),
aWhichFrame, SamplingFilter::POINT, aWhichFrame, SamplingFilter::POINT,
/* no SVGImageContext */ Nothing(), /* no SVGImageContext */ Nothing(),
imgIContainer::FLAG_SYNC_DECODE, 1.0); imgIContainer::FLAG_SYNC_DECODE, 1.0);
if (res != mozilla::image::DrawResult::SUCCESS) { if (res != mozilla::image::ImgDrawResult::SUCCESS) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }

View File

@@ -759,12 +759,12 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
if (!ctx) if (!ctx)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
DrawResult res = ImgDrawResult res =
imgContainer->Draw(ctx, destSize, ImageRegion::Create(destSize), imgContainer->Draw(ctx, destSize, ImageRegion::Create(destSize),
imgIContainer::FRAME_CURRENT, imgIContainer::FRAME_CURRENT,
SamplingFilter::GOOD, /* no SVGImageContext */ Nothing(), SamplingFilter::GOOD, /* no SVGImageContext */ Nothing(),
imgIContainer::FLAG_SYNC_DECODE, 1.0); imgIContainer::FLAG_SYNC_DECODE, 1.0);
if (res == DrawResult::BAD_IMAGE || res == DrawResult::BAD_ARGS) { if (res == ImgDrawResult::BAD_IMAGE || res == ImgDrawResult::BAD_ARGS) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
*aSurface = dt->Snapshot(); *aSurface = dt->Snapshot();