Bug 921753 - Part 2: Move GraphicsFilters outside of gfxPattern.h so that we won't need to #include that header everywhere GraphicsFilter is needed; r=roc

This patch reduces the number of files that transitively #include
gfx/2d.h from 1582 to 1362.
This commit is contained in:
Ehsan Akhgari 2013-10-01 17:01:19 -04:00
parent 2fb9794854
commit 6c364e9615
61 changed files with 191 additions and 160 deletions

View File

@ -7,7 +7,7 @@
#define nsICanvasElementExternal_h___
#include "nsISupports.h"
#include "gfxPattern.h"
#include "GraphicsFilter.h"
class gfxContext;
class nsIFrame;
@ -49,7 +49,7 @@ public:
* to the given gfxContext at the origin of its coordinate space.
*/
NS_IMETHOD RenderContextsExternal(gfxContext *ctx,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
uint32_t aFlags = RenderFlagPremultAlpha) = 0;
};

View File

@ -10,7 +10,7 @@
#include "nsIInputStream.h"
#include "nsIDocShell.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "gfxPattern.h"
#include "GraphicsFilter.h"
#include "mozilla/RefPtr.h"
#define NS_ICANVASRENDERINGCONTEXTINTERNAL_IID \
@ -68,7 +68,7 @@ public:
// Render the canvas at the origin of the given gfxContext
NS_IMETHOD Render(gfxContext *ctx,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
uint32_t aFlags = RenderFlagPremultAlpha) = 0;
// Gives you a stream containing the image represented by this context.

View File

