Bug 1211324 (part 4) - Replace GraphicsFilter constants with gfx::Filter equivalents. r=mattwoodrow.

The conversion is as follows:

- GraphicsFilter::FILTER_NEAREST == gfx::Filter::POINT
- GraphicsFilter::FILTER_GOOD    == gfx::Filter::GOOD
- GraphicsFilter::FILTER_BEST    == gfx::Filter::LINEAR

Also typedef GraphicsFilter to gfx::Filter; this will be removed in the next
patch.

These changes mean ToFilter() and ThebesFilter() are no longer needed.
This commit is contained in:
Nicholas Nethercote 2015-10-05 17:12:46 -07:00
parent 4461b88439
commit e6cc09cd51
37 changed files with 81 additions and 131 deletions

View File

@ -4682,8 +4682,7 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
auto result = image.mImgContainer->
Draw(context, scaledImageSize,
ImageRegion::Create(gfxRect(src.x, src.y, src.width, src.height)),
image.mWhichFrame, GraphicsFilter::FILTER_GOOD,
Some(svgContext), modifiedFlags);
image.mWhichFrame, Filter::GOOD, Some(svgContext), modifiedFlags);
if (result != DrawResult::SUCCESS) {
NS_WARNING("imgIContainer::Draw failed");

View File

@ -235,7 +235,7 @@ SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
Matrix TM = viewBoxTM;
TM.PostTranslate(aFilterSubregion.x, aFilterSubregion.y);
Filter filter = ToFilter(nsLayoutUtils::GetGraphicsFilterForFrame(frame));
Filter filter = nsLayoutUtils::GetGraphicsFilterForFrame(frame);
FilterPrimitiveDescription descr(PrimitiveType::Image);
descr.Attributes().Set(eImageFilter, (uint32_t)filter);

View File

@ -119,6 +119,8 @@ GfxFilterToCairoFilter(Filter filter)
return CAIRO_FILTER_BILINEAR;
case Filter::POINT:
return CAIRO_FILTER_NEAREST;
default:
MOZ_CRASH("bad filter");
}
return CAIRO_FILTER_BILINEAR;

View File

