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

Renamed to imgDrawResult

MozReview-Commit-ID: 5ESSgIhhU41

--HG--
rename : image/DrawResult.h => image/ImgDrawResult.h
extra : rebase_source : 4fba109b84ef456126d50e0d5e525f29f944a46d
This commit is contained in:
Samathy Barratt 2017-12-11 15:37:59 +00:00
Родитель 6c0097b190
Коммит 0749baf2d8
59 изменённых файлов: 345 добавлений и 345 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -337,13 +337,13 @@ protected:
bool mAnimating:1; // Are we currently animating?
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,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aWhichFrame,
uint32_t aFlags)
{
return MakeTuple(DrawResult::BAD_IMAGE, aSize,
return MakeTuple(ImgDrawResult::BAD_IMAGE, aSize,
RefPtr<gfx::SourceSurface>());
}
@ -383,7 +383,7 @@ private:
: mSize(aSize)
, mSVGContext(aSVGContext)
, mContainer(aContainer)
, mLastDrawResult(DrawResult::NOT_READY)
, mLastDrawResult(ImgDrawResult::NOT_READY)
, mFlags(aFlags)
{ }
@ -392,9 +392,9 @@ private:
// A weak pointer to our ImageContainer, which stays alive only as long as
// the layer system needs it.
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.
DrawResult mLastDrawResult;
ImgDrawResult mLastDrawResult;
// Cached flags to use for decoding. FLAG_ASYNC_NOTIFY should always be set
// but FLAG_HIGH_QUALITY_SCALING may vary.
uint32_t mFlags;

Просмотреть файл

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

Просмотреть файл

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_image_DrawResult_h
#define mozilla_image_DrawResult_h
#ifndef mozilla_image_ImgDrawResult_h
#define mozilla_image_ImgDrawResult_h
#include <cstdint> // for uint8_t
#include "mozilla/Attributes.h"
@ -16,7 +16,7 @@ namespace image {
/**
* 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
* handling.
*
@ -46,7 +46,7 @@ namespace image {
*
* 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,
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
* DrawResult::SUCCESS only if both operands are DrawResult::SUCCESS. Otherwise,
* a failing DrawResult is returned; we favor the left operand's failure when
* You can combine ImgDrawResults with &. By analogy to bitwise-&, the result is
* ImgDrawResult::SUCCESS only if both operands are ImgDrawResult::SUCCESS. Otherwise,
* 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
* 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.
*/
inline DrawResult
operator&(const DrawResult aLeft, const DrawResult aRight)
inline ImgDrawResult
operator&(const ImgDrawResult aLeft, const ImgDrawResult aRight)
{
if (MOZ_LIKELY(aLeft == DrawResult::SUCCESS)) {
if (MOZ_LIKELY(aLeft == ImgDrawResult::SUCCESS)) {
return aRight;
}
if (aLeft == DrawResult::BAD_IMAGE && aRight != DrawResult::SUCCESS) {
if (aLeft == ImgDrawResult::BAD_IMAGE && aRight != ImgDrawResult::SUCCESS) {
return aRight;
}
return aLeft;
}
inline DrawResult&
operator&=(DrawResult& aLeft, const DrawResult aRight)
inline ImgDrawResult&
operator&=(ImgDrawResult& aLeft, const ImgDrawResult aRight)
{
aLeft = aLeft & aRight;
return aLeft;
@ -86,21 +86,21 @@ operator&=(DrawResult& aLeft, const DrawResult aRight)
/**
* 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
* occurred.
*/
struct imgDrawingParams {
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
// 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 mozilla
#endif // mozilla_image_DrawResult_h
#endif // mozilla_image_ImgDrawResult_h

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -7,7 +7,7 @@
#include "nsISupports.idl"
%{C++
#include "DrawResult.h"
#include "ImgDrawResult.h"
#include "gfxContext.h"
#include "gfxMatrix.h"
#include "gfxRect.h"
@ -45,7 +45,7 @@ struct Orientation;
%}
native DrawResult(mozilla::image::DrawResult);
native ImgDrawResult(mozilla::image::ImgDrawResult);
[ptr] native gfxContext(gfxContext);
[ref] native gfxMatrix(gfxMatrix);
[ref] native gfxRect(gfxRect);
@ -432,10 +432,10 @@ interface imgIContainer : nsISupports
* node, and the size of the viewport that the full image
* would occupy. Ignored for raster images.
* @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.
*/
[noscript, notxpcom] DrawResult
[noscript, notxpcom] ImgDrawResult
draw(in gfxContext aContext,
[const] in nsIntSize aSize,
[const] in ImageRegion aRegion,

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -280,7 +280,7 @@ nsColumnSetFrame::CreateBorderRenderers(nsTArray<nsCSSBorderRenderer>& aBorderRe
(const nsRect& aLineRect)
{
// 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);
gfx::DrawTarget* dt = aCtx ? aCtx->GetDrawTarget() : nullptr;

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -4037,7 +4037,7 @@ nsDisplayBackgroundImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilde
StyleFrame(), mImageFlags, mLayer,
CompositionOp::OP_OVER);
params.bgClipRect = &mBounds;
DrawResult result =
ImgDrawResult result =
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aResources, aSc, aManager, this);
nsDisplayBackgroundGeometry::UpdateDrawResult(this, result);
@ -4200,7 +4200,7 @@ nsDisplayBackgroundImage::PaintInternal(nsDisplayListBuilder* aBuilder,
StyleFrame(), mImageFlags, mLayer,
CompositionOp::OP_OVER);
params.bgClipRect = aClipRect;
DrawResult result = nsCSSRendering::PaintStyleImageLayer(params, *aCtx);
ImgDrawResult result = nsCSSRendering::PaintStyleImageLayer(params, *aCtx);
if (clip == StyleGeometryBox::Text) {
ctx->PopGroupAndBlend();
@ -4501,7 +4501,7 @@ nsDisplayImageContainer::ConfigureLayer(ImageLayer* aLayer,
if (imageWidth > 0 && imageHeight > 0) {
// We're actually using the ImageContainer. Let our frame know that it
// 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
@ -5676,7 +5676,7 @@ nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
DrawResult result =
ImgDrawResult result =
nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame,
mVisibleRect,
nsRect(offset, mFrame->GetSize()),
@ -9583,7 +9583,7 @@ nsDisplayMask::PaintMask(nsDisplayListBuilder* aBuilder,
nsDisplayMaskGeometry::UpdateDrawResult(this, imgParmas.result);
return imgParmas.result == mozilla::image::DrawResult::SUCCESS;
return imgParmas.result == mozilla::image::ImgDrawResult::SUCCESS;
}
LayerState

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -504,7 +504,7 @@ PaintMaskSurface(const PaintFramesParams& aParams,
nsCSSRendering::PaintStyleImageLayerWithSC(params, *maskContext, aSC,
*aParams.frame->StyleBorder());
} else {
aParams.imgParams.result &= DrawResult::NOT_READY;
aParams.imgParams.result &= ImgDrawResult::NOT_READY;
}
}
}
@ -581,7 +581,7 @@ CreateAndPaintMaskSurface(const PaintFramesParams& aParams,
aSC, aMaskFrames, maskSurfaceMatrix,
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.
// According to the return value of PaintMaskSurface, we know whether mask
// resource is resolvable or not.

Просмотреть файл

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

Просмотреть файл

@ -73,7 +73,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
nsSVGUtils::ConvertToSurfaceSize(maskSurfaceRect.Size(), &resultOverflows);
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).
return nullptr;
}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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