@ -1006,7 +1006,7 @@ CanvasRenderingContext2D::SetIsIPC(bool isIPC)
}
NS_IMETHODIMP
CanvasRenderingContext2D::Render(gfxContext *ctx, gfxPattern::GraphicsFilter aFilter, uint32_t aFlags)
CanvasRenderingContext2D::Render(gfxContext *ctx, GraphicsFilter aFilter, uint32_t aFlags)
{
nsresult rv = NS_OK;

View File

@ -380,7 +380,7 @@ public:
NS_IMETHOD InitializeWithSurface(nsIDocShell *shell, gfxASurface *surface, int32_t width, int32_t height) MOZ_OVERRIDE;
NS_IMETHOD Render(gfxContext *ctx,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
uint32_t aFlags = RenderFlagPremultAlpha) MOZ_OVERRIDE;
NS_IMETHOD GetInputStream(const char* aMimeType,
const PRUnichar* aEncoderOptions,

View File

@ -609,7 +609,7 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
}
NS_IMETHODIMP
WebGLContext::Render(gfxContext *ctx, gfxPattern::GraphicsFilter f, uint32_t aFlags)
WebGLContext::Render(gfxContext *ctx, GraphicsFilter f, uint32_t aFlags)
{
if (!gl)
return NS_OK;
@ -752,7 +752,7 @@ WebGLContext::GetInputStream(const char* aMimeType,
nsRefPtr<gfxContext> tmpcx = new gfxContext(surf);
// Use Render() to make sure that appropriate y-flip gets applied
uint32_t flags = mOptions.premultipliedAlpha ? RenderFlagPremultAlpha : 0;
nsresult rv = Render(tmpcx, gfxPattern::FILTER_NEAREST, flags);
nsresult rv = Render(tmpcx, GraphicsFilter::FILTER_NEAREST, flags);
if (NS_FAILED(rv))
return rv;
@ -1329,6 +1329,12 @@ WebGLContext::ForceRestoreContext()
void
WebGLContext::MakeContextCurrent() const { gl->MakeCurrent(); }
mozilla::TemporaryRef<mozilla::gfx::SourceSurface>
WebGLContext::GetSurfaceSnapshot()
{
return nullptr;
}
//
// XPCOM goop
//

View File

@ -80,6 +80,10 @@ struct WebGLContextAttributesInitializer;
template<typename> struct Nullable;
}
namespace gfx {
class SourceSurface;
}
using WebGLTexelConversions::WebGLTexelFormat;
WebGLTexelFormat GetWebGLTexelFormat(GLenum format, GLenum type);
@ -163,14 +167,13 @@ public:
NS_IMETHOD Reset() MOZ_OVERRIDE
{ /* (InitializeWithSurface) */ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD Render(gfxContext *ctx,
gfxPattern::GraphicsFilter f,
GraphicsFilter f,
uint32_t aFlags = RenderFlagPremultAlpha) MOZ_OVERRIDE;
NS_IMETHOD GetInputStream(const char* aMimeType,
const PRUnichar* aEncoderOptions,
nsIInputStream **aStream) MOZ_OVERRIDE;
NS_IMETHOD GetThebesSurface(gfxASurface **surface) MOZ_OVERRIDE;
mozilla::TemporaryRef<mozilla::gfx::SourceSurface> GetSurfaceSnapshot() MOZ_OVERRIDE
{ return nullptr; }
mozilla::TemporaryRef<mozilla::gfx::SourceSurface> GetSurfaceSnapshot() MOZ_OVERRIDE;
NS_IMETHOD SetIsOpaque(bool b) MOZ_OVERRIDE { return NS_OK; };
NS_IMETHOD SetContextOptions(JSContext* aCx,

View File

@ -169,7 +169,7 @@ public:
*/
NS_IMETHOD_(nsIntSize) GetSizeExternal() MOZ_OVERRIDE;
NS_IMETHOD RenderContextsExternal(gfxContext *aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
uint32_t aFlags = RenderFlagPremultAlpha) MOZ_OVERRIDE;
virtual bool ParseAttribute(int32_t aNamespaceID,

View File

@ -1054,7 +1054,7 @@ HTMLCanvasElement::GetSizeExternal()
}
NS_IMETHODIMP
HTMLCanvasElement::RenderContextsExternal(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter, uint32_t aFlags)
HTMLCanvasElement::RenderContextsExternal(gfxContext *aContext, GraphicsFilter aFilter, uint32_t aFlags)
{
if (!mCurrentContext)
return NS_OK;

View File

@ -29,6 +29,7 @@ class gfxXlibSurface;
#include "mozilla/unused.h"
class gfxASurface;
class gfxContext;
namespace mozilla {
namespace layers {

View File

@ -1268,15 +1268,15 @@ GLContext::CreateTextureImage(const nsIntSize& aSize,
aFlags, aImageFormat);
}
void GLContext::ApplyFilterToBoundTexture(gfxPattern::GraphicsFilter aFilter)
void GLContext::ApplyFilterToBoundTexture(GraphicsFilter aFilter)
{
ApplyFilterToBoundTexture(LOCAL_GL_TEXTURE_2D, aFilter);
}
void GLContext::ApplyFilterToBoundTexture(GLuint aTarget,
gfxPattern::GraphicsFilter aFilter)
GraphicsFilter aFilter)
{
if (aFilter == gfxPattern::FILTER_NEAREST) {
if (aFilter == GraphicsFilter::FILTER_NEAREST) {
fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST);
fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_NEAREST);
} else {

View File

@ -2401,13 +2401,13 @@ public:
/**
* Applies aFilter to the texture currently bound to GL_TEXTURE_2D.
*/
void ApplyFilterToBoundTexture(gfxPattern::GraphicsFilter aFilter);
void ApplyFilterToBoundTexture(GraphicsFilter aFilter);
/**
* Applies aFilter to the texture currently bound to aTarget.
*/
void ApplyFilterToBoundTexture(GLuint aTarget,
gfxPattern::GraphicsFilter aFilter);
GraphicsFilter aFilter);
virtual bool BindExternalBuffer(GLuint texture, void* buffer) { return false; }
virtual bool UnbindExternalBuffer(GLuint texture) { return false; }

View File

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

View File

@ -11,7 +11,7 @@
#include "nsTArray.h"
#include "gfxTypes.h"
#include "GLContextTypes.h"
#include "gfxPattern.h"
#include "GraphicsFilter.h"
#include "mozilla/gfx/Rect.h"
class gfxASurface;
@ -245,7 +245,7 @@ public:
virtual bool InUpdate() const = 0;
GLenum GetWrapMode() const { return mWrapMode; }
void SetFilter(gfxPattern::GraphicsFilter aFilter) { mFilter = aFilter; }
void SetFilter(GraphicsFilter aFilter) { mFilter = aFilter; }
/**
* Applies this TextureImage's filter, assuming that its texture is
@ -270,7 +270,7 @@ protected:
, mWrapMode(aWrapMode)
, mContentType(aContentType)
, mImageFormat(aImageFormat)
, mFilter(gfxPattern::FILTER_GOOD)
, mFilter(GraphicsFilter::FILTER_GOOD)
, mFlags(aFlags)
{}
@ -286,7 +286,7 @@ protected:
ContentType mContentType;
ImageFormat mImageFormat;
gfx::SurfaceFormat mTextureFormat;
gfxPattern::GraphicsFilter mFilter;
GraphicsFilter mFilter;
Flags mFlags;
};

View File

@ -7,6 +7,7 @@
#include "GLContext.h"
#include "gfxImageSurface.h"
#include "mozilla/gfx/MacIOSurface.h"
#include "mozilla/DebugOnly.h"
namespace mozilla {
namespace gl {

View File

@ -18,7 +18,7 @@
#include "gfx3DMatrix.h"
#include "gfxColor.h"
#include "gfxMatrix.h"
#include "gfxPattern.h"
#include "GraphicsFilter.h"
#include "gfxPoint.h"
#include "gfxRect.h"
#include "nsRect.h"
@ -35,7 +35,13 @@
namespace mozilla {
typedef gfxImageFormat PixelFormat;
typedef gfxPattern::GraphicsFilter GraphicsFilterType;
#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
typedef ::GraphicsFilter GraphicsFilterType;
#else
// If we don't have support for enum classes, then we need to use the actual
// enum type here instead of the simulated enum class.
typedef GraphicsFilter::Enum GraphicsFilterType;
#endif
} // namespace mozilla
@ -200,8 +206,8 @@ struct ParamTraits<gfxSurfaceType>
template <>
struct ParamTraits<mozilla::GraphicsFilterType>
: public EnumSerializer<mozilla::GraphicsFilterType,
gfxPattern::FILTER_FAST,
gfxPattern::FILTER_SENTINEL>
GraphicsFilter::FILTER_FAST,
GraphicsFilter::FILTER_SENTINEL>
{};
template <>

View File

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

View File

@ -7,7 +7,7 @@
#define GFX_IMAGELAYER_H
#include "Layers.h" // for Layer, etc
#include "gfxPattern.h" // for gfxPattern, etc
#include "GraphicsFilter.h" // for GraphicsFilter
#include "gfxPoint.h" // for gfxIntSize
#include "mozilla/gfx/BaseSize.h" // for BaseSize
#include "mozilla/layers/LayersTypes.h"
@ -37,7 +37,7 @@ public:
* CONSTRUCTION PHASE ONLY
* Set the filter used to resample this image if necessary.
*/
void SetFilter(gfxPattern::GraphicsFilter aFilter)
void SetFilter(GraphicsFilter aFilter)
{
if (mFilter != aFilter) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Filter", this));
@ -61,7 +61,7 @@ public:
ImageContainer* GetContainer() { return mContainer; }
gfxPattern::GraphicsFilter GetFilter() { return mFilter; }
GraphicsFilter GetFilter() { return mFilter; }
const gfxIntSize& GetScaleToSize() { return mScaleToSize; }
ScaleMode GetScaleMode() { return mScaleMode; }
@ -88,7 +88,7 @@ protected:
nsRefPtr<ImageContainer> mContainer;
gfxPattern::GraphicsFilter mFilter;
GraphicsFilter mFilter;
gfxIntSize mScaleToSize;
ScaleMode mScaleMode;
bool mDisallowBigImage;

View File

@ -10,7 +10,7 @@
#include "Layers.h" // for Layer, ContainerLayer, etc
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxColor.h" // for gfxRGBA
#include "gfxPattern.h" // for gfxPattern, etc
#include "GraphicsFilter.h" // for GraphicsFilter
#include "gfxPoint.h" // for gfxIntSize
#include "gfxPoint3D.h" // for gfxPoint3D
#include "gfxRect.h" // for gfxRect
@ -350,7 +350,7 @@ struct ImageLayerProperties : public LayerPropertiesBase
nsIntRegion mVisibleRegion;
nsRefPtr<ImageContainer> mContainer;
gfxPattern::GraphicsFilter mFilter;
GraphicsFilter mFilter;
gfxIntSize mScaleToSize;
ScaleMode mScaleMode;
};

View File

@ -1352,7 +1352,7 @@ nsACString&
CanvasLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
{
Layer::PrintInfo(aTo, aPrefix);
if (mFilter != gfxPattern::FILTER_GOOD) {
if (mFilter != GraphicsFilter::FILTER_GOOD) {
AppendToString(aTo, mFilter, " [filter=", "]");
}
return aTo;
@ -1362,7 +1362,7 @@ nsACString&
ImageLayer::PrintInfo(nsACString& aTo, const char* aPrefix)
{
Layer::PrintInfo(aTo, aPrefix);
if (mFilter != gfxPattern::FILTER_GOOD) {
if (mFilter != GraphicsFilter::FILTER_GOOD) {
AppendToString(aTo, mFilter, " [filter=", "]");
}
return aTo;

View File

@ -16,7 +16,7 @@
#include "gfxTypes.h"
#include "gfxColor.h" // for gfxRGBA
#include "gfxMatrix.h" // for gfxMatrix
#include "gfxPattern.h" // for gfxPattern, etc
#include "GraphicsFilter.h" // for GraphicsFilter
#include "gfxPoint.h" // for gfxPoint, gfxIntSize
#include "gfxRect.h" // for gfxRect
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2, etc
@ -1797,7 +1797,7 @@ public:
* CONSTRUCTION PHASE ONLY
* Set the filter used to resample this image (if necessary).
*/
void SetFilter(gfxPattern::GraphicsFilter aFilter)
void SetFilter(GraphicsFilter aFilter)
{
if (mFilter != aFilter) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Filter", this));
@ -1805,7 +1805,7 @@ public:
Mutated();
}
}
gfxPattern::GraphicsFilter GetFilter() const { return mFilter; }
GraphicsFilter GetFilter() const { return mFilter; }
MOZ_LAYER_DECL_NAME("CanvasLayer", TYPE_CANVAS)
@ -1829,7 +1829,7 @@ protected:
, mPreTransCallbackData(nullptr)
, mPostTransCallback(nullptr)
, mPostTransCallbackData(nullptr)
, mFilter(gfxPattern::FILTER_GOOD)
, mFilter(GraphicsFilter::FILTER_GOOD)
, mDirty(false)
{}
@ -1850,7 +1850,7 @@ protected:
void* mPreTransCallbackData;
DidTransactionCallback mPostTransCallback;
void* mPostTransCallbackData;
gfxPattern::GraphicsFilter mFilter;
GraphicsFilter mFilter;
private:
/**

View File

@ -31,17 +31,17 @@ AppendToString(nsACString& s, const void* p,
}
nsACString&
AppendToString(nsACString& s, const gfxPattern::GraphicsFilter& f,
AppendToString(nsACString& s, const GraphicsFilter& f,
const char* pfx, const char* sfx)
{
s += pfx;
switch (f) {
case gfxPattern::FILTER_FAST: s += "fast"; break;
case gfxPattern::FILTER_GOOD: s += "good"; break;
case gfxPattern::FILTER_BEST: s += "best"; break;
case gfxPattern::FILTER_NEAREST: s += "nearest"; break;
case gfxPattern::FILTER_BILINEAR: s += "bilinear"; break;
case gfxPattern::FILTER_GAUSSIAN: s += "gaussian"; break;
case GraphicsFilter::FILTER_FAST: s += "fast"; break;
case GraphicsFilter::FILTER_GOOD: s += "good"; break;
case GraphicsFilter::FILTER_BEST: s += "best"; break;
case GraphicsFilter::FILTER_NEAREST: s += "nearest"; break;
case GraphicsFilter::FILTER_BILINEAR: s += "bilinear"; break;
case GraphicsFilter::FILTER_GAUSSIAN: s += "gaussian"; break;
default:
NS_ERROR("unknown filter type");
s += "???";

View File

@ -7,7 +7,7 @@
#define GFX_LAYERSLOGGING_H
#include "FrameMetrics.h" // for FrameMetrics, etc
#include "gfxPattern.h" // for gfxPattern, etc
#include "GraphicsFilter.h" // for GraphicsFilter
#include "mozilla/gfx/Point.h" // for IntSize, etc
#include "mozilla/gfx/Types.h" // for Filter, SurfaceFormat
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags
@ -35,7 +35,7 @@ AppendToString(nsACString& s, const void* p,
const char* pfx="", const char* sfx="");
nsACString&
AppendToString(nsACString& s, const gfxPattern::GraphicsFilter& f,
AppendToString(nsACString& s, const GraphicsFilter& f,
const char* pfx="", const char* sfx="");
nsACString&

View File

@ -107,7 +107,7 @@ RotatedBuffer::DrawBufferQuadrant(gfxContext* aTarget,
nsRefPtr<gfxPattern> pattern = new gfxPattern(source);
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
gfxPattern::GraphicsFilter filter = gfxPattern::FILTER_NEAREST;
GraphicsFilter filter = GraphicsFilter::FILTER_NEAREST;
pattern->SetFilter(filter);
#endif

View File

@ -7,7 +7,7 @@
#include "composite/CompositableHost.h" // for CompositableHost
#include "gfx2DGlue.h" // for ToFilter, ToMatrix4x4
#include "gfxImageSurface.h" // for gfxImageSurface
#include "gfxPattern.h" // for gfxPattern, etc
#include "GraphicsFilter.h" // for GraphicsFilter
#include "gfxUtils.h" // for gfxUtils, etc
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for Point
@ -77,7 +77,7 @@ CanvasLayerComposite::RenderLayer(const nsIntPoint& aOffset,
}
#endif
gfxPattern::GraphicsFilter filter = mFilter;
GraphicsFilter filter = mFilter;
#ifdef ANDROID
// Bug 691354
// Using the LINEAR filter we get unexplained artifacts.
@ -85,7 +85,7 @@ CanvasLayerComposite::RenderLayer(const nsIntPoint& aOffset,
gfxMatrix matrix;
bool is2D = GetEffectiveTransform().Is2D(&matrix);
if (is2D && !matrix.HasNonTranslationOrFlip()) {
filter = gfxPattern::FILTER_NEAREST;
filter = GraphicsFilter::FILTER_NEAREST;
}
#endif

View File

@ -240,7 +240,7 @@ CanvasLayerD3D10::RenderLayer()
shaderFlags |= mDataIsPremultiplied
? SHADER_PREMUL : SHADER_NON_PREMUL | SHADER_RGBA;
shaderFlags |= mHasAlpha ? SHADER_RGBA : SHADER_RGB;
shaderFlags |= mFilter == gfxPattern::FILTER_NEAREST
shaderFlags |= mFilter == GraphicsFilter::FILTER_NEAREST
? SHADER_POINT : SHADER_LINEAR;
ID3D10EffectTechnique* technique = SelectShader(shaderFlags);

View File

@ -228,7 +228,7 @@ ImageLayerD3D10::RenderLayer()
shaderFlags |= LoadMaskTexture();
shaderFlags |= hasAlpha
? SHADER_RGBA : SHADER_RGB;
shaderFlags |= mFilter == gfxPattern::FILTER_NEAREST
shaderFlags |= mFilter == GraphicsFilter::FILTER_NEAREST
? SHADER_POINT : SHADER_LINEAR;
technique = SelectShader(shaderFlags);

View File

@ -210,7 +210,7 @@ CanvasLayerD3D9::RenderLayer()
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBLAYER, GetMaskLayer());
}
if (mFilter == gfxPattern::FILTER_NEAREST) {
if (mFilter == GraphicsFilter::FILTER_NEAREST) {
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
}
@ -224,7 +224,7 @@ CanvasLayerD3D9::RenderLayer()
device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
device()->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
}
if (mFilter == gfxPattern::FILTER_NEAREST) {
if (mFilter == GraphicsFilter::FILTER_NEAREST) {
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
}

View File

@ -430,7 +430,7 @@ ImageLayerD3D9::RenderLayer()
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBLAYER, GetMaskLayer());
}
if (mFilter == gfxPattern::FILTER_NEAREST) {
if (mFilter == GraphicsFilter::FILTER_NEAREST) {
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
}
@ -440,7 +440,7 @@ ImageLayerD3D9::RenderLayer()
autoLock.Unlock();
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
if (mFilter == gfxPattern::FILTER_NEAREST) {
if (mFilter == GraphicsFilter::FILTER_NEAREST) {
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
}

View File

@ -18,7 +18,7 @@
#include "gfxCrashReporterUtils.h" // for ScopedGfxFeatureReporter
#include "gfxImageSurface.h" // for gfxImageSurface
#include "gfxMatrix.h" // for gfxMatrix
#include "gfxPattern.h" // for gfxPattern, etc
#include "GraphicsFilter.h" // for GraphicsFilter
#include "gfxPlatform.h" // for gfxPlatform
#include "gfxRect.h" // for gfxRect
#include "gfxUtils.h" // for NextPowerOfTwo, gfxUtils, etc
@ -1125,7 +1125,7 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
return;
}
gfxPattern::GraphicsFilter filter = ThebesFilter(effectYCbCr->mFilter);
GraphicsFilter filter = ThebesFilter(effectYCbCr->mFilter);
AutoBindTexture bindY(sourceY, LOCAL_GL_TEXTURE0);
mGLContext->ApplyFilterToBoundTexture(filter);

View File

@ -318,7 +318,7 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset,
gfxMatrix matrix;
bool is2D = mLayer->GetEffectiveTransform().Is2D(&matrix);
if (is2D && !matrix.HasNonTranslationOrFlip()) {
gl()->ApplyFilterToBoundTexture(gfxPattern::FILTER_NEAREST);
gl()->ApplyFilterToBoundTexture(GraphicsFilter::FILTER_NEAREST);
} else {
mTexImage->ApplyFilter();
}

View File

@ -0,0 +1,22 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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/. */
#ifndef GraphicsFilter_h
#define GraphicsFilter_h
#include "mozilla/TypedEnum.h"
MOZ_BEGIN_ENUM_CLASS(GraphicsFilter, int)
FILTER_FAST,
FILTER_GOOD,
FILTER_BEST,
FILTER_NEAREST,
FILTER_BILINEAR,
FILTER_GAUSSIAN,
FILTER_SENTINEL
MOZ_END_ENUM_CLASS(GraphicsFilter)
#endif

View File

@ -64,25 +64,25 @@ inline IntSize ToIntSize(const gfxIntSize &aSize)
return IntSize(aSize.width, aSize.height);
}
inline Filter ToFilter(gfxPattern::GraphicsFilter aFilter)
inline Filter ToFilter(GraphicsFilter aFilter)
{
switch (aFilter) {
case gfxPattern::FILTER_NEAREST:
case GraphicsFilter::FILTER_NEAREST:
return FILTER_POINT;
case gfxPattern::FILTER_GOOD:
case GraphicsFilter::FILTER_GOOD:
return FILTER_GOOD;
default:
return FILTER_LINEAR;
}
}
inline gfxPattern::GraphicsFilter ThebesFilter(Filter aFilter)
inline GraphicsFilter ThebesFilter(Filter aFilter)
{
switch (aFilter) {
case FILTER_POINT:
return gfxPattern::FILTER_NEAREST;
return GraphicsFilter::FILTER_NEAREST;
default:
return gfxPattern::FILTER_BEST;
return GraphicsFilter::FILTER_BEST;
}
}

View File

@ -39,7 +39,7 @@ static void
PreparePatternForUntiledDrawing(gfxPattern* aPattern,
const gfxMatrix& aDeviceToImage,
gfxASurface *currentTarget,
const gfxPattern::GraphicsFilter aDefaultFilter)
const GraphicsFilter aDefaultFilter)
{
if (!currentTarget) {
// This happens if we're dealing with an Azure target.
@ -78,8 +78,8 @@ PreparePatternForUntiledDrawing(gfxPattern* aPattern,
aDeviceToImage.xx >= 1.0 && aDeviceToImage.yy >= 1.0 &&
aDeviceToImage.xy == 0.0 && aDeviceToImage.yx == 0.0;
gfxPattern::GraphicsFilter filter =
isDownscale ? aDefaultFilter : gfxPattern::FILTER_FAST;
GraphicsFilter filter =
isDownscale ? aDefaultFilter : GraphicsFilter::FILTER_FAST;
aPattern->SetFilter(filter);
// Use the default EXTEND_NONE
@ -103,7 +103,7 @@ bool
gfxSurfaceDrawable::Draw(gfxContext* aContext,
const gfxRect& aFillRect,
bool aRepeat,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform)
{
nsRefPtr<gfxPattern> pattern = new gfxPattern(mSurface);
@ -111,14 +111,14 @@ gfxSurfaceDrawable::Draw(gfxContext* aContext,
pattern->SetExtend(gfxPattern::EXTEND_REPEAT);
pattern->SetFilter(aFilter);
} else {
gfxPattern::GraphicsFilter filter = aFilter;
GraphicsFilter filter = aFilter;
if (aContext->CurrentMatrix().HasOnlyIntegerTranslation() &&
aTransform.HasOnlyIntegerTranslation())
{
// If we only have integer translation, no special filtering needs to
// happen and we explicitly use FILTER_FAST. This is fast for some
// backends.
filter = gfxPattern::FILTER_FAST;
filter = GraphicsFilter::FILTER_FAST;
}
nsRefPtr<gfxASurface> currentTarget = aContext->CurrentSurface();
gfxMatrix deviceSpaceToImageSpace =
@ -148,7 +148,7 @@ gfxCallbackDrawable::gfxCallbackDrawable(gfxDrawingCallback* aCallback,
}
already_AddRefed<gfxSurfaceDrawable>
gfxCallbackDrawable::MakeSurfaceDrawable(const gfxPattern::GraphicsFilter aFilter)
gfxCallbackDrawable::MakeSurfaceDrawable(const GraphicsFilter aFilter)
{
nsRefPtr<gfxASurface> surface =
gfxPlatform::GetPlatform()->CreateOffscreenSurface(mSize, GFX_CONTENT_COLOR_ALPHA);
@ -165,7 +165,7 @@ bool
gfxCallbackDrawable::Draw(gfxContext* aContext,
const gfxRect& aFillRect,
bool aRepeat,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform)
{
if (aRepeat && !mSurfaceDrawable) {
@ -200,7 +200,7 @@ public:
virtual bool operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform = gfxMatrix())
{
return mDrawable->Draw(aContext, aFillRect, false, aFilter,
@ -224,7 +224,7 @@ bool
gfxPatternDrawable::Draw(gfxContext* aContext,
const gfxRect& aFillRect,
bool aRepeat,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform)
{
if (!mPattern)

View File

@ -12,11 +12,12 @@
#include "gfxRect.h"
#include "gfxColor.h"
#include "gfxMatrix.h"
#include "gfxPattern.h"
#include "GraphicsFilter.h"
class gfxASurface;
class gfxImageSurface;
class gfxContext;
class gfxPattern;
/**
* gfxDrawable
@ -40,7 +41,7 @@ public:
virtual bool Draw(gfxContext* aContext,
const gfxRect& aFillRect,
bool aRepeat,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform = gfxMatrix()) = 0;
virtual already_AddRefed<gfxImageSurface> GetAsImageSurface() { return nullptr; }
virtual gfxIntSize Size() { return mSize; }
@ -62,7 +63,7 @@ public:
virtual bool Draw(gfxContext* aContext,
const gfxRect& aFillRect,
bool aRepeat,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform = gfxMatrix());
virtual already_AddRefed<gfxImageSurface> GetAsImageSurface();
@ -90,7 +91,7 @@ public:
*/
virtual bool operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform = gfxMatrix()) = 0;
};
@ -107,11 +108,11 @@ public:
virtual bool Draw(gfxContext* aContext,
const gfxRect& aFillRect,
bool aRepeat,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform = gfxMatrix());
protected:
already_AddRefed<gfxSurfaceDrawable> MakeSurfaceDrawable(const gfxPattern::GraphicsFilter aFilter = gfxPattern::FILTER_FAST);
already_AddRefed<gfxSurfaceDrawable> MakeSurfaceDrawable(const GraphicsFilter aFilter = GraphicsFilter::FILTER_FAST);
nsRefPtr<gfxDrawingCallback> mCallback;
nsRefPtr<gfxSurfaceDrawable> mSurfaceDrawable;
@ -130,7 +131,7 @@ public:
virtual bool Draw(gfxContext* aContext,
const gfxRect& aFillRect,
bool aRepeat,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform = gfxMatrix());
protected:

View File

@ -367,13 +367,13 @@ void
gfxPattern::SetFilter(GraphicsFilter filter)
{
if (mPattern) {
cairo_pattern_set_filter(mPattern, (cairo_filter_t)filter);
cairo_pattern_set_filter(mPattern, (cairo_filter_t)(int)filter);
} else {
mFilter = ToFilter(filter);
}
}
gfxPattern::GraphicsFilter
GraphicsFilter
gfxPattern::Filter() const
{
if (mPattern) {

View File

@ -14,6 +14,7 @@
#include "nsAutoPtr.h"
#include "mozilla/Alignment.h"
#include "mozilla/gfx/2D.h"
#include "GraphicsFilter.h"
class gfxContext;
class gfxASurface;
@ -84,16 +85,6 @@ public:
int CairoStatus();
enum GraphicsFilter {
FILTER_FAST,
FILTER_GOOD,
FILTER_BEST,
FILTER_NEAREST,
FILTER_BILINEAR,
FILTER_GAUSSIAN,
FILTER_SENTINEL
};
void SetFilter(GraphicsFilter filter);
GraphicsFilter Filter() const;

View File

@ -260,7 +260,7 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
nsRefPtr<gfxContext> tmpCtx = new gfxContext(temp);
tmpCtx->SetOperator(OptimalFillOperator());
aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), true,
gfxPattern::FILTER_FAST, gfxMatrix().Translate(needed.TopLeft()));
GraphicsFilter::FILTER_FAST, gfxMatrix().Translate(needed.TopLeft()));
}
nsRefPtr<gfxDrawable> drawable =
@ -348,9 +348,9 @@ DeviceToImageTransform(gfxContext* aContext,
/* These heuristics are based on Source/WebCore/platform/graphics/skia/ImageSkia.cpp:computeResamplingMode() */
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
static gfxPattern::GraphicsFilter ReduceResamplingFilter(gfxPattern::GraphicsFilter aFilter,
int aImgWidth, int aImgHeight,
float aSourceWidth, float aSourceHeight)
static GraphicsFilter ReduceResamplingFilter(GraphicsFilter aFilter,
int aImgWidth, int aImgHeight,
float aSourceWidth, float aSourceHeight)
{
// Images smaller than this in either direction are considered "small" and
// are not resampled ever (see below).
@ -365,7 +365,7 @@ static gfxPattern::GraphicsFilter ReduceResamplingFilter(gfxPattern::GraphicsFil
|| aImgHeight <= kSmallImageSizeThreshold) {
// Never resample small images. These are often used for borders and
// rules (think 1x1 images used to make lines).
return gfxPattern::FILTER_NEAREST;
return GraphicsFilter::FILTER_NEAREST;
}
if (aImgHeight * kLargeStretch <= aSourceHeight || aImgWidth * kLargeStretch <= aSourceWidth) {
@ -376,7 +376,7 @@ static gfxPattern::GraphicsFilter ReduceResamplingFilter(gfxPattern::GraphicsFil
// (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 gfxPattern::FILTER_NEAREST;
return GraphicsFilter::FILTER_NEAREST;
// 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.
@ -404,9 +404,9 @@ static gfxPattern::GraphicsFilter ReduceResamplingFilter(gfxPattern::GraphicsFil
return aFilter;
}
#else
static gfxPattern::GraphicsFilter ReduceResamplingFilter(gfxPattern::GraphicsFilter aFilter,
int aImgWidth, int aImgHeight,
int aSourceWidth, int aSourceHeight)
static GraphicsFilter ReduceResamplingFilter(GraphicsFilter aFilter,
int aImgWidth, int aImgHeight,
int aSourceWidth, int aSourceHeight)
{
// Just pass the filter through unchanged
return aFilter;
@ -422,7 +422,7 @@ gfxUtils::DrawPixelSnapped(gfxContext* aContext,
const gfxRect& aImageRect,
const gfxRect& aFill,
const gfxImageFormat aFormat,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
uint32_t aImageFlags)
{
PROFILER_LABEL("gfxUtils", "DrawPixelSnapped");

View File

@ -7,7 +7,7 @@
#define GFX_UTILS_H
#include "gfxTypes.h"
#include "gfxPattern.h"
#include "GraphicsFilter.h"
#include "gfxImageSurface.h"
#include "ImageContainer.h"
#include "mozilla/gfx/2D.h"
@ -58,7 +58,7 @@ public:
const gfxRect& aImageRect,
const gfxRect& aFill,
const gfxImageFormat aFormat,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
uint32_t aImageFlags = imgIContainer::FLAG_NONE);
/**

View File

@ -283,7 +283,7 @@ gfxWindowsNativeDrawing::PaintToContext()
pat->SetMatrix(m);
if (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING)
pat->SetFilter(gfxPattern::FILTER_FAST);
pat->SetFilter(GraphicsFilter::FILTER_FAST);
pat->SetExtend(gfxPattern::EXTEND_PAD);
mContext->SetPattern(pat);

View File

@ -7,6 +7,7 @@
MODULE = 'thebes'
EXPORTS += [
'GraphicsFilter.h',
'RoundedRect.h',
'gfx2DGlue.h',
'gfx3DMatrix.h',

View File

@ -11,7 +11,7 @@
#include "gfxContext.h"
#include "gfxMatrix.h"
#include "gfxRect.h"
#include "gfxPattern.h"
#include "GraphicsFilter.h"
#include "gfxASurface.h"
#include "nsRect.h"
#include "nsSize.h"
@ -45,7 +45,7 @@ native gfxImageFormat(gfxASurface::gfxImageFormat);
[ptr] native gfxContext(gfxContext);
[ref] native gfxMatrix(gfxMatrix);
[ref] native gfxRect(gfxRect);
native gfxGraphicsFilter(gfxPattern::GraphicsFilter);
native gfxGraphicsFilter(GraphicsFilter);
[ref] native nsIntRect(nsIntRect);
[ref] native nsIntSize(nsIntSize);
native nsSize(nsSize);

View File

@ -83,7 +83,7 @@ public:
virtual bool operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform)
{
// Draw the image. |gfxCallbackDrawable| always calls this function with
@ -253,7 +253,7 @@ ClippedImage::GetFrameInternal(const nsIntSize& aViewportSize,
gfxUtils::DrawPixelSnapped(ctx, drawable, gfxMatrix(),
imageRect, imageRect, imageRect, imageRect,
gfxImageFormatARGB32,
gfxPattern::FILTER_FAST);
GraphicsFilter::FILTER_FAST);
// Cache the resulting surface.
mCachedSurface = new ClippedImageCachedSurface(target,
@ -305,7 +305,7 @@ ClippedImage::MustCreateSurface(gfxContext* aContext,
NS_IMETHODIMP
ClippedImage::Draw(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,
@ -362,7 +362,7 @@ ClippedImage::ClampFactor(const gfxFloat aToClamp, const int aReference) const
nsresult
ClippedImage::DrawSingleTile(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,

View File

@ -41,7 +41,7 @@ public:
NS_IMETHOD GetImageContainer(mozilla::layers::LayerManager* aManager,
mozilla::layers::ImageContainer** _retval) MOZ_OVERRIDE;
NS_IMETHOD Draw(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,
@ -69,7 +69,7 @@ private:
const uint32_t aFlags) const;
gfxFloat ClampFactor(const gfxFloat aToClamp, const int aReference) const;
nsresult DrawSingleTile(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,

View File

@ -70,7 +70,7 @@ FrozenImage::GetImageContainer(layers::LayerManager* aManager,
NS_IMETHODIMP
FrozenImage::Draw(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,

View File

@ -41,7 +41,7 @@ public:
NS_IMETHOD GetImageContainer(layers::LayerManager* aManager,
layers::ImageContainer** _retval) MOZ_OVERRIDE;
NS_IMETHOD Draw(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,

View File

@ -218,7 +218,7 @@ ImageWrapper::GetImageContainer(LayerManager* aManager, ImageContainer** _retval
NS_IMETHODIMP
ImageWrapper::Draw(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,

View File

@ -127,7 +127,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
gfxRect imageRect(0, 0, width, height);
gfxUtils::DrawPixelSnapped(ctx, drawable, OrientationMatrix(nsIntSize(width, height)),
imageRect, imageRect, imageRect, imageRect,
imageFormat, gfxPattern::FILTER_FAST);
imageFormat, GraphicsFilter::FILTER_FAST);
surface.forget(_retval);
return NS_OK;
@ -215,7 +215,7 @@ OrientedImage::OrientationMatrix(const nsIntSize& aViewportSize)
NS_IMETHODIMP
OrientedImage::Draw(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,

View File

@ -38,7 +38,7 @@ public:
NS_IMETHOD GetImageContainer(mozilla::layers::LayerManager* aManager,
mozilla::layers::ImageContainer** _retval) MOZ_OVERRIDE;
NS_IMETHOD Draw(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,

View File

@ -2453,7 +2453,7 @@ RasterImage::CanQualityScale(const gfxSize& scale)
}
bool
RasterImage::CanScale(gfxPattern::GraphicsFilter aFilter,
RasterImage::CanScale(GraphicsFilter aFilter,
gfxSize aScale, uint32_t aFlags)
{
// The high-quality scaler requires Skia.
@ -2462,7 +2462,7 @@ RasterImage::CanScale(gfxPattern::GraphicsFilter aFilter,
// bunch of work on an image that just gets thrown away.
// We only use the scaler when drawing to the window because, if we're not
// drawing to a window (eg a canvas), updates to that image will be ignored.
if (gHQDownscaling && aFilter == gfxPattern::FILTER_GOOD &&
if (gHQDownscaling && aFilter == GraphicsFilter::FILTER_GOOD &&
!mAnim && mDecoded && !mMultipart && CanQualityScale(aScale) &&
(aFlags & imgIContainer::FLAG_HIGH_QUALITY_SCALING)) {
gfxFloat factor = gHQDownscalingMinFactor / 1000.0;
@ -2519,7 +2519,7 @@ RasterImage::ScalingDone(ScaleRequest* request, ScaleStatus status)
void
RasterImage::DrawWithPreDownscaleIfNeeded(imgFrame *aFrame,
gfxContext *aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix &aUserSpaceToImageSpace,
const gfxRect &aFill,
const nsIntRect &aSubimage,
@ -2594,7 +2594,7 @@ RasterImage::DrawWithPreDownscaleIfNeeded(imgFrame *aFrame,
* in uint32_t aFlags); */
NS_IMETHODIMP
RasterImage::Draw(gfxContext *aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix &aUserSpaceToImageSpace,
const gfxRect &aFill,
const nsIntRect &aSubimage,

View File

@ -528,7 +528,7 @@ private:
void DrawWithPreDownscaleIfNeeded(imgFrame *aFrame,
gfxContext *aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix &aUserSpaceToImageSpace,
const gfxRect &aFill,
const nsIntRect &aSubimage,
@ -697,7 +697,7 @@ private: // data
TimeStamp mDrawStartTime;
inline bool CanQualityScale(const gfxSize& scale);
inline bool CanScale(gfxPattern::GraphicsFilter aFilter, gfxSize aScale, uint32_t aFlags);
inline bool CanScale(GraphicsFilter aFilter, gfxSize aScale, uint32_t aFlags);
struct ScaleResult
{

View File

@ -235,7 +235,7 @@ public:
{}
virtual bool operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform);
private:
nsRefPtr<SVGDocumentWrapper> mSVGDocumentWrapper;
@ -248,7 +248,7 @@ private:
bool
SVGDrawingCallback::operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform)
{
MOZ_ASSERT(mSVGDocumentWrapper, "need an SVGDocumentWrapper");
@ -655,7 +655,7 @@ VectorImage::GetFrame(uint32_t aWhichFrame,
// Draw to our surface!
// --------------------
nsresult rv = Draw(context, gfxPattern::FILTER_NEAREST, gfxMatrix(),
nsresult rv = Draw(context, GraphicsFilter::FILTER_NEAREST, gfxMatrix(),
gfxRect(gfxPoint(0,0), gfxIntSize(imageIntSize.width,
imageIntSize.height)),
nsIntRect(nsIntPoint(0,0), imageIntSize),
@ -688,7 +688,7 @@ VectorImage::GetImageContainer(LayerManager* aManager,
* in uint32_t aFlags); */
NS_IMETHODIMP
VectorImage::Draw(gfxContext* aContext,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const gfxMatrix& aUserSpaceToImageSpace,
const gfxRect& aFill,
const nsIntRect& aSubimage,

View File

@ -448,7 +448,7 @@ imgFrame::SurfaceForDrawing(bool aDoPadding,
mFormat);
}
void imgFrame::Draw(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter,
void imgFrame::Draw(gfxContext *aContext, GraphicsFilter aFilter,
const gfxMatrix &aUserSpaceToImageSpace, const gfxRect& aFill,
const nsIntMargin &aPadding, const nsIntRect &aSubimage,
uint32_t aImageFlags)

View File

@ -32,7 +32,7 @@ public:
nsresult Init(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, gfxImageFormat aFormat, uint8_t aPaletteDepth = 0);
nsresult Optimize();
void Draw(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter,
void Draw(gfxContext *aContext, GraphicsFilter aFilter,
const gfxMatrix &aUserSpaceToImageSpace, const gfxRect& aFill,
const nsIntMargin &aPadding, const nsIntRect &aSubimage,
uint32_t aImageFlags = imgIContainer::FLAG_NONE);

View File

@ -3491,7 +3491,7 @@ DrawBorderImageComponent(nsRenderingContext& aRenderingContext,
aStyleBorder.SetSubImage(aIndex, subImage);
}
gfxPattern::GraphicsFilter graphicsFilter =
GraphicsFilter graphicsFilter =
nsLayoutUtils::GetGraphicsFilterForFrame(aForFrame);
// If we have no tiling in either direction, we can skip the intermediate
@ -4730,7 +4730,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
return;
}
gfxPattern::GraphicsFilter graphicsFilter =
GraphicsFilter graphicsFilter =
nsLayoutUtils::GetGraphicsFilterForFrame(mForFrame);
switch (mType) {
@ -4791,7 +4791,7 @@ nsImageRenderer::DrawBackground(nsPresContext* aPresContext,
}
if (mType == eStyleImageType_Image) {
gfxPattern::GraphicsFilter graphicsFilter =
GraphicsFilter graphicsFilter =
nsLayoutUtils::GetGraphicsFilterForFrame(mForFrame);
nsLayoutUtils::DrawBackgroundImage(&aRenderingContext, mImageContainer,

View File

@ -101,7 +101,6 @@ using mozilla::image::Orientation;
bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
#endif // DEBUG
typedef gfxPattern::GraphicsFilter GraphicsFilter;
typedef FrameMetrics::ViewID ViewID;
/* static */ uint32_t nsLayoutUtils::sFontSizeInflationEmPerLine;
@ -3854,7 +3853,7 @@ nsLayoutUtils::GetClosestLayer(nsIFrame* aFrame)
GraphicsFilter
nsLayoutUtils::GetGraphicsFilterForFrame(nsIFrame* aForFrame)
{
GraphicsFilter defaultFilter = gfxPattern::FILTER_GOOD;
GraphicsFilter defaultFilter = GraphicsFilter::FILTER_GOOD;
nsStyleContext *sc;
if (nsCSSRendering::IsCanvasFrame(aForFrame)) {
nsCSSRendering::FindBackground(aForFrame, &sc);
@ -3864,11 +3863,11 @@ nsLayoutUtils::GetGraphicsFilterForFrame(nsIFrame* aForFrame)
switch (sc->StyleSVG()->mImageRendering) {
case NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED:
return gfxPattern::FILTER_FAST;
return GraphicsFilter::FILTER_FAST;
case NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY:
return gfxPattern::FILTER_BEST;
return GraphicsFilter::FILTER_BEST;
case NS_STYLE_IMAGE_RENDERING_CRISPEDGES:
return gfxPattern::FILTER_NEAREST;
return GraphicsFilter::FILTER_NEAREST;
default:
return defaultFilter;
}
@ -4245,7 +4244,7 @@ nsLayoutUtils::DrawBackgroundImage(nsRenderingContext* aRenderingContext,
PROFILER_LABEL("layout", "nsLayoutUtils::DrawBackgroundImage");
if (UseBackgroundNearestFiltering()) {
aGraphicsFilter = gfxPattern::FILTER_NEAREST;
aGraphicsFilter = GraphicsFilter::FILTER_NEAREST;
}
return DrawImageInternal(aRenderingContext, aImage, aGraphicsFilter,
@ -4730,7 +4729,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement,
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
// XXX shouldn't use the external interface, but maybe we can layerify this
uint32_t flags = premultAlpha ? HTMLCanvasElement::RenderFlagPremultAlpha : 0;
rv = aElement->RenderContextsExternal(ctx, gfxPattern::FILTER_NEAREST, flags);
rv = aElement->RenderContextsExternal(ctx, GraphicsFilter::FILTER_NEAREST, flags);
if (NS_FAILED(rv))
return result;
}

View File

@ -42,7 +42,7 @@ struct nsOverflowAreas;
#include "nsFrameList.h"
#include "nsThreadUtils.h"
#include "nsIPrincipal.h"
#include "gfxPattern.h"
#include "GraphicsFilter.h"
#include "nsCSSPseudoElements.h"
#include "FrameMetrics.h"
#include "gfx3DMatrix.h"
@ -74,7 +74,7 @@ class HTMLVideoElement;
*/
class nsLayoutUtils
{
typedef gfxPattern::GraphicsFilter GraphicsFilter;
typedef ::GraphicsFilter GraphicsFilter;
public:
typedef mozilla::layers::FrameMetrics FrameMetrics;

View File

@ -1562,12 +1562,12 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
imglayer->SetScaleToSize(size, SCALE_STRETCH);
imglayer->SetContainer(container);
gfxPattern::GraphicsFilter filter =
GraphicsFilter filter =
nsLayoutUtils::GetGraphicsFilterForFrame(this);
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
if (!aManager->IsCompositingCheap()) {
// Pixman just horrible with bilinear filter scaling
filter = gfxPattern::FILTER_NEAREST;
filter = GraphicsFilter::FILTER_NEAREST;
}
#endif
imglayer->SetFilter(filter);

View File

@ -591,7 +591,7 @@ public:
{}
virtual bool operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform);
private:
nsIFrame* mFrame;
@ -603,7 +603,7 @@ private:
bool
PaintFrameCallback::operator()(gfxContext* aContext,
const gfxRect& aFillRect,
const gfxPattern::GraphicsFilter& aFilter,
const GraphicsFilter& aFilter,
const gfxMatrix& aTransform)
{
if (mFrame->GetStateBits() & NS_FRAME_DRAWING_AS_PAINTSERVER)
@ -718,7 +718,7 @@ DrawableFromPaintServer(nsIFrame* aFrame,
nsSVGIntegrationUtils::DrawPaintServer(nsRenderingContext* aRenderingContext,
nsIFrame* aTarget,
nsIFrame* aPaintServer,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,

View File

@ -7,7 +7,7 @@
#define NSSVGINTEGRATIONUTILS_H_
#include "gfxMatrix.h"
#include "gfxPattern.h"
#include "GraphicsFilter.h"
#include "gfxRect.h"
class nsDisplayList;
@ -188,7 +188,7 @@ public:
DrawPaintServer(nsRenderingContext* aRenderingContext,
nsIFrame* aTarget,
nsIFrame* aPaintServer,
gfxPattern::GraphicsFilter aFilter,
GraphicsFilter aFilter,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,

View File

@ -3392,7 +3392,7 @@ nsTreeBodyFrame::PaintTwisty(int32_t aRowIndex,
// Paint the image.
nsLayoutUtils::DrawSingleUnscaledImage(&aRenderingContext, image,
gfxPattern::FILTER_NEAREST, pt, &aDirtyRect,
GraphicsFilter::FILTER_NEAREST, pt, &aDirtyRect,
imgIContainer::FLAG_NONE, &imageSize);
}
}
@ -3715,7 +3715,7 @@ nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex,
// Paint the image.
nsLayoutUtils::DrawSingleUnscaledImage(&aRenderingContext, image,
gfxPattern::FILTER_NEAREST, pt, &aDirtyRect,
GraphicsFilter::FILTER_NEAREST, pt, &aDirtyRect,
imgIContainer::FLAG_NONE, &imageSize);
}
}

View File

@ -638,12 +638,12 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
gfxMatrix scale =
gfxMatrix().Scale(srcSize.width/outRect.Width(), srcSize.height/outRect.Height());
nsIntRect imgSize(0, 0, srcSize.width, srcSize.height);
imgContainer->Draw(ctx, gfxPattern::FILTER_GOOD, scale, outRect, imgSize,
imgContainer->Draw(ctx, GraphicsFilter::FILTER_GOOD, scale, outRect, imgSize,
destSize, nullptr, imgIContainer::FRAME_CURRENT,
imgIContainer::FLAG_SYNC_DECODE);
return NS_OK;
} else {
return aCanvas->RenderContextsExternal(ctx, gfxPattern::FILTER_GOOD);
return aCanvas->RenderContextsExternal(ctx, GraphicsFilter::FILTER_GOOD);
}
}