@ -192,7 +192,8 @@ enum class AntialiasMode : int8_t {
enum class Filter : int8_t {
GOOD,
LINEAR,
POINT
POINT,
SENTINEL // one past the last valid value
};
enum class PatternType : int8_t {

View File

@ -270,7 +270,7 @@ TextureImage::TextureImage(const gfx::IntSize& aSize,
: mSize(aSize)
, mWrapMode(aWrapMode)
, mContentType(aContentType)
, mFilter(GraphicsFilter::FILTER_GOOD)
, mFilter(Filter::GOOD)
, mFlags(aFlags)
{}

View File

@ -33,7 +33,6 @@
namespace mozilla {
typedef gfxImageFormat PixelFormat;
typedef ::GraphicsFilter GraphicsFilterType;
} // namespace mozilla
@ -206,11 +205,11 @@ struct ParamTraits<gfxSurfaceType>
{};
template <>
struct ParamTraits<mozilla::GraphicsFilterType>
struct ParamTraits<mozilla::gfx::Filter>
: public ContiguousEnumSerializer<
mozilla::GraphicsFilterType,
GraphicsFilter::FILTER_GOOD,
GraphicsFilter::FILTER_SENTINEL>
mozilla::gfx::Filter,
mozilla::gfx::Filter::GOOD,
mozilla::gfx::Filter::SENTINEL>
{};
template <>

View File

@ -14,7 +14,7 @@ namespace mozilla {
namespace layers {
ImageLayer::ImageLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData), mFilter(GraphicsFilter::FILTER_GOOD)
: Layer(aManager, aImplData), mFilter(gfx::Filter::GOOD)
, mScaleMode(ScaleMode::SCALE_NONE), mDisallowBigImage(false)
{}

View File

@ -2136,7 +2136,7 @@ void
CanvasLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
Layer::PrintInfo(aStream, aPrefix);
if (mFilter != GraphicsFilter::FILTER_GOOD) {
if (mFilter != Filter::GOOD) {
AppendToString(aStream, mFilter, " [filter=", "]");
}
}
@ -2148,14 +2148,14 @@ DumpFilter(layerscope::LayersPacket::Layer* aLayer, const GraphicsFilter& aFilte
{
using namespace layerscope;
switch (aFilter) {
case GraphicsFilter::FILTER_GOOD:
case Filter::GOOD:
aLayer->set_filter(LayersPacket::Layer::FILTER_GOOD);
break;
case GraphicsFilter::FILTER_BEST:
aLayer->set_filter(LayersPacket::Layer::FILTER_BEST);
case Filter::LINEAR:
aLayer->set_filter(LayersPacket::Layer::FILTER_LINEAR);
break;
case GraphicsFilter::FILTER_NEAREST:
aLayer->set_filter(LayersPacket::Layer::FILTER_NEAREST);
case Filter::POINT:
aLayer->set_filter(LayersPacket::Layer::FILTER_POINT);
break;
default:
// ignore it
@ -2178,7 +2178,7 @@ void
ImageLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
Layer::PrintInfo(aStream, aPrefix);
if (mFilter != GraphicsFilter::FILTER_GOOD) {
if (mFilter != Filter::GOOD) {
AppendToString(aStream, mFilter, " [filter=", "]");
}
}

View File

@ -2404,7 +2404,7 @@ protected:
, mPreTransCallbackData(nullptr)
, mPostTransCallback(nullptr)
, mPostTransCallbackData(nullptr)
, mFilter(GraphicsFilter::FILTER_GOOD)
, mFilter(gfx::Filter::GOOD)
, mDirty(false)
{}

View File

@ -28,22 +28,6 @@ AppendToString(std::stringstream& aStream, const void* p,
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const GraphicsFilter& f,
const char* pfx, const char* sfx)
{
aStream << pfx;
switch (f) {
case GraphicsFilter::FILTER_GOOD: aStream << "good"; break;
case GraphicsFilter::FILTER_BEST: aStream << "best"; break;
case GraphicsFilter::FILTER_NEAREST: aStream << "nearest"; break;
default:
NS_ERROR("unknown filter type");
aStream << "???";
}
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, FrameMetrics::ViewID n,
const char* pfx, const char* sfx)
@ -276,7 +260,6 @@ AppendToString(std::stringstream& aStream, const Matrix5x4& m,
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const Filter filter,
const char* pfx, const char* sfx)
@ -287,6 +270,9 @@ AppendToString(std::stringstream& aStream, const Filter filter,
case Filter::GOOD: aStream << "Filter::GOOD"; break;
case Filter::LINEAR: aStream << "Filter::LINEAR"; break;
case Filter::POINT: aStream << "Filter::POINT"; break;
default:
NS_ERROR("unknown filter type");
aStream << "???";
}
aStream << sfx;
}

View File

@ -30,10 +30,6 @@ void
AppendToString(std::stringstream& aStream, const void* p,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, const GraphicsFilter& f,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, FrameMetrics::ViewID n,
const char* pfx="", const char* sfx="");

View File

@ -52,7 +52,7 @@ BasicCanvasLayer::Paint(DrawTarget* aDT,
FillRectWithMask(aDT, aDeviceOffset,
Rect(0, 0, mBounds.width, mBounds.height),
mSurface, ToFilter(mFilter),
mSurface, mFilter,
DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
aMaskLayer);

View File

@ -85,8 +85,8 @@ BasicImageLayer::Paint(DrawTarget* aDT,
}
gfx::IntSize size = mSize = surface->GetSize();
FillRectWithMask(aDT, aDeviceOffset, Rect(0, 0, size.width, size.height),
surface, ToFilter(mFilter),
FillRectWithMask(aDT, aDeviceOffset, Rect(0, 0, size.width, size.height),
surface, mFilter,
DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
aMaskLayer);

View File

@ -137,10 +137,10 @@ CanvasLayerComposite::GetEffectFilter()
Matrix matrix;
bool is2D = GetEffectiveTransform().Is2D(&matrix);
if (is2D && !ThebesMatrix(matrix).HasNonTranslationOrFlip()) {
filter = GraphicsFilter::FILTER_NEAREST;
filter = Filter::POINT;
}
#endif
return gfx::ToFilter(filter);
return filter;
}
void

View File

@ -166,7 +166,7 @@ ImageLayerComposite::CleanupResources()
gfx::Filter
ImageLayerComposite::GetEffectFilter()
{
return gfx::ToFilter(mFilter);
return mFilter;
}
void

View File

@ -17,7 +17,7 @@ include "gfxipc/ShadowLayerUtils.h";
include "mozilla/GfxMessageUtils.h";
include "ImageLayers.h";
using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
using mozilla::gfx::Filter from "mozilla/gfx/2D.h";
using struct mozilla::gfx::Color from "mozilla/gfx/2D.h";
using struct mozilla::gfx::Point3D from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
@ -253,14 +253,14 @@ struct ContainerLayerAttributes {
uint64_t hmdInfo;
};
struct ColorLayerAttributes { LayerColor color; IntRect bounds; };
struct CanvasLayerAttributes { GraphicsFilterType filter; IntRect bounds; };
struct CanvasLayerAttributes { Filter filter; IntRect bounds; };
struct RefLayerAttributes {
int64_t id;
// TODO: Once bug 1132895 is fixed we shouldn't need to propagate the override
// explicitly here.
EventRegionsOverride eventRegionsOverride;
};
struct ImageLayerAttributes { GraphicsFilterType filter; IntSize scaleToSize; ScaleMode scaleMode; };
struct ImageLayerAttributes { Filter filter; IntSize scaleToSize; ScaleMode scaleMode; };
union SpecificLayerAttributes {
null_t;

View File

@ -12,7 +12,6 @@
#include "GLUploadHelpers.h"
#include "Layers.h" // for WriteSnapshotToDumpFile
#include "LayerScope.h" // for LayerScope
#include "gfx2DGlue.h" // for ThebesFilter
#include "gfxCrashReporterUtils.h" // for ScopedGfxFeatureReporter
#include "GraphicsFilter.h" // for GraphicsFilter
#include "gfxPlatform.h" // for gfxPlatform

View File

@ -18,7 +18,6 @@
#include "GLUploadHelpers.h"
#include "Layers.h" // for WriteSnapshotToDumpFile
#include "LayerScope.h" // for LayerScope
#include "gfx2DGlue.h" // for ThebesFilter
#include "gfxCrashReporterUtils.h" // for ScopedGfxFeatureReporter
#include "gfxMatrix.h" // for gfxMatrix
#include "GraphicsFilter.h" // for GraphicsFilter

View File

@ -1187,8 +1187,8 @@ bool LayersPacket_Layer_Filter_IsValid(int value) {
#ifndef _MSC_VER
const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_GOOD;
const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_BEST;
const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_NEAREST;
const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_LINEAR;
const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_POINT;
const LayersPacket_Layer_Filter LayersPacket_Layer::FILTER_SENTINEL;
#endif // _MSC_VER
#ifndef _MSC_VER

View File

@ -76,11 +76,10 @@ const LayersPacket_Layer_ScrollingDirect LayersPacket_Layer_ScrollingDirect_Scro
const int LayersPacket_Layer_ScrollingDirect_ScrollingDirect_ARRAYSIZE = LayersPacket_Layer_ScrollingDirect_ScrollingDirect_MAX + 1;
enum LayersPacket_Layer_Filter {
LayersPacket_Layer_Filter_FILTER_FAST = 0,
LayersPacket_Layer_Filter_FILTER_GOOD = 1,
LayersPacket_Layer_Filter_FILTER_BEST = 2,
LayersPacket_Layer_Filter_FILTER_NEAREST = 3,
LayersPacket_Layer_Filter_FILTER_SENTINEL = 6
LayersPacket_Layer_Filter_FILTER_GOOD = 0,
LayersPacket_Layer_Filter_FILTER_LINEAR = 1,
LayersPacket_Layer_Filter_FILTER_POINT = 2,
LayersPacket_Layer_Filter_FILTER_SENTINEL = 3
};
bool LayersPacket_Layer_Filter_IsValid(int value);
@ -1155,8 +1154,8 @@ class LayersPacket_Layer : public ::google::protobuf::MessageLite {
typedef LayersPacket_Layer_Filter Filter;
static const Filter FILTER_GOOD = LayersPacket_Layer_Filter_FILTER_GOOD;
static const Filter FILTER_BEST = LayersPacket_Layer_Filter_FILTER_BEST;
static const Filter FILTER_NEAREST = LayersPacket_Layer_Filter_FILTER_NEAREST;
static const Filter FILTER_LINEAR = LayersPacket_Layer_Filter_FILTER_LINEAR;
static const Filter FILTER_POINT = LayersPacket_Layer_Filter_FILTER_POINT;
static const Filter FILTER_SENTINEL = LayersPacket_Layer_Filter_FILTER_SENTINEL;
static inline bool Filter_IsValid(int value) {
return LayersPacket_Layer_Filter_IsValid(value);

View File

@ -6,12 +6,9 @@
#ifndef GraphicsFilter_h
#define GraphicsFilter_h
enum class GraphicsFilter : int {
FILTER_GOOD,
FILTER_BEST,
FILTER_NEAREST,
FILTER_SENTINEL
};
#include "mozilla/gfx/Types.h"
typedef mozilla::gfx::Filter GraphicsFilter;
#endif

View File

@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
@ -5,7 +7,6 @@
#ifndef GFX_2D_GLUE_H
#define GFX_2D_GLUE_H
#include "gfxPlatform.h"
#include "gfxRect.h"
#include "gfxMatrix.h"
@ -60,30 +61,6 @@ inline Size ToSize(const gfxSize &aSize)
return Size(Float(aSize.width), Float(aSize.height));
}
inline Filter ToFilter(GraphicsFilter aFilter)
{
switch (aFilter) {
case GraphicsFilter::FILTER_NEAREST:
return Filter::POINT;
case GraphicsFilter::FILTER_GOOD:
return Filter::GOOD;
default:
return Filter::LINEAR;
}
}
inline GraphicsFilter ThebesFilter(Filter aFilter)
{
switch (aFilter) {
case Filter::POINT:
return GraphicsFilter::FILTER_NEAREST;
case Filter::GOOD:
return GraphicsFilter::FILTER_GOOD;
default:
return GraphicsFilter::FILTER_BEST;
}
}
inline gfxPoint ThebesPoint(const Point &aPoint)
{
return gfxPoint(aPoint.x, aPoint.y);

View File

@ -91,7 +91,7 @@ gfxSurfaceDrawable::DrawInternal(gfxContext* aContext,
patternTransform.Invert();
SurfacePattern pattern(mSourceSurface, extend,
patternTransform, ToFilter(aFilter), aSamplingRect);
patternTransform, aFilter, aSamplingRect);
Rect fillRect = ToRect(aFillRect);
DrawTarget* dt = aContext->GetDrawTarget();

View File

@ -136,7 +136,7 @@ public:
const gfxMatrix& aTransform = gfxMatrix());
protected:
already_AddRefed<gfxSurfaceDrawable> MakeSurfaceDrawable(const GraphicsFilter aFilter = GraphicsFilter::FILTER_BEST);
already_AddRefed<gfxSurfaceDrawable> MakeSurfaceDrawable(const GraphicsFilter aFilter = mozilla::gfx::Filter::LINEAR);
nsRefPtr<gfxDrawingCallback> mCallback;
nsRefPtr<gfxSurfaceDrawable> mSurfaceDrawable;

View File

@ -188,16 +188,16 @@ gfxPattern::SetFilter(GraphicsFilter filter)
return;
}
static_cast<SurfacePattern*>(mGfxPattern.GetPattern())->mFilter = ToFilter(filter);
static_cast<SurfacePattern*>(mGfxPattern.GetPattern())->mFilter = filter;
}
GraphicsFilter
gfxPattern::Filter() const
{
if (mGfxPattern.GetPattern()->GetType() != PatternType::SURFACE) {
return GraphicsFilter::FILTER_GOOD;
return Filter::GOOD;
}
return ThebesFilter(static_cast<const SurfacePattern*>(mGfxPattern.GetPattern())->mFilter);
return static_cast<const SurfacePattern*>(mGfxPattern.GetPattern())->mFilter;
}
bool

View File

@ -453,8 +453,8 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
nsRefPtr<gfxContext> tmpCtx = new gfxContext(target);
tmpCtx->SetOp(OptimalFillOp());
aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), true,
GraphicsFilter::FILTER_BEST, 1.0, gfxMatrix::Translation(needed.TopLeft()));
aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), true, Filter::LINEAR,
1.0, gfxMatrix::Translation(needed.TopLeft()));
RefPtr<SourceSurface> surface = target->Snapshot();
nsRefPtr<gfxDrawable> drawable = new gfxSurfaceDrawable(surface, size, gfxMatrix::Translation(-needed.TopLeft()));
@ -559,7 +559,7 @@ static GraphicsFilter ReduceResamplingFilter(GraphicsFilter aFilter,
|| aImgHeight <= kSmallImageSizeThreshold) {
// Never resample small images. These are often used for borders and
// rules (think 1x1 images used to make lines).
return GraphicsFilter::FILTER_NEAREST;
return Filter::POINT;
}
if (aImgHeight * kLargeStretch <= aSourceHeight || aImgWidth * kLargeStretch <= aSourceWidth) {
@ -570,7 +570,7 @@ static GraphicsFilter ReduceResamplingFilter(GraphicsFilter aFilter,
// (which might be large) and then is stretching it to fill some part
// of the page.
if (fabs(aSourceWidth - aImgWidth)/aImgWidth < 0.5 || fabs(aSourceHeight - aImgHeight)/aImgHeight < 0.5)
return GraphicsFilter::FILTER_NEAREST;
return Filter::POINT;
// The image is growing a lot and in more than one direction. Resampling
// is slow and doesn't give us very much when growing a lot.
@ -695,7 +695,7 @@ PrescaleAndTileDrawable(gfxDrawable* aDrawable,
aContext->CurrentAntialiasMode());
SurfacePattern scaledImagePattern(scaledImage, ExtendMode::REPEAT,
Matrix(), ToFilter(aFilter));
Matrix(), aFilter);
destDrawTarget->FillRect(scaledNeededRect, scaledImagePattern, drawOptions);
}
return true;

View File

@ -288,7 +288,7 @@ gfxWindowsNativeDrawing::PaintToContext()
pat->SetMatrix(m);
if (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING)
pat->SetFilter(GraphicsFilter::FILTER_BEST);
pat->SetFilter(Filter::LINEAR);
pat->SetExtend(ExtendMode::CLAMP);
mContext->SetPattern(pat);

View File

@ -291,7 +291,7 @@ ClippedImage::GetFrameInternal(const nsIntSize& aSize,
gfxUtils::DrawPixelSnapped(ctx, drawable, aSize,
ImageRegion::Create(aSize),
SurfaceFormat::B8G8R8A8,
GraphicsFilter::FILTER_BEST,
Filter::LINEAR,
imgIContainer::FLAG_CLAMP);
// Cache the resulting surface.

View File

@ -188,8 +188,7 @@ DynamicImage::GetFrameAtSize(const IntSize& aSize,
nsRefPtr<gfxContext> context = new gfxContext(dt);
auto result = Draw(context, aSize, ImageRegion::Create(aSize),
aWhichFrame, GraphicsFilter::FILTER_NEAREST,
Nothing(), aFlags);
aWhichFrame, Filter::POINT, Nothing(), aFlags);
return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr;
}

View File

@ -115,9 +115,8 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
// Draw.
nsRefPtr<gfxContext> ctx = new gfxContext(target);
ctx->Multiply(OrientationMatrix(size));
gfxUtils::DrawPixelSnapped(ctx, drawable, size,
ImageRegion::Create(size),
surfaceFormat, GraphicsFilter::FILTER_BEST);
gfxUtils::DrawPixelSnapped(ctx, drawable, size, ImageRegion::Create(size),
surfaceFormat, Filter::LINEAR);
return target->Snapshot();
}

View File

@ -1520,9 +1520,9 @@ RasterImage::Draw(gfxContext* aContext,
mProgressTracker->OnUnlockedDraw();
}
// If we're not using GraphicsFilter::FILTER_GOOD, we shouldn't high-quality
// scale or downscale during decode.
uint32_t flags = aFilter == GraphicsFilter::FILTER_GOOD
// If we're not using Filter::GOOD, we shouldn't high-quality scale or
// downscale during decode.
uint32_t flags = aFilter == Filter::GOOD
? aFlags
: aFlags & ~FLAG_HIGH_QUALITY_SCALING;
@ -1862,8 +1862,7 @@ RasterImage::OptimalImageSizeForDest(const gfxSize& aDest, uint32_t aWhichFrame,
IntSize destSize(ceil(aDest.width), ceil(aDest.height));
if (aFilter == GraphicsFilter::FILTER_GOOD &&
CanDownscaleDuringDecode(destSize, aFlags)) {
if (aFilter == Filter::GOOD && CanDownscaleDuringDecode(destSize, aFlags)) {
return destSize;
}

View File

@ -735,10 +735,8 @@ VectorImage::GetFrameAtSize(const IntSize& aSize,
nsRefPtr<gfxContext> context = new gfxContext(dt);
auto result = Draw(context, aSize,
ImageRegion::Create(aSize),
aWhichFrame, GraphicsFilter::FILTER_NEAREST,
Nothing(), aFlags);
auto result = Draw(context, aSize, ImageRegion::Create(aSize),
aWhichFrame, Filter::POINT, Nothing(), aFlags);
return result == DrawResult::SUCCESS ? dt->Snapshot() : nullptr;
}
@ -918,7 +916,7 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams)
nsresult rv =
frame->InitWithDrawable(svgDrawable, aParams.size,
SurfaceFormat::B8G8R8A8,
GraphicsFilter::FILTER_NEAREST, aParams.flags);
Filter::POINT, aParams.flags);
// If we couldn't create the frame, it was probably because it would end
// up way too big. Generally it also wouldn't fit in the cache, but the prefs

View File

@ -5871,7 +5871,7 @@ nsLayoutUtils::GetClosestLayer(nsIFrame* aFrame)
GraphicsFilter
nsLayoutUtils::GetGraphicsFilterForFrame(nsIFrame* aForFrame)
{
GraphicsFilter defaultFilter = GraphicsFilter::FILTER_GOOD;
GraphicsFilter defaultFilter = Filter::GOOD;
nsStyleContext *sc;
if (nsCSSRendering::IsCanvasFrame(aForFrame)) {
nsCSSRendering::FindBackground(aForFrame, &sc);
@ -5881,11 +5881,11 @@ nsLayoutUtils::GetGraphicsFilterForFrame(nsIFrame* aForFrame)
switch (sc->StyleSVG()->mImageRendering) {
case NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED:
return GraphicsFilter::FILTER_BEST;
return Filter::POINT;
case NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY:
return GraphicsFilter::FILTER_BEST;
return Filter::LINEAR;
case NS_STYLE_IMAGE_RENDERING_CRISPEDGES:
return GraphicsFilter::FILTER_NEAREST;
return Filter::POINT;
default:
return defaultFilter;
}
@ -6414,7 +6414,7 @@ nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
js::ProfileEntry::Category::GRAPHICS);
if (UseBackgroundNearestFiltering()) {
aGraphicsFilter = GraphicsFilter::FILTER_NEAREST;
aGraphicsFilter = Filter::POINT;
}
SVGImageContext svgContext(aImageSize, Nothing());

View File

@ -1462,7 +1462,7 @@ nsPluginFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
if (!aManager->IsCompositingCheap()) {
// Pixman just horrible with bilinear filter scaling
filter = GraphicsFilter::FILTER_NEAREST;
filter = Filter::POINT;
}
#endif
imglayer->SetFilter(filter);

View File

@ -3419,11 +3419,11 @@ nsTreeBodyFrame::PaintTwisty(int32_t aRowIndex,
if (imageSize.height < twistyRect.height) {
pt.y += (twistyRect.height - imageSize.height)/2;
}
// Paint the image.
nsLayoutUtils::DrawSingleUnscaledImage(*aRenderingContext.ThebesContext(),
aPresContext, image,
GraphicsFilter::FILTER_NEAREST, pt, &aDirtyRect,
nsLayoutUtils::DrawSingleUnscaledImage(
*aRenderingContext.ThebesContext(), aPresContext, image,
Filter::POINT, pt, &aDirtyRect,
imgIContainer::FLAG_NONE, &imageSize);
}
}
@ -3767,7 +3767,7 @@ nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex,
// Paint the image.
nsLayoutUtils::DrawSingleUnscaledImage(*aRenderingContext.ThebesContext(),
aPresContext,
image, GraphicsFilter::FILTER_NEAREST, pt, &aDirtyRect,
image, Filter::POINT, pt, &aDirtyRect,
imgIContainer::FLAG_NONE, &imageSize);
}
}

View File

@ -35,6 +35,7 @@ using mozilla::gfx::BackendType;
using mozilla::gfx::DataSourceSurface;
using mozilla::gfx::DrawTarget;
using mozilla::gfx::Factory;
using mozilla::gfx::Filter;
using mozilla::gfx::IntPoint;
using mozilla::gfx::IntRect;
using mozilla::gfx::IntSize;
@ -491,7 +492,7 @@ nsresult nsCocoaUtils::CreateNSImageFromImageContainer(imgIContainer *aImage, ui
}
aImage->Draw(context, scaledSize, ImageRegion::Create(scaledSize),
aWhichFrame, GraphicsFilter::FILTER_NEAREST, Nothing(),
aWhichFrame, Filter::POINT, Nothing(),
imgIContainer::FLAG_SYNC_DECODE);
surface = drawTarget->Snapshot();

View File

@ -670,7 +670,7 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
imgContainer->Draw(ctx, destSize, ImageRegion::Create(destSize),
imgIContainer::FRAME_CURRENT,
GraphicsFilter::FILTER_GOOD, Nothing(),
Filter::GOOD, Nothing(),
imgIContainer::FLAG_SYNC_DECODE);
*aSurface = dt->Snapshot();
} else {