--- a/gfx/cairo/cairo/src/cairo-script-surface.c
+++ b/gfx/cairo/cairo/src/cairo-script-surface.c
@@ -325,17 +325,17 @@ static const char *
return names[extend];
}
static const char *
_filter_to_string (cairo_filter_t filter)
{
static const char *names[] = {
"FILTER_FAST", /* CAIRO_FILTER_FAST */
- "Filter::GOOD", /* CAIRO_FILTER_GOOD */
+ "SamplingFilter::GOOD", /* CAIRO_FILTER_GOOD */
"FILTER_BEST", /* CAIRO_FILTER_BEST */
"FILTER_NEAREST", /* CAIRO_FILTER_NEAREST */
"FILTER_BILINEAR", /* CAIRO_FILTER_BILINEAR */
"FILTER_GAUSSIAN", /* CAIRO_FILTER_GAUSSIAN */
};
assert (filter < ARRAY_LENGTH (names));
return names[filter];
}
--- a/gfx/cairo/cairo/src/cairo-xml-surface.c
+++ b/gfx/cairo/cairo/src/cairo-xml-surface.c
@@ -126,17 +126,17 @@ static const char *
return names[extend];
}
static const char *
_filter_to_string (cairo_filter_t filter)
{
static const char *names[] = {
"FILTER_FAST", /* CAIRO_FILTER_FAST */
- "Filter::GOOD", /* CAIRO_FILTER_GOOD */
+ "SamplingFilter::GOOD", /* CAIRO_FILTER_GOOD */
"FILTER_BEST", /* CAIRO_FILTER_BEST */
"FILTER_NEAREST", /* CAIRO_FILTER_NEAREST */
"FILTER_BILINEAR", /* CAIRO_FILTER_BILINEAR */
"FILTER_GAUSSIAN", /* CAIRO_FILTER_GAUSSIAN */
};
assert (filter < ARRAY_LENGTH (names));
return names[filter];
}
--- a/gfx/gl/GLTextureImage.cpp
+++ b/gfx/gl/GLTextureImage.cpp
@@ -288,17 +288,17 @@ gfx::IntSize TextureImage::GetSize() con
TextureImage::TextureImage(const gfx::IntSize& aSize,
GLenum aWrapMode, ContentType aContentType,
Flags aFlags)
: mSize(aSize)
, mWrapMode(aWrapMode)
, mContentType(aContentType)
, mTextureFormat(gfx::SurfaceFormat::UNKNOWN)
- , mFilter(Filter::GOOD)
+ , mSamplingFilter(SamplingFilter::GOOD)
, mFlags(aFlags)
, mUploadSize(0)
{}
BasicTextureImage::BasicTextureImage(GLuint aTexture,
const gfx::IntSize& aSize,
GLenum aWrapMode,
ContentType aContentType,
--- a/gfx/gl/GLTextureImage.h
+++ b/gfx/gl/GLTextureImage.h
@@ -193,17 +193,19 @@ public:
{ return nullptr; }
gfx::IntSize GetSize() const;
ContentType GetContentType() const { return mContentType; }
virtual bool InUpdate() const = 0;
GLenum GetWrapMode() const { return mWrapMode; }
- void SetFilter(gfx::Filter aFilter) { mFilter = aFilter; }
+ void SetSamplingFilter(gfx::SamplingFilter aSamplingFilter) {
+ mSamplingFilter = aSamplingFilter;
+ }
protected:
friend class GLContext;
void UpdateUploadSize(size_t amount);
/**
* After the ctor, the TextureImage is invalid. Implementations
@@ -221,17 +223,17 @@ protected:
}
virtual gfx::IntRect GetSrcTileRect();
gfx::IntSize mSize;
GLenum mWrapMode;
ContentType mContentType;
gfx::SurfaceFormat mTextureFormat;
- gfx::Filter mFilter;
+ gfx::SamplingFilter mSamplingFilter;
Flags mFlags;
size_t mUploadSize;
};
/**
* BasicTextureImage is the baseline TextureImage implementation ---
* it updates its texture by allocating a scratch buffer for the
* client to draw into, then using glTexSubImage2D() to upload the new
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -201,21 +201,21 @@ template <>
struct ParamTraits<gfxSurfaceType>
: public ContiguousEnumSerializer<
gfxSurfaceType,
gfxSurfaceType::Image,
gfxSurfaceType::Max>
{};
template <>
-struct ParamTraits<mozilla::gfx::Filter>
+struct ParamTraits<mozilla::gfx::SamplingFilter>
: public ContiguousEnumSerializer<
- mozilla::gfx::Filter,
- mozilla::gfx::Filter::GOOD,
- mozilla::gfx::Filter::SENTINEL>
+ mozilla::gfx::SamplingFilter,
+ mozilla::gfx::SamplingFilter::GOOD,
+ mozilla::gfx::SamplingFilter::SENTINEL>
{};
template <>
struct ParamTraits<mozilla::layers::LayersBackend>
: public ContiguousEnumSerializer<
mozilla::layers::LayersBackend,
mozilla::layers::LayersBackend::LAYERS_NONE,
mozilla::layers::LayersBackend::LAYERS_LAST>
--- a/gfx/layers/Effects.cpp
+++ b/gfx/layers/Effects.cpp
@@ -19,17 +19,17 @@ TexturedEffect::PrintInfo(std::stringstr
AppendToString(aStream, mTextureCoords, " [texture-coords=", "]");
if (mPremultiplied) {
aStream << " [premultiplied]";
} else {
aStream << " [not-premultiplied]";
}
- AppendToString(aStream, mFilter, " [filter=", "]");
+ AppendToString(aStream, mSamplingFilter, " [filter=", "]");
}
void
EffectMask::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
aStream << aPrefix;
aStream << nsPrintfCString("EffectMask (0x%p)", this).get();
AppendToString(aStream, mSize, " [size=", "]");
--- a/gfx/layers/Effects.h
+++ b/gfx/layers/Effects.h
@@ -6,17 +6,17 @@
#ifndef MOZILLA_LAYERS_EFFECTS_H
#define MOZILLA_LAYERS_EFFECTS_H
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed, etc
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/gfx/Rect.h" // for Rect
-#include "mozilla/gfx/Types.h" // for Filter, etc
+#include "mozilla/gfx/Types.h" // for SamplingFilter, etc
#include "mozilla/layers/CompositorTypes.h" // for EffectTypes, etc
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget, etc
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nscore.h" // for nsACString
#include "mozilla/EnumeratedArray.h"
#include "gfxVR.h"
@@ -54,31 +54,31 @@ protected:
};
// Render from a texture
struct TexturedEffect : public Effect
{
TexturedEffect(EffectTypes aType,
TextureSource *aTexture,
bool aPremultiplied,
- gfx::Filter aFilter)
+ gfx::SamplingFilter aSamplingFilter)
: Effect(aType)
, mTextureCoords(0, 0, 1.0f, 1.0f)
, mTexture(aTexture)
, mPremultiplied(aPremultiplied)
- , mFilter(aFilter)
+ , mSamplingFilter(aSamplingFilter)
{}
virtual const char* Name() = 0;
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
gfx::Rect mTextureCoords;
TextureSource* mTexture;
bool mPremultiplied;
- gfx::Filter mFilter;
+ gfx::SamplingFilter mSamplingFilter;
LayerRenderState mState;
};
// Support an alpha mask.
struct EffectMask : public Effect
{
EffectMask(TextureSource *aMaskTexture,
gfx::IntSize aSize,
@@ -138,28 +138,29 @@ struct EffectBlendMode : public Effect
gfx::CompositionOp mBlendMode;
};
// Render to a render target rather than the screen.
struct EffectRenderTarget : public TexturedEffect
{
explicit EffectRenderTarget(CompositingRenderTarget *aRenderTarget)
- : TexturedEffect(EffectTypes::RENDER_TARGET, aRenderTarget, true, gfx::Filter::LINEAR)
+ : TexturedEffect(EffectTypes::RENDER_TARGET, aRenderTarget, true,
+ gfx::SamplingFilter::LINEAR)
, mRenderTarget(aRenderTarget)
{}
virtual const char* Name() { return "EffectRenderTarget"; }
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
RefPtr<CompositingRenderTarget> mRenderTarget;
protected:
EffectRenderTarget(EffectTypes aType, CompositingRenderTarget *aRenderTarget)
- : TexturedEffect(aType, aRenderTarget, true, gfx::Filter::LINEAR)
+ : TexturedEffect(aType, aRenderTarget, true, gfx::SamplingFilter::LINEAR)
, mRenderTarget(aRenderTarget)
{}
};
// Render to a render target rather than the screen.
struct EffectColorMatrix : public Effect
{
@@ -173,48 +174,48 @@ struct EffectColorMatrix : public Effect
const gfx::Matrix5x4 mColorMatrix;
};
struct EffectRGB : public TexturedEffect
{
EffectRGB(TextureSource *aTexture,
bool aPremultiplied,
- gfx::Filter aFilter,
+ gfx::SamplingFilter aSamplingFilter,
bool aFlipped = false)
- : TexturedEffect(EffectTypes::RGB, aTexture, aPremultiplied, aFilter)
+ : TexturedEffect(EffectTypes::RGB, aTexture, aPremultiplied, aSamplingFilter)
{}
virtual const char* Name() { return "EffectRGB"; }
};
struct EffectYCbCr : public TexturedEffect
{
- EffectYCbCr(TextureSource *aSource, gfx::Filter aFilter)
- : TexturedEffect(EffectTypes::YCBCR, aSource, false, aFilter)
+ EffectYCbCr(TextureSource *aSource, gfx::SamplingFilter aSamplingFilter)
+ : TexturedEffect(EffectTypes::YCBCR, aSource, false, aSamplingFilter)
{}
virtual const char* Name() { return "EffectYCbCr"; }
};
struct EffectNV12 : public TexturedEffect
{
- EffectNV12(TextureSource *aSource, gfx::Filter aFilter)
- : TexturedEffect(EffectTypes::NV12, aSource, false, aFilter)
+ EffectNV12(TextureSource *aSource, gfx::SamplingFilter aSamplingFilter)
+ : TexturedEffect(EffectTypes::NV12, aSource, false, aSamplingFilter)
{}
virtual const char* Name() { return "EffectNV12"; }
};
struct EffectComponentAlpha : public TexturedEffect
{
EffectComponentAlpha(TextureSource *aOnBlack,
TextureSource *aOnWhite,
- gfx::Filter aFilter)
- : TexturedEffect(EffectTypes::COMPONENT_ALPHA, nullptr, false, aFilter)
+ gfx::SamplingFilter aSamplingFilter)
+ : TexturedEffect(EffectTypes::COMPONENT_ALPHA, nullptr, false, aSamplingFilter)
, mOnBlack(aOnBlack)
, mOnWhite(aOnWhite)
{}
virtual const char* Name() { return "EffectComponentAlpha"; }
TextureSource* mOnBlack;
TextureSource* mOnWhite;
@@ -250,35 +251,35 @@ struct EffectChain
* Note that aFormat can be different form aSource->GetFormat if, we are
* creating an effect that takes several texture sources (like with YCBCR
* where aFormat would be FOMRAT_YCBCR and each texture source would be
* a one-channel A8 texture)
*/
inline already_AddRefed<TexturedEffect>
CreateTexturedEffect(gfx::SurfaceFormat aFormat,
TextureSource* aSource,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
bool isAlphaPremultiplied,
const LayerRenderState &state = LayerRenderState())
{
MOZ_ASSERT(aSource);
RefPtr<TexturedEffect> result;
switch (aFormat) {
case gfx::SurfaceFormat::B8G8R8A8:
case gfx::SurfaceFormat::B8G8R8X8:
case gfx::SurfaceFormat::R8G8B8X8:
case gfx::SurfaceFormat::R5G6B5_UINT16:
case gfx::SurfaceFormat::R8G8B8A8:
- result = new EffectRGB(aSource, isAlphaPremultiplied, aFilter);
+ result = new EffectRGB(aSource, isAlphaPremultiplied, aSamplingFilter);
break;
case gfx::SurfaceFormat::YUV:
- result = new EffectYCbCr(aSource, aFilter);
+ result = new EffectYCbCr(aSource, aSamplingFilter);
break;
case gfx::SurfaceFormat::NV12:
- result = new EffectNV12(aSource, aFilter);
+ result = new EffectNV12(aSource, aSamplingFilter);
break;
default:
NS_WARNING("unhandled program type");
break;
}
result->mState = state;
@@ -289,45 +290,46 @@ CreateTexturedEffect(gfx::SurfaceFormat
* Create a textured effect based on aSource format and the presence of
* aSourceOnWhite.
*
* aSourceOnWhite can be null.
*/
inline already_AddRefed<TexturedEffect>
CreateTexturedEffect(TextureSource* aSource,
TextureSource* aSourceOnWhite,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
bool isAlphaPremultiplied,
const LayerRenderState &state = LayerRenderState())
{
MOZ_ASSERT(aSource);
if (aSourceOnWhite) {
MOZ_ASSERT(aSource->GetFormat() == gfx::SurfaceFormat::R8G8B8X8 ||
aSource->GetFormat() == gfx::SurfaceFormat::B8G8R8X8);
MOZ_ASSERT(aSource->GetFormat() == aSourceOnWhite->GetFormat());
- return MakeAndAddRef<EffectComponentAlpha>(aSource, aSourceOnWhite, aFilter);
+ return MakeAndAddRef<EffectComponentAlpha>(aSource, aSourceOnWhite,
+ aSamplingFilter);
}
return CreateTexturedEffect(aSource->GetFormat(),
aSource,
- aFilter,
+ aSamplingFilter,
isAlphaPremultiplied,
state);
}
/**
* Create a textured effect based on aSource format.
*
* This version excudes the possibility of component alpha.
*/
inline already_AddRefed<TexturedEffect>
CreateTexturedEffect(TextureSource *aTexture,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const LayerRenderState &state = LayerRenderState())
{
- return CreateTexturedEffect(aTexture, nullptr, aFilter, true, state);
+ return CreateTexturedEffect(aTexture, nullptr, aSamplingFilter, true, state);
}
} // namespace layers
} // namespace mozilla
#endif
--- a/gfx/layers/ImageLayers.cpp
+++ b/gfx/layers/ImageLayers.cpp
@@ -9,17 +9,17 @@
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for ImageContainer::Release, etc
#include "gfx2DGlue.h"
namespace mozilla {
namespace layers {
ImageLayer::ImageLayer(LayerManager* aManager, void* aImplData)
-: Layer(aManager, aImplData), mFilter(gfx::Filter::GOOD)
+: Layer(aManager, aImplData), mSamplingFilter(gfx::SamplingFilter::GOOD)
, mScaleMode(ScaleMode::SCALE_NONE), mDisallowBigImage(false)
{}
ImageLayer::~ImageLayer()
{}
void ImageLayer::SetContainer(ImageContainer* aContainer)
{
--- a/gfx/layers/ImageLayers.h
+++ b/gfx/layers/ImageLayers.h
@@ -33,21 +33,21 @@ public:
* as this layer.
*/
virtual void SetContainer(ImageContainer* aContainer);
/**
* CONSTRUCTION PHASE ONLY
* Set the filter used to resample this image if necessary.
*/
- void SetFilter(gfx::Filter aFilter)
+ void SetSamplingFilter(gfx::SamplingFilter aSamplingFilter)
{
- if (mFilter != aFilter) {
+ if (mSamplingFilter != aSamplingFilter) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Filter", this));
- mFilter = aFilter;
+ mSamplingFilter = aSamplingFilter;
Mutated();
}
}
/**
* CONSTRUCTION PHASE ONLY
* Set the size to scale the image to and the mode at which to scale.
*/
@@ -57,17 +57,17 @@ public:
mScaleToSize = aSize;
mScaleMode = aMode;
Mutated();
}
}
ImageContainer* GetContainer() { return mContainer; }
- gfx::Filter GetFilter() { return mFilter; }
+ gfx::SamplingFilter GetSamplingFilter() { return mSamplingFilter; }
const gfx::IntSize& GetScaleToSize() { return mScaleToSize; }
ScaleMode GetScaleMode() { return mScaleMode; }
MOZ_LAYER_DECL_NAME("ImageLayer", TYPE_IMAGE)
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override;
virtual const gfx::Matrix4x4& GetEffectiveTransformForBuffer() const override
@@ -89,17 +89,17 @@ public:
protected:
ImageLayer(LayerManager* aManager, void* aImplData);
~ImageLayer();
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) override;
RefPtr<ImageContainer> mContainer;
- gfx::Filter mFilter;
+ gfx::SamplingFilter mSamplingFilter;
gfx::IntSize mScaleToSize;
ScaleMode mScaleMode;
bool mDisallowBigImage;
gfx::Matrix4x4 mEffectiveTransformForBuffer;
};
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -375,30 +375,31 @@ template<typename T>
static void DumpRect(T* aPacketRect, const Rect& aRect)
{
aPacketRect->set_x(aRect.x);
aPacketRect->set_y(aRect.y);
aPacketRect->set_w(aRect.width);
aPacketRect->set_h(aRect.height);
}
-static void DumpFilter(TexturePacket* aTexturePacket, const Filter& aFilter)
+static void DumpFilter(TexturePacket* aTexturePacket,
+ const SamplingFilter aSamplingFilter)
{
- switch (aFilter) {
- case Filter::GOOD:
+ switch (aSamplingFilter) {
+ case SamplingFilter::GOOD:
aTexturePacket->set_mfilter(TexturePacket::GOOD);
break;
- case Filter::LINEAR:
+ case SamplingFilter::LINEAR:
aTexturePacket->set_mfilter(TexturePacket::LINEAR);
break;
- case Filter::POINT:
+ case SamplingFilter::POINT:
aTexturePacket->set_mfilter(TexturePacket::POINT);
break;
default:
- MOZ_ASSERT(false, "Can't dump unexpected mFilter to texture packet!");
+ MOZ_ASSERT(false, "Can't dump unexpected mSamplingFilter to texture packet!");
break;
}
}
/*
* DebugGLData is the base class of
* 1. DebugGLFrameStatusData (Frame start/end packet)
* 2. DebugGLColorData (Color data packet)
@@ -1049,17 +1050,17 @@ SenderHelper::SendColor(void* aLayerRef,
gLayerScopeManager.GetSocketManager()->AppendDebugData(
new DebugGLColorData(aLayerRef, aColor, aWidth, aHeight));
}
GLuint
SenderHelper::GetTextureID(GLContext* aGLContext,
TextureSourceOGL* aSource) {
GLenum textureTarget = aSource->GetTextureTarget();
- aSource->BindTexture(LOCAL_GL_TEXTURE0, gfx::Filter::LINEAR);
+ aSource->BindTexture(LOCAL_GL_TEXTURE0, gfx::SamplingFilter::LINEAR);
GLuint texID = 0;
// This is horrid hack. It assumes that aGLContext matches the context
// aSource has bound to.
if (textureTarget == LOCAL_GL_TEXTURE_2D) {
aGLContext->GetUIntegerv(LOCAL_GL_TEXTURE_BINDING_2D, &texID);
} else if (textureTarget == LOCAL_GL_TEXTURE_EXTERNAL) {
aGLContext->GetUIntegerv(LOCAL_GL_TEXTURE_BINDING_EXTERNAL, &texID);
@@ -1159,17 +1160,17 @@ SenderHelper::SetAndSendTexture(GLContex
void* aLayerRef,
TextureSourceOGL* aSource,
const TexturedEffect* aEffect)
{
// Expose packet creation here, so we could dump primary texture effect attributes.
auto packet = MakeUnique<layerscope::Packet>();
layerscope::TexturePacket* texturePacket = packet->mutable_texture();
texturePacket->set_mpremultiplied(aEffect->mPremultiplied);
- DumpFilter(texturePacket, aEffect->mFilter);
+ DumpFilter(texturePacket, aEffect->mSamplingFilter);
DumpRect(texturePacket->mutable_mtexturecoords(), aEffect->mTextureCoords);
SendTextureSource(aGLContext, aLayerRef, aSource, false, false, Move(packet));
}
void
SenderHelper::SendTexturedEffect(GLContext* aGLContext,
void* aLayerRef,
const TexturedEffect* aEffect)
--- a/gfx/layers/LayerTreeInvalidation.cpp
+++ b/gfx/layers/LayerTreeInvalidation.cpp
@@ -453,17 +453,17 @@ static ImageHost* GetImageHost(Layer* aL
}
struct ImageLayerProperties : public LayerPropertiesBase
{
explicit ImageLayerProperties(ImageLayer* aImage, bool aIsMask)
: LayerPropertiesBase(aImage)
, mContainer(aImage->GetContainer())
, mImageHost(GetImageHost(aImage))
- , mFilter(aImage->GetFilter())
+ , mSamplingFilter(aImage->GetSamplingFilter())
, mScaleToSize(aImage->GetScaleToSize())
, mScaleMode(aImage->GetScaleMode())
, mLastProducerID(-1)
, mLastFrameID(-1)
, mIsMask(aIsMask)
{
if (mImageHost) {
mLastProducerID = mImageHost->GetLastProducerID();
@@ -481,17 +481,17 @@ struct ImageLayerProperties : public Lay
IntRect result = NewTransformedBounds();
result = result.Union(OldTransformedBounds());
return result;
}
ImageContainer* container = imageLayer->GetContainer();
ImageHost* host = GetImageHost(imageLayer);
if (mContainer != container ||
- mFilter != imageLayer->GetFilter() ||
+ mSamplingFilter != imageLayer->GetSamplingFilter() ||
mScaleToSize != imageLayer->GetScaleToSize() ||
mScaleMode != imageLayer->GetScaleMode() ||
host != mImageHost ||
(host && host->GetProducerID() != mLastProducerID) ||
(host && host->GetFrameID() != mLastFrameID)) {
aGeometryChanged = true;
if (mIsMask) {
@@ -510,17 +510,17 @@ struct ImageLayerProperties : public Lay
return NewTransformedBounds();
}
return IntRect();
}
RefPtr<ImageContainer> mContainer;
RefPtr<ImageHost> mImageHost;
- Filter mFilter;
+ SamplingFilter mSamplingFilter;
gfx::IntSize mScaleToSize;
ScaleMode mScaleMode;
int32_t mLastProducerID;
int32_t mLastFrameID;
bool mIsMask;
};
struct CanvasLayerProperties : public LayerPropertiesBase
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -2231,83 +2231,84 @@ ColorLayer::DumpPacket(layerscope::Layer
}
CanvasLayer::CanvasLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData)
, mPreTransCallback(nullptr)
, mPreTransCallbackData(nullptr)
, mPostTransCallback(nullptr)
, mPostTransCallbackData(nullptr)
- , mFilter(gfx::Filter::GOOD)
+ , mSamplingFilter(gfx::SamplingFilter::GOOD)
, mDirty(false)
{}
CanvasLayer::~CanvasLayer()
{}
void
CanvasLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
Layer::PrintInfo(aStream, aPrefix);
- if (mFilter != Filter::GOOD) {
- AppendToString(aStream, mFilter, " [filter=", "]");
+ if (mSamplingFilter != SamplingFilter::GOOD) {
+ AppendToString(aStream, mSamplingFilter, " [filter=", "]");
}
}
// This help function is used to assign the correct enum value
// to the packet
static void
-DumpFilter(layerscope::LayersPacket::Layer* aLayer, const Filter& aFilter)
+DumpFilter(layerscope::LayersPacket::Layer* aLayer,
+ const SamplingFilter& aSamplingFilter)
{
using namespace layerscope;
- switch (aFilter) {
- case Filter::GOOD:
+ switch (aSamplingFilter) {
+ case SamplingFilter::GOOD:
aLayer->set_filter(LayersPacket::Layer::FILTER_GOOD);
break;
- case Filter::LINEAR:
+ case SamplingFilter::LINEAR:
aLayer->set_filter(LayersPacket::Layer::FILTER_LINEAR);
break;
- case Filter::POINT:
+ case SamplingFilter::POINT:
aLayer->set_filter(LayersPacket::Layer::FILTER_POINT);
break;
default:
// ignore it
break;
}
}
void
CanvasLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
{
Layer::DumpPacket(aPacket, aParent);
// Get this layer data
using namespace layerscope;
LayersPacket::Layer* layer = aPacket->mutable_layer(aPacket->layer_size()-1);
layer->set_type(LayersPacket::Layer::CanvasLayer);
- DumpFilter(layer, mFilter);
+ DumpFilter(layer, mSamplingFilter);
}
void
ImageLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
Layer::PrintInfo(aStream, aPrefix);
- if (mFilter != Filter::GOOD) {
- AppendToString(aStream, mFilter, " [filter=", "]");
+ if (mSamplingFilter != SamplingFilter::GOOD) {
+ AppendToString(aStream, mSamplingFilter, " [filter=", "]");
}
}
void
ImageLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
{
Layer::DumpPacket(aPacket, aParent);
// Get this layer data
using namespace layerscope;
LayersPacket::Layer* layer = aPacket->mutable_layer(aPacket->layer_size()-1);
layer->set_type(LayersPacket::Layer::ImageLayer);
- DumpFilter(layer, mFilter);
+ DumpFilter(layer, mSamplingFilter);
}
void
RefLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
ContainerLayer::PrintInfo(aStream, aPrefix);
if (0 != mId) {
AppendToString(aStream, mId, " [id=", "]");
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -2466,25 +2466,25 @@ public:
mPostTransCallback = aCallback;
mPostTransCallbackData = aClosureData;
}
/**
* CONSTRUCTION PHASE ONLY
* Set the filter used to resample this image (if necessary).
*/
- void SetFilter(gfx::Filter aFilter)
+ void SetSamplingFilter(gfx::SamplingFilter aSamplingFilter)
{
- if (mFilter != aFilter) {
+ if (mSamplingFilter != aSamplingFilter) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) Filter", this));
- mFilter = aFilter;
+ mSamplingFilter = aSamplingFilter;
Mutated();
}
}
- gfx::Filter GetFilter() const { return mFilter; }
+ gfx::SamplingFilter GetSamplingFilter() const { return mSamplingFilter; }
MOZ_LAYER_DECL_NAME("CanvasLayer", TYPE_CANVAS)
virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
{
// Snap our local transform first, and snap the inherited transform as well.
// This makes our snapping equivalent to what would happen if our content
// was drawn into a PaintedLayer (gfxContext would snap using the local
@@ -2519,17 +2519,17 @@ protected:
/**
* 0, 0, canvaswidth, canvasheight
*/
gfx::IntRect mBounds;
PreTransactionCallback* mPreTransCallback;
void* mPreTransCallbackData;
DidTransactionCallback mPostTransCallback;
void* mPostTransCallbackData;
- gfx::Filter mFilter;
+ gfx::SamplingFilter mSamplingFilter;
RefPtr<AsyncCanvasRenderer> mAsyncRenderer;
private:
/**
* Set to true in Updated(), cleared during a transaction.
*/
bool mDirty;
};
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -243,27 +243,27 @@ AppendToString(std::stringstream& aStrea
m._21, m._22, m._23, m._24,
m._31, m._32, m._33, m._34,
m._41, m._42, m._43, m._44,
m._51, m._52, m._53, m._54).get();
aStream << sfx;
}
void
-AppendToString(std::stringstream& aStream, const Filter filter,
+AppendToString(std::stringstream& aStream, const SamplingFilter filter,
const char* pfx, const char* sfx)
{
aStream << pfx;
switch (filter) {
- case Filter::GOOD: aStream << "Filter::GOOD"; break;
- case Filter::LINEAR: aStream << "Filter::LINEAR"; break;
- case Filter::POINT: aStream << "Filter::POINT"; break;
+ case SamplingFilter::GOOD: aStream << "SamplingFilter::GOOD"; break;
+ case SamplingFilter::LINEAR: aStream << "SamplingFilter::LINEAR"; break;
+ case SamplingFilter::POINT: aStream << "SamplingFilter::POINT"; break;
default:
- NS_ERROR("unknown filter type");
+ NS_ERROR("unknown SamplingFilter type");
aStream << "???";
}
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, TextureFlags flags,
const char* pfx, const char* sfx)
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -4,17 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GFX_LAYERSLOGGING_H
#define GFX_LAYERSLOGGING_H
#include "FrameMetrics.h" // for FrameMetrics, etc
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for IntSize, etc
-#include "mozilla/gfx/Types.h" // for Filter, SurfaceFormat
+#include "mozilla/gfx/Types.h" // for SamplingFilter, SurfaceFormat
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags
#include "nsAString.h"
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsRegion.h" // for nsRegion, nsIntRegion
#include "nscore.h" // for nsACString, etc
namespace mozilla {
namespace gfx {
@@ -207,17 +207,18 @@ AppendToString(std::stringstream& aStrea
aStream << sfx;
}
void
AppendToString(std::stringstream& aStream, const mozilla::gfx::Matrix5x4& m,
const char* pfx="", const char* sfx="");
void
-AppendToString(std::stringstream& aStream, const mozilla::gfx::Filter filter,
+AppendToString(std::stringstream& aStream,
+ const mozilla::gfx::SamplingFilter samplingFilter,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, mozilla::layers::TextureFlags flags,
const char* pfx="", const char* sfx="");
void
AppendToString(std::stringstream& aStream, mozilla::gfx::SurfaceFormat format,
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -135,27 +135,27 @@ RotatedBuffer::DrawBufferQuadrant(gfx::D
Matrix inverseMask = *aMaskTransform;
inverseMask.Invert();
transform *= oldTransform;
transform *= inverseMask;
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
- SurfacePattern source(snapshot, ExtendMode::CLAMP, transform, Filter::POINT);
+ SurfacePattern source(snapshot, ExtendMode::CLAMP, transform, SamplingFilter::POINT);
#else
SurfacePattern source(snapshot, ExtendMode::CLAMP, transform);
#endif
aTarget->SetTransform(*aMaskTransform);
aTarget->MaskSurface(source, aMask, Point(0, 0), DrawOptions(aOpacity, aOperator));
aTarget->SetTransform(oldTransform);
} else {
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
- DrawSurfaceOptions options(Filter::POINT);
+ DrawSurfaceOptions options(SamplingFilter::POINT);
#else
DrawSurfaceOptions options;
#endif
aTarget->DrawSurface(snapshot, IntRectToRect(fillRect),
GetSourceRectangle(aXSide, aYSide),
options,
DrawOptions(aOpacity, aOperator));
}
--- a/gfx/layers/basic/BasicCanvasLayer.cpp
+++ b/gfx/layers/basic/BasicCanvasLayer.cpp
@@ -48,17 +48,17 @@ BasicCanvasLayer::Paint(DrawTarget* aDT,
oldTM = aDT->GetTransform();
aDT->SetTransform(Matrix(oldTM).
PreTranslate(0.0f, mBounds.height).
PreScale(1.0f, -1.0f));
}
FillRectWithMask(aDT, aDeviceOffset,
Rect(0, 0, mBounds.width, mBounds.height),
- mSurface, mFilter,
+ mSurface, mSamplingFilter,
DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
aMaskLayer);
if (needsYFlip) {
aDT->SetTransform(oldTM);
}
}
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -221,17 +221,17 @@ BasicCompositor::SupportsEffect(EffectTy
return aEffect != EffectTypes::YCBCR && aEffect != EffectTypes::COMPONENT_ALPHA;
}
static void
DrawSurfaceWithTextureCoords(DrawTarget *aDest,
const gfx::Rect& aDestRect,
SourceSurface *aSource,
const gfx::Rect& aTextureCoords,
- gfx::Filter aFilter,
+ gfx::SamplingFilter aSamplingFilter,
const DrawOptions& aOptions,
SourceSurface *aMask,
const Matrix* aMaskTransform)
{
if (!aSource) {
gfxWarning() << "DrawSurfaceWithTextureCoords problem " << gfx::hexa(aSource) << " and " << gfx::hexa(aMask);
return;
}
@@ -252,17 +252,17 @@ DrawSurfaceWithTextureCoords(DrawTarget
gfx::IntPoint(aDestRect.x, aDestRect.y),
gfx::IntPoint(aDestRect.XMost(), aDestRect.y),
gfx::IntPoint(aDestRect.XMost(), aDestRect.YMost()));
// Only use REPEAT if aTextureCoords is outside (0, 0, 1, 1).
gfx::Rect unitRect(0, 0, 1, 1);
ExtendMode mode = unitRect.Contains(aTextureCoords) ? ExtendMode::CLAMP : ExtendMode::REPEAT;
- FillRectWithMask(aDest, aDestRect, aSource, aFilter, aOptions,
+ FillRectWithMask(aDest, aDestRect, aSource, aSamplingFilter, aOptions,
mode, aMask, aMaskTransform, &matrix);
}
static void
SetupMask(const EffectChain& aEffectChain,
DrawTarget* aDest,
const IntPoint& aOffset,
RefPtr<SourceSurface>& aMaskSurface,
@@ -437,33 +437,33 @@ BasicCompositor::DrawQuad(const gfx::Rec
texturedEffect,
newTransform, aRect, aClipRect - offset,
dest, buffer)) {
// we succeeded in scaling
} else {
DrawSurfaceWithTextureCoords(dest, aRect,
source->GetSurface(dest),
texturedEffect->mTextureCoords,
- texturedEffect->mFilter,
+ texturedEffect->mSamplingFilter,
DrawOptions(aOpacity, blendMode),
sourceMask, &maskTransform);
}
} else if (source) {
SourceSurface* srcSurf = source->GetSurface(dest);
if (srcSurf) {
RefPtr<DataSourceSurface> srcData = srcSurf->GetDataSurface();
// Yes, we re-create the premultiplied data every time.
// This might be better with a cache, eventually.
RefPtr<DataSourceSurface> premultData = gfxUtils::CreatePremultipliedDataSurface(srcData);
DrawSurfaceWithTextureCoords(dest, aRect,
premultData,
texturedEffect->mTextureCoords,
- texturedEffect->mFilter,
+ texturedEffect->mSamplingFilter,
DrawOptions(aOpacity, blendMode),
sourceMask, &maskTransform);
}
} else {
gfxDevCrash(LogReason::IncompatibleBasicTexturedEffect) << "Bad for basic with " << texturedEffect->mTexture->Name() << " and " << gfx::hexa(sourceMask);
}
break;
@@ -477,17 +477,17 @@ BasicCompositor::DrawQuad(const gfx::Rec
static_cast<EffectRenderTarget*>(aEffectChain.mPrimaryEffect.get());
RefPtr<BasicCompositingRenderTarget> surface
= static_cast<BasicCompositingRenderTarget*>(effectRenderTarget->mRenderTarget.get());
RefPtr<SourceSurface> sourceSurf = surface->mDrawTarget->Snapshot();
DrawSurfaceWithTextureCoords(dest, aRect,
sourceSurf,
effectRenderTarget->mTextureCoords,
- effectRenderTarget->mFilter,
+ effectRenderTarget->mSamplingFilter,
DrawOptions(aOpacity, blendMode),
sourceMask, &maskTransform);
break;
}
case EffectTypes::COMPONENT_ALPHA: {
NS_RUNTIMEABORT("Can't (easily) support component alpha with BasicCompositor!");
break;
}
--- a/gfx/layers/basic/BasicImageLayer.cpp
+++ b/gfx/layers/basic/BasicImageLayer.cpp
@@ -81,17 +81,17 @@ BasicImageLayer::Paint(DrawTarget* aDT,
RefPtr<gfx::SourceSurface> surface = image->GetAsSourceSurface();
if (!surface || !surface->IsValid()) {
mContainer->SetImageFactory(originalIF);
return;
}
gfx::IntSize size = mSize = surface->GetSize();
FillRectWithMask(aDT, aDeviceOffset, Rect(0, 0, size.width, size.height),
- surface, mFilter,
+ surface, mSamplingFilter,
DrawOptions(GetEffectiveOpacity(), GetEffectiveOperator(this)),
aMaskLayer);
mContainer->SetImageFactory(originalIF);
}
already_AddRefed<SourceSurface>
BasicImageLayer::GetAsSourceSurface()
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -192,17 +192,17 @@ BasicLayerManager::PopGroupForLayer(Push
group.mMaskSurface, Point(0, 0), DrawOptions(group.mOpacity, group.mOperator));
} else {
// For now this is required since our group offset is in device space of the final target,
// context but that may still have its own device offset. Once PushGroup/PopGroup logic is
// migrated to DrawTargets this can go as gfxContext::GetDeviceOffset will essentially
// always become null.
dt->SetTransform(Matrix::Translation(-group.mFinalTarget->GetDeviceOffset()));
dt->DrawSurface(src, Rect(group.mGroupOffset.x, group.mGroupOffset.y, src->GetSize().width, src->GetSize().height),
- Rect(0, 0, src->GetSize().width, src->GetSize().height), DrawSurfaceOptions(Filter::POINT), DrawOptions(group.mOpacity, group.mOperator));
+ Rect(0, 0, src->GetSize().width, src->GetSize().height), DrawSurfaceOptions(SamplingFilter::POINT), DrawOptions(group.mOpacity, group.mOperator));
}
if (group.mNeedsClipToVisibleRegion) {
dt->PopClip();
}
group.mFinalTarget->Restore();
}
--- a/gfx/layers/basic/BasicLayersImpl.cpp
+++ b/gfx/layers/basic/BasicLayersImpl.cpp
@@ -110,17 +110,17 @@ FillRectWithMask(DrawTarget* aDT,
FillRectWithMask(aDT, aRect, aColor, aOptions);
}
void
FillRectWithMask(DrawTarget* aDT,
const Rect& aRect,
SourceSurface* aSurface,
- Filter aFilter,
+ SamplingFilter aSamplingFilter,
const DrawOptions& aOptions,
ExtendMode aExtendMode,
SourceSurface* aMaskSource,
const Matrix* aMaskTransform,
const Matrix* aSurfaceTransform)
{
if (aMaskSource && aMaskTransform) {
aDT->PushClipRect(aRect);
@@ -129,49 +129,51 @@ FillRectWithMask(DrawTarget* aDT,
Matrix inverseMask = *aMaskTransform;
inverseMask.Invert();
Matrix transform = oldTransform * inverseMask;
if (aSurfaceTransform) {
transform = (*aSurfaceTransform) * transform;
}
- SurfacePattern source(aSurface, aExtendMode, transform, aFilter);
+ SurfacePattern source(aSurface, aExtendMode, transform, aSamplingFilter);
aDT->SetTransform(*aMaskTransform);
aDT->MaskSurface(source, aMaskSource, Point(0, 0), aOptions);
aDT->SetTransform(oldTransform);
aDT->PopClip();
return;
}
aDT->FillRect(aRect,
SurfacePattern(aSurface, aExtendMode,
aSurfaceTransform ? (*aSurfaceTransform) : Matrix(),
- aFilter), aOptions);
+ aSamplingFilter), aOptions);
}
void
FillRectWithMask(DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
const Rect& aRect,
SourceSurface* aSurface,
- Filter aFilter,
+ SamplingFilter aSamplingFilter,
const DrawOptions& aOptions,
Layer* aMaskLayer)
{
AutoMoz2DMaskData mask;
if (GetMaskData(aMaskLayer, aDeviceOffset, &mask)) {
const Matrix& maskTransform = mask.GetTransform();
- FillRectWithMask(aDT, aRect, aSurface, aFilter, aOptions, ExtendMode::CLAMP,
+ FillRectWithMask(aDT, aRect, aSurface, aSamplingFilter, aOptions,
+ ExtendMode::CLAMP,
mask.GetSurface(), &maskTransform);
return;
}
- FillRectWithMask(aDT, aRect, aSurface, aFilter, aOptions, ExtendMode::CLAMP);
+ FillRectWithMask(aDT, aRect, aSurface, aSamplingFilter, aOptions,
+ ExtendMode::CLAMP);
}
BasicImplData*
ToData(Layer* aLayer)
{
return static_cast<BasicImplData*>(aLayer->ImplData());
}
--- a/gfx/layers/basic/BasicLayersImpl.h
+++ b/gfx/layers/basic/BasicLayersImpl.h
@@ -101,28 +101,28 @@ FillRectWithMask(gfx::DrawTarget* aDT,
const gfx::Color& aColor,
const gfx::DrawOptions& aOptions,
gfx::SourceSurface* aMaskSource = nullptr,
const gfx::Matrix* aMaskTransform = nullptr);
void
FillRectWithMask(gfx::DrawTarget* aDT,
const gfx::Rect& aRect,
gfx::SourceSurface* aSurface,
- gfx::Filter aFilter,
+ gfx::SamplingFilter aSamplingFilter,
const gfx::DrawOptions& aOptions,
gfx::ExtendMode aExtendMode,
gfx::SourceSurface* aMaskSource = nullptr,
const gfx::Matrix* aMaskTransform = nullptr,
const gfx::Matrix* aSurfaceTransform = nullptr);
void
FillRectWithMask(gfx::DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
const gfx::Rect& aRect,
gfx::SourceSurface* aSurface,
- gfx::Filter aFilter,
+ gfx::SamplingFilter aSamplingFilter,
const gfx::DrawOptions& aOptions,
Layer* aMaskLayer);
void
FillRectWithMask(gfx::DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
const gfx::Rect& aRect,
const gfx::Color& aColor,
const gfx::DrawOptions& aOptions,
--- a/gfx/layers/client/ClientCanvasLayer.h
+++ b/gfx/layers/client/ClientCanvasLayer.h
@@ -66,17 +66,17 @@ public:
{
if (mCanvasClient) {
mCanvasClient->HandleMemoryPressure();
}
}
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override
{
- aAttrs = CanvasLayerAttributes(mFilter, mBounds);
+ aAttrs = CanvasLayerAttributes(mSamplingFilter, mBounds);
}
virtual Layer* AsLayer() override { return this; }
virtual ShadowableLayer* AsShadowableLayer() override { return this; }
virtual void Disconnect() override
{
mCanvasClient = nullptr;
--- a/gfx/layers/client/ClientImageLayer.cpp
+++ b/gfx/layers/client/ClientImageLayer.cpp
@@ -64,17 +64,17 @@ protected:
{
if (mImageClient) {
mImageClient->HandleMemoryPressure();
}
}
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) override
{
- aAttrs = ImageLayerAttributes(mFilter, mScaleToSize, mScaleMode);
+ aAttrs = ImageLayerAttributes(mSamplingFilter, mScaleToSize, mScaleMode);
}
virtual Layer* AsLayer() override { return this; }
virtual ShadowableLayer* AsShadowableLayer() override { return this; }
virtual void Disconnect() override
{
DestroyBackBuffer();
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -94,17 +94,17 @@ CanvasLayerComposite::RenderLayer(const
}
#endif
RenderWithAllMasks(this, mCompositor, aClipRect,
[&](EffectChain& effectChain, const IntRect& clipRect) {
mCompositableHost->Composite(this, effectChain,
GetEffectiveOpacity(),
GetEffectiveTransform(),
- GetEffectFilter(),
+ GetSamplingFilter(),
clipRect);
});
mCompositableHost->BumpFlashCounter();
}
CompositableHost*
CanvasLayerComposite::GetCompositableHost()
@@ -120,38 +120,38 @@ void
CanvasLayerComposite::CleanupResources()
{
if (mCompositableHost) {
mCompositableHost->Detach(this);
}
mCompositableHost = nullptr;
}
-gfx::Filter
-CanvasLayerComposite::GetEffectFilter()
+gfx::SamplingFilter
+CanvasLayerComposite::GetSamplingFilter()
{
- gfx::Filter filter = mFilter;
+ gfx::SamplingFilter filter = mSamplingFilter;
#ifdef ANDROID
// Bug 691354
// Using the LINEAR filter we get unexplained artifacts.
// Use NEAREST when no scaling is required.
Matrix matrix;
bool is2D = GetEffectiveTransform().Is2D(&matrix);
if (is2D && !ThebesMatrix(matrix).HasNonTranslationOrFlip()) {
- filter = Filter::POINT;
+ filter = SamplingFilter::POINT;
}
#endif
return filter;
}
void
CanvasLayerComposite::GenEffectChain(EffectChain& aEffect)
{
aEffect.mLayerRef = this;
- aEffect.mPrimaryEffect = mCompositableHost->GenEffect(GetEffectFilter());
+ aEffect.mPrimaryEffect = mCompositableHost->GenEffect(GetSamplingFilter());
}
void
CanvasLayerComposite::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
CanvasLayer::PrintInfo(aStream, aPrefix);
aStream << "\n";
if (mCompositableHost && mCompositableHost->IsAttached()) {
--- a/gfx/layers/composite/CanvasLayerComposite.h
+++ b/gfx/layers/composite/CanvasLayerComposite.h
@@ -64,17 +64,17 @@ public:
void SetBounds(gfx::IntRect aBounds) { mBounds = aBounds; }
virtual const char* Name() const override { return "CanvasLayerComposite"; }
protected:
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
private:
- gfx::Filter GetEffectFilter();
+ gfx::SamplingFilter GetSamplingFilter();
private:
RefPtr<CompositableHost> mCompositableHost;
};
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -10,17 +10,17 @@
#include <stdio.h> // for FILE
#include "gfxRect.h" // for gfxRect
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Attributes.h" // for override
#include "mozilla/RefPtr.h" // for RefPtr, RefCounted, etc
#include "mozilla/gfx/MatrixFwd.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for Point
#include "mozilla/gfx/Rect.h" // for Rect
-#include "mozilla/gfx/Types.h" // for Filter
+#include "mozilla/gfx/Types.h" // for SamplingFilter
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc
#include "mozilla/layers/Effects.h" // for Texture Effect
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
#include "mozilla/layers/LayersMessages.h"
#include "mozilla/layers/TextureHost.h" // for TextureHost
#include "mozilla/mozalloc.h" // for operator delete
@@ -76,17 +76,17 @@ public:
// If base class overrides, it should still call the parent implementation
virtual void SetCompositor(Compositor* aCompositor);
// composite the contents of this buffer host to the compositor's surface
virtual void Composite(LayerComposite* aLayer,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion* aVisibleRegion = nullptr) = 0;
/**
* Update the content host.
* aUpdated is the region which should be updated
* aUpdatedRegionBack is the region in aNewBackResult which has been updated
*/
@@ -226,17 +226,17 @@ public:
void SetCompositorID(uint64_t aID) { mCompositorID = aID; }
void SetAsyncID(uint64_t aID) { mAsyncID = aID; }
virtual bool Lock() { return false; }
virtual void Unlock() { }
- virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::Filter& aFilter) {
+ virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) {
return nullptr;
}
virtual int32_t GetLastInputFrameID() const { return -1; }
/// Called when shutting down the layer tree.
/// This is a good place to clear all potential gpu resources before the widget
/// is is destroyed.
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -31,17 +31,17 @@ ContentHostBase::~ContentHostBase()
{
}
void
ContentHostTexture::Composite(LayerComposite* aLayer,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const Filter& aFilter,
+ const SamplingFilter aSamplingFilter,
const IntRect& aClipRect,
const nsIntRegion* aVisibleRegion)
{
NS_ASSERTION(aVisibleRegion, "Requires a visible region");
AutoLockCompositableHost lock(this);
if (lock.Failed()) {
return;
@@ -56,17 +56,17 @@ ContentHostTexture::Composite(LayerCompo
mTextureSourceOnWhite = nullptr;
}
if (mTextureHostOnWhite && !mTextureHostOnWhite->BindTextureSource(mTextureSourceOnWhite)) {
return;
}
RefPtr<TexturedEffect> effect = CreateTexturedEffect(mTextureSource.get(),
mTextureSourceOnWhite.get(),
- aFilter, true,
+ aSamplingFilter, true,
GetRenderState());
if (!effect) {
return;
}
aEffectChain.mPrimaryEffect = effect;
nsIntRegion tmpRegion;
@@ -451,33 +451,33 @@ ContentHostTexture::GetRenderState()
if (mBufferRotation != nsIntPoint()) {
result.mFlags |= LayerRenderStateFlags::BUFFER_ROTATION;
}
result.SetOffset(GetOriginOffset());
return result;
}
already_AddRefed<TexturedEffect>
-ContentHostTexture::GenEffect(const gfx::Filter& aFilter)
+ContentHostTexture::GenEffect(const gfx::SamplingFilter aSamplingFilter)
{
if (!mTextureHost) {
return nullptr;
}
if (!mTextureHost->BindTextureSource(mTextureSource)) {
return nullptr;
}
if (!mTextureHostOnWhite) {
mTextureSourceOnWhite = nullptr;
}
if (mTextureHostOnWhite && !mTextureHostOnWhite->BindTextureSource(mTextureSourceOnWhite)) {
return nullptr;
}
return CreateTexturedEffect(mTextureSource.get(),
mTextureSourceOnWhite.get(),
- aFilter, true,
+ aSamplingFilter, true,
GetRenderState());
}
already_AddRefed<gfx::DataSourceSurface>
ContentHostTexture::GetAsSurface()
{
if (!mTextureHost) {
return nullptr;
--- a/gfx/layers/composite/ContentHost.h
+++ b/gfx/layers/composite/ContentHost.h
@@ -12,17 +12,17 @@
#include "CompositableHost.h" // for CompositableHost, etc
#include "RotatedBuffer.h" // for RotatedContentBuffer, etc
#include "mozilla/Attributes.h" // for override
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/gfx/BasePoint.h" // for BasePoint
#include "mozilla/gfx/MatrixFwd.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for Point
#include "mozilla/gfx/Rect.h" // for Rect
-#include "mozilla/gfx/Types.h" // for Filter
+#include "mozilla/gfx/Types.h" // for SamplingFilter
#include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc
#include "mozilla/layers/ISurfaceAllocator.h" // for ISurfaceAllocator
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
#include "mozilla/layers/LayersTypes.h" // for etc
#include "mozilla/layers/TextureHost.h" // for TextureHost
#include "mozilla/mozalloc.h" // for operator delete
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "nsCOMPtr.h" // for already_AddRefed
@@ -116,17 +116,17 @@ public:
, mLocked(false)
, mReceivedNewHost(false)
{ }
virtual void Composite(LayerComposite* aLayer,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion* aVisibleRegion = nullptr) override;
virtual void SetCompositor(Compositor* aCompositor) override;
virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
virtual void Dump(std::stringstream& aStream,
@@ -161,17 +161,17 @@ public:
if (mTextureHostOnWhite) {
mTextureHostOnWhite->Unlock();
}
mLocked = false;
}
LayerRenderState GetRenderState() override;
- virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::Filter& aFilter) override;
+ virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) override;
protected:
CompositableTextureHostRef mTextureHost;
CompositableTextureHostRef mTextureHostOnWhite;
CompositableTextureSourceRef mTextureSource;
CompositableTextureSourceRef mTextureSourceOnWhite;
bool mLocked;
bool mReceivedNewHost;
--- a/gfx/layers/composite/FPSCounter.cpp
+++ b/gfx/layers/composite/FPSCounter.cpp
@@ -431,17 +431,17 @@ void FPSState::DrawFPS(TimeStamp aNow,
reinterpret_cast<uint8_t*>(buf), w * bytesPerPixel, IntSize(w, h), SurfaceFormat::B8G8R8A8);
mFPSTextureSource = aCompositor->CreateDataTextureSource();
mFPSTextureSource->Update(fpsSurface);
}
EffectChain effectChain;
effectChain.mPrimaryEffect = CreateTexturedEffect(SurfaceFormat::B8G8R8A8,
mFPSTextureSource,
- Filter::POINT,
+ SamplingFilter::POINT,
true);
unsigned int fps = unsigned(mCompositionFps.AddFrameAndGetFps(aNow));
unsigned int txnFps = unsigned(mTransactionFps.GetFPS(aNow));
DrawDigits(fps, aOffsetX + 0, aOffsetY, aCompositor, effectChain);
DrawDigits(txnFps, aOffsetX + FontWidth * 4, aOffsetY, aCompositor, effectChain);
DrawDigits(aFillRatio, aOffsetX + FontWidth * 8, aOffsetY, aCompositor, effectChain);
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -290,17 +290,17 @@ void ImageHost::Attach(Layer* aLayer,
}
}
void
ImageHost::Composite(LayerComposite* aLayer,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion* aVisibleRegion)
{
if (!GetCompositor()) {
// should only happen when a tab is dragged to another window and
// async-video is still sending frames but we haven't attached the
// set the new compositor yet.
return;
@@ -308,17 +308,17 @@ ImageHost::Composite(LayerComposite* aLa
if (mImageHostOverlay) {
mImageHostOverlay->Composite(GetCompositor(),
mFlashCounter,
aLayer,
aEffectChain,
aOpacity,
aTransform,
- aFilter,
+ aSamplingFilter,
aClipRect,
aVisibleRegion);
mBias = BIAS_NONE;
return;
}
int imageIndex = ChooseImageIndex();
if (imageIndex < 0) {
@@ -354,17 +354,17 @@ ImageHost::Composite(LayerComposite* aLa
MOZ_ASSERT(false);
return;
}
bool isAlphaPremultiplied =
!(mCurrentTextureHost->GetFlags() & TextureFlags::NON_PREMULTIPLIED);
RefPtr<TexturedEffect> effect =
CreateTexturedEffect(mCurrentTextureHost->GetReadFormat(),
- mCurrentTextureSource.get(), aFilter, isAlphaPremultiplied,
+ mCurrentTextureSource.get(), aSamplingFilter, isAlphaPremultiplied,
GetRenderState());
if (!effect) {
return;
}
if (!GetCompositor()->SupportsEffect(effect->mType)) {
return;
}
@@ -599,34 +599,34 @@ ImageHost::IsOpaque()
gfx::SurfaceFormat format = img->mTextureHost->GetFormat();
if (gfx::IsOpaque(format)) {
return true;
}
return false;
}
already_AddRefed<TexturedEffect>
-ImageHost::GenEffect(const gfx::Filter& aFilter)
+ImageHost::GenEffect(const gfx::SamplingFilter aSamplingFilter)
{
TimedImage* img = ChooseImage();
if (!img) {
return nullptr;
}
SetCurrentTextureHost(img->mTextureHost);
if (!mCurrentTextureHost->BindTextureSource(mCurrentTextureSource)) {
return nullptr;
}
bool isAlphaPremultiplied = true;
if (mCurrentTextureHost->GetFlags() & TextureFlags::NON_PREMULTIPLIED) {
isAlphaPremultiplied = false;
}
return CreateTexturedEffect(mCurrentTextureHost->GetReadFormat(),
mCurrentTextureSource,
- aFilter,
+ aSamplingFilter,
isAlphaPremultiplied,
GetRenderState());
}
void
ImageHost::SetImageContainer(ImageContainerParent* aImageContainer)
{
if (mImageContainer) {
@@ -677,17 +677,17 @@ ImageHostOverlay::SetCompositor(Composit
void
ImageHostOverlay::Composite(Compositor* aCompositor,
uint32_t aFlashCounter,
LayerComposite* aLayer,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion* aVisibleRegion)
{
MOZ_ASSERT(mCompositor == aCompositor);
if (mOverlay.handle().type() == OverlayHandle::Tnull_t) {
return;
}
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -8,17 +8,17 @@
#include <stdio.h> // for FILE
#include "CompositableHost.h" // for CompositableHost
#include "mozilla/Attributes.h" // for override
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/gfx/MatrixFwd.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for Point
#include "mozilla/gfx/Rect.h" // for Rect
-#include "mozilla/gfx/Types.h" // for Filter
+#include "mozilla/gfx/Types.h" // for SamplingFilter
#include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
#include "mozilla/layers/TextureHost.h" // for TextureHost, etc
#include "mozilla/mozalloc.h" // for operator delete
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsRegionFwd.h" // for nsIntRegion
@@ -42,17 +42,17 @@ public:
~ImageHost();
virtual CompositableType GetType() override { return mTextureInfo.mCompositableType; }
virtual void Composite(LayerComposite* aLayer,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion* aVisibleRegion = nullptr) override;
virtual void UseTextureHost(const nsTArray<TimedTexture>& aTextures) override;
virtual void RemoveTextureHost(TextureHost* aTexture) override;
virtual void UseOverlaySource(OverlaySource aOverlay,
@@ -79,17 +79,17 @@ public:
bool aDumpHtml = false) override;
virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
virtual bool Lock() override;
virtual void Unlock() override;
- virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::Filter& aFilter) override;
+ virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) override;
void SetCurrentTextureHost(TextureHost* aTexture);
virtual void CleanupResources() override;
int32_t GetFrameID()
{
const TimedImage* img = ChooseImage();
@@ -179,17 +179,17 @@ public:
void SetCompositor(Compositor* aCompositor);
virtual void Composite(Compositor* aCompositor,
uint32_t aFlashCounter,
LayerComposite* aLayer,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion* aVisibleRegion);
virtual LayerRenderState GetRenderState();
virtual void UseOverlaySource(OverlaySource aOverlay,
const gfx::IntRect& aPictureRect);
virtual gfx::IntSize GetImageSize() const;
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
protected:
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -106,17 +106,17 @@ ImageLayerComposite::RenderLayer(const I
mCompositor->MakeCurrent();
RenderWithAllMasks(this, mCompositor, aClipRect,
[&](EffectChain& effectChain, const IntRect& clipRect) {
mImageHost->SetCompositor(mCompositor);
mImageHost->Composite(this, effectChain,
GetEffectiveOpacity(),
GetEffectiveTransformForBuffer(),
- GetEffectFilter(),
+ GetSamplingFilter(),
clipRect);
});
mImageHost->BumpFlashCounter();
}
void
ImageLayerComposite::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
{
@@ -200,27 +200,27 @@ ImageLayerComposite::CleanupResources()
{
if (mImageHost) {
mImageHost->CleanupResources();
mImageHost->Detach(this);
}
mImageHost = nullptr;
}
-gfx::Filter
-ImageLayerComposite::GetEffectFilter()
+gfx::SamplingFilter
+ImageLayerComposite::GetSamplingFilter()
{
- return mFilter;
+ return mSamplingFilter;
}
void
ImageLayerComposite::GenEffectChain(EffectChain& aEffect)
{
aEffect.mLayerRef = this;
- aEffect.mPrimaryEffect = mImageHost->GenEffect(GetEffectFilter());
+ aEffect.mPrimaryEffect = mImageHost->GenEffect(GetSamplingFilter());
}
void
ImageLayerComposite::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
ImageLayer::PrintInfo(aStream, aPrefix);
if (mImageHost && mImageHost->IsAttached()) {
aStream << "\n";
--- a/gfx/layers/composite/ImageLayerComposite.h
+++ b/gfx/layers/composite/ImageLayerComposite.h
@@ -62,17 +62,17 @@ public:
virtual bool IsOpaque() override;
virtual nsIntRegion GetFullyRenderedRegion() override;
protected:
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
private:
- gfx::Filter GetEffectFilter();
+ gfx::SamplingFilter GetSamplingFilter();
private:
RefPtr<ImageHost> mImageHost;
};
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/composite/PaintedLayerComposite.cpp
+++ b/gfx/layers/composite/PaintedLayerComposite.cpp
@@ -7,17 +7,17 @@
#include "CompositableHost.h" // for TiledLayerProperties, etc
#include "FrameMetrics.h" // for FrameMetrics
#include "Units.h" // for CSSRect, LayerPixel, etc
#include "gfxEnv.h" // for gfxEnv
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for Point
#include "mozilla/gfx/Rect.h" // for RoundedToInt, Rect
-#include "mozilla/gfx/Types.h" // for Filter::Filter::LINEAR
+#include "mozilla/gfx/Types.h" // for SamplingFilter::LINEAR
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/ContentHost.h" // for ContentHost
#include "mozilla/layers/Effects.h" // for EffectChain
#include "mozilla/mozalloc.h" // for operator delete
#include "nsAString.h"
#include "mozilla/RefPtr.h" // for nsRefPtr
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsMathUtils.h" // for NS_lround
@@ -126,17 +126,17 @@ PaintedLayerComposite::RenderLayer(const
RenderWithAllMasks(this, compositor, aClipRect,
[&](EffectChain& effectChain, const gfx::IntRect& clipRect) {
mBuffer->SetPaintWillResample(MayResample());
mBuffer->Composite(this, effectChain,
GetEffectiveOpacity(),
GetEffectiveTransform(),
- GetEffectFilter(),
+ GetSamplingFilter(),
clipRect,
&visibleRegion);
});
mBuffer->BumpFlashCounter();
compositor->MakeCurrent();
}
@@ -159,17 +159,17 @@ PaintedLayerComposite::CleanupResources(
}
mBuffer = nullptr;
}
void
PaintedLayerComposite::GenEffectChain(EffectChain& aEffect)
{
aEffect.mLayerRef = this;
- aEffect.mPrimaryEffect = mBuffer->GenEffect(GetEffectFilter());
+ aEffect.mPrimaryEffect = mBuffer->GenEffect(GetSamplingFilter());
}
void
PaintedLayerComposite::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
PaintedLayer::PrintInfo(aStream, aPrefix);
if (mBuffer && mBuffer->IsAttached()) {
aStream << "\n";
--- a/gfx/layers/composite/PaintedLayerComposite.h
+++ b/gfx/layers/composite/PaintedLayerComposite.h
@@ -77,17 +77,17 @@ public:
MOZ_LAYER_DECL_NAME("PaintedLayerComposite", TYPE_PAINTED)
protected:
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
private:
- gfx::Filter GetEffectFilter() { return gfx::Filter::LINEAR; }
+ gfx::SamplingFilter GetSamplingFilter() { return gfx::SamplingFilter::LINEAR; }
private:
RefPtr<ContentHost> mBuffer;
};
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/composite/TextRenderer.cpp
+++ b/gfx/layers/composite/TextRenderer.cpp
@@ -126,17 +126,17 @@ TextRenderer::RenderText(const string& a
RefPtr<DataTextureSource> src = mCompositor->CreateDataTextureSource();
if (!src->Update(textSurf)) {
// Upload failed.
return;
}
- RefPtr<EffectRGB> effect = new EffectRGB(src, true, Filter::LINEAR);
+ RefPtr<EffectRGB> effect = new EffectRGB(src, true, SamplingFilter::LINEAR);
EffectChain chain;
chain.mPrimaryEffect = effect;
Matrix4x4 transform = aTransform;
transform.PreScale(scaleFactor, scaleFactor, 1.0f);
mCompositor->DrawQuad(Rect(aOrigin.x, aOrigin.y, maxWidth, numLines * 16),
IntRect(-10000, -10000, 20000, 20000), chain, 1.0f, transform);
}
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -93,32 +93,32 @@ TiledContentHost::TiledContentHost(const
}
TiledContentHost::~TiledContentHost()
{
MOZ_COUNT_DTOR(TiledContentHost);
}
already_AddRefed<TexturedEffect>
-TiledContentHost::GenEffect(const gfx::Filter& aFilter)
+TiledContentHost::GenEffect(const gfx::SamplingFilter aSamplingFilter)
{
// If we can use hwc for this TiledContentHost, it implies that we have exactly
// one high precision tile. Please check TiledContentHost::GetRenderState() for
// all condition.
MOZ_ASSERT(mTiledBuffer.GetTileCount() == 1 && mLowPrecisionTiledBuffer.GetTileCount() == 0);
MOZ_ASSERT(mTiledBuffer.GetTile(0).mTextureHost);
TileHost& tile = mTiledBuffer.GetTile(0);
if (!tile.mTextureHost->BindTextureSource(tile.mTextureSource)) {
return nullptr;
}
return CreateTexturedEffect(tile.mTextureSource,
nullptr,
- aFilter,
+ aSamplingFilter,
true,
tile.mTextureHost->GetRenderState());
}
void
TiledContentHost::Attach(Layer* aLayer,
Compositor* aCompositor,
AttachFlags aFlags /* = NO_FLAGS */)
@@ -393,17 +393,17 @@ TiledLayerBufferComposite::Clear()
mResolution = 1.0;
}
void
TiledContentHost::Composite(LayerComposite* aLayer,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion* aVisibleRegion /* = nullptr */)
{
MOZ_ASSERT(mCompositor);
// Reduce the opacity of the low-precision buffer to make it a
// little more subtle and less jarring. In particular, text
// rendered at low-resolution and scaled tends to look pretty
// heavy and this helps mitigate that. When we reduce the opacity
@@ -440,28 +440,28 @@ TiledContentHost::Composite(LayerComposi
renderRegion = &tmpRegion;
}
#endif
// Render the low and high precision buffers.
RenderLayerBuffer(mLowPrecisionTiledBuffer,
lowPrecisionOpacityReduction < 1.0f ? &backgroundColor : nullptr,
aEffectChain, lowPrecisionOpacityReduction * aOpacity,
- aFilter, aClipRect, *renderRegion, aTransform);
- RenderLayerBuffer(mTiledBuffer, nullptr, aEffectChain, aOpacity, aFilter,
+ aSamplingFilter, aClipRect, *renderRegion, aTransform);
+ RenderLayerBuffer(mTiledBuffer, nullptr, aEffectChain, aOpacity, aSamplingFilter,
aClipRect, *renderRegion, aTransform);
}
void
TiledContentHost::RenderTile(TileHost& aTile,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion& aScreenRegion,
const IntPoint& aTextureOffset,
const IntSize& aTextureBounds,
const gfx::Rect& aVisibleRect)
{
MOZ_ASSERT(!aTile.IsPlaceholderTile());
@@ -479,17 +479,17 @@ TiledContentHost::RenderTile(TileHost& a
if (aTile.mTextureHostOnWhite && !aTile.mTextureHostOnWhite->BindTextureSource(aTile.mTextureSourceOnWhite)) {
return;
}
RefPtr<TexturedEffect> effect =
CreateTexturedEffect(aTile.mTextureSource,
aTile.mTextureSourceOnWhite,
- aFilter,
+ aSamplingFilter,
true,
aTile.mTextureHost->GetRenderState());
if (!effect) {
return;
}
float opacity = aTile.GetFadeInOpacity(aOpacity);
aEffectChain.mPrimaryEffect = effect;
@@ -514,17 +514,17 @@ TiledContentHost::RenderTile(TileHost& a
aScreenRegion, aClipRect, aTransform, mFlashCounter);
}
void
TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
const Color* aBackgroundColor,
EffectChain& aEffectChain,
float aOpacity,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
nsIntRegion aVisibleRegion,
gfx::Matrix4x4 aTransform)
{
if (!mCompositor) {
NS_WARNING("Can't render tiled content host - no compositor");
return;
}
@@ -597,17 +597,17 @@ TiledContentHost::RenderLayerBuffer(Tile
tileDrawRegion.AndWith(compositeRegion);
if (tileDrawRegion.IsEmpty()) {
continue;
}
tileDrawRegion.ScaleRoundOut(resolution, resolution);
RenderTile(tile, aEffectChain, aOpacity,
- aTransform, aFilter, aClipRect, tileDrawRegion,
+ aTransform, aSamplingFilter, aClipRect, tileDrawRegion,
tileOffset * resolution, aLayerBuffer.GetTileSize(),
gfx::Rect(visibleRect.x, visibleRect.y,
visibleRect.width, visibleRect.height));
if (tile.mTextureHostOnWhite) {
componentAlphaDiagnostic = DiagnosticFlags::COMPONENT_ALPHA;
}
}
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -13,17 +13,17 @@
#include "TiledLayerBuffer.h" // for TiledLayerBuffer, etc
#include "CompositableHost.h"
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Attributes.h" // for override
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/gfx/MatrixFwd.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for Point
#include "mozilla/gfx/Rect.h" // for Rect
-#include "mozilla/gfx/Types.h" // for Filter
+#include "mozilla/gfx/Types.h" // for SamplingFilter
#include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
#include "mozilla/layers/TextureHost.h" // for TextureHost
#include "mozilla/layers/TextureClient.h"
#include "mozilla/mozalloc.h" // for operator delete
#include "nsRegion.h" // for nsIntRegion
#include "nscore.h" // for nsACString
@@ -197,17 +197,17 @@ public:
state.SetOffset(offset);
return state;
}
}
return LayerRenderState();
}
// Generate effect for layerscope when using hwc.
- virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::Filter& aFilter) override;
+ virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) override;
virtual bool UpdateThebes(const ThebesBufferData& aData,
const nsIntRegion& aUpdated,
const nsIntRegion& aOldValidRegionBack,
nsIntRegion* aUpdatedRegionBack) override
{
NS_ERROR("N/A for tiled layers");
return false;
@@ -233,17 +233,17 @@ public:
bool UseTiledLayerBuffer(ISurfaceAllocator* aAllocator,
const SurfaceDescriptorTiles& aTiledDescriptor);
virtual void Composite(LayerComposite* aLayer,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion* aVisibleRegion = nullptr) override;
virtual CompositableType GetType() override { return CompositableType::CONTENT_TILED; }
virtual TiledContentHost* AsTiledContentHost() override { return this; }
virtual void Attach(Layer* aLayer,
@@ -262,27 +262,27 @@ public:
virtual void AddAnimationInvalidation(nsIntRegion& aRegion) override;
private:
void RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
const gfx::Color* aBackgroundColor,
EffectChain& aEffectChain,
float aOpacity,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
nsIntRegion aMaskRegion,
gfx::Matrix4x4 aTransform);
// Renders a single given tile.
void RenderTile(TileHost& aTile,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
- const gfx::Filter& aFilter,
+ const gfx::SamplingFilter aSamplingFilter,
const gfx::IntRect& aClipRect,
const nsIntRegion& aScreenRegion,
const gfx::IntPoint& aTextureOffset,
const gfx::IntSize& aTextureBounds,
const gfx::Rect& aVisibleRect);
void EnsureTileStore() {}
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -1009,24 +1009,24 @@ CompositorD3D11::DrawQuad(const gfx::Rec
ID3D11ShaderResourceView* srView = source->GetShaderResourceView();
mContext->PSSetShaderResources(TexSlot::RGB, 1, &srView);
if (!texturedEffect->mPremultiplied) {
mContext->OMSetBlendState(mAttachments->mNonPremulBlendState, sBlendFactor, 0xFFFFFFFF);
restoreBlendMode = true;
}
- SetSamplerForFilter(texturedEffect->mFilter);
+ SetSamplerForSamplingFilter(texturedEffect->mSamplingFilter);
}
break;
case EffectTypes::YCBCR: {
EffectYCbCr* ycbcrEffect =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
- SetSamplerForFilter(Filter::LINEAR);
+ SetSamplerForSamplingFilter(SamplingFilter::LINEAR);
pTexCoordRect = &ycbcrEffect->mTextureCoords;
const int Y = 0, Cb = 1, Cr = 2;
TextureSource* source = ycbcrEffect->mTexture;
if (!source) {
NS_WARNING("No texture to composite");
@@ -1059,17 +1059,17 @@ CompositorD3D11::DrawQuad(const gfx::Rec
TextureSourceD3D11* sourceOnWhite = effectComponentAlpha->mOnWhite->AsSourceD3D11();
TextureSourceD3D11* sourceOnBlack = effectComponentAlpha->mOnBlack->AsSourceD3D11();
if (!sourceOnWhite || !sourceOnBlack) {
NS_WARNING("Missing texture source(s)!");
return;
}
- SetSamplerForFilter(effectComponentAlpha->mFilter);
+ SetSamplerForSamplingFilter(effectComponentAlpha->mSamplingFilter);
pTexCoordRect = &effectComponentAlpha->mTextureCoords;
ID3D11ShaderResourceView* srViews[2] = { sourceOnBlack->GetShaderResourceView(),
sourceOnWhite->GetShaderResourceView() };
mContext->PSSetShaderResources(TexSlot::RGB, 1, &srViews[0]);
mContext->PSSetShaderResources(TexSlot::RGBWhite, 1, &srViews[1]);
@@ -1582,24 +1582,24 @@ CompositorD3D11::UpdateConstantBuffers()
mContext->VSSetConstantBuffers(0, 1, &buffer);
buffer = mAttachments->mPSConstantBuffer;
mContext->PSSetConstantBuffers(0, 1, &buffer);
return true;
}
void
-CompositorD3D11::SetSamplerForFilter(Filter aFilter)
+CompositorD3D11::SetSamplerForSamplingFilter(SamplingFilter aSamplingFilter)
{
ID3D11SamplerState *sampler;
- switch (aFilter) {
- case Filter::POINT:
+ switch (aSamplingFilter) {
+ case SamplingFilter::POINT:
sampler = mAttachments->mPointSamplerState;
break;
- case Filter::LINEAR:
+ case SamplingFilter::LINEAR:
default:
sampler = mAttachments->mLinearSamplerState;
break;
}
mContext->PSSetSamplers(0, 1, &sampler);
}
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ b/gfx/layers/d3d11/CompositorD3D11.h
@@ -165,17 +165,17 @@ private:
// a string prefix must be provided.
bool Failed(HRESULT hr, const char* aContext);
// ensure mSize is up to date with respect to mWidget
void EnsureSize();
bool VerifyBufferSize();
bool UpdateRenderTarget();
bool UpdateConstantBuffers();
- void SetSamplerForFilter(gfx::Filter aFilter);
+ void SetSamplerForSamplingFilter(gfx::SamplingFilter aSamplingFilter);
ID3D11PixelShader* GetPSForEffect(Effect *aEffect, MaskType aMaskType);
void PaintToTarget();
RefPtr<ID3D11Texture2D> CreateTexture(const gfx::IntRect& aRect,
const CompositingRenderTarget* aSource,
const gfx::IntPoint& aSourcePoint);
bool CopyBackdrop(const gfx::IntRect& aRect,
RefPtr<ID3D11Texture2D>* aOutTexture,
RefPtr<ID3D11ShaderResourceView>* aOutView);
--- a/gfx/layers/d3d9/CompositorD3D9.cpp
+++ b/gfx/layers/d3d9/CompositorD3D9.cpp
@@ -358,17 +358,17 @@ CompositorD3D9::DrawQuad(const gfx::Rect
d3d9Device->SetVertexShaderConstantF(CBvTextureCoords,
ShaderConstantRect(
textureCoords.x,
textureCoords.y,
textureCoords.width,
textureCoords.height),
1);
- SetSamplerForFilter(texturedEffect->mFilter);
+ SetSamplerForSamplingFilter(texturedEffect->mSamplingFilter);
TextureSourceD3D9* source = texturedEffect->mTexture->AsSourceD3D9();
d3d9Device->SetTexture(0, source->GetD3D9Texture());
maskTexture = mDeviceManager
->SetShaderMode(ShaderModeForEffectType(aEffectChain.mPrimaryEffect->mType,
texturedEffect->mTexture->GetFormat()),
maskType);
@@ -376,17 +376,17 @@ CompositorD3D9::DrawQuad(const gfx::Rect
isPremultiplied = texturedEffect->mPremultiplied;
}
break;
case EffectTypes::YCBCR:
{
EffectYCbCr* ycbcrEffect =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
- SetSamplerForFilter(Filter::LINEAR);
+ SetSamplerForSamplingFilter(SamplingFilter::LINEAR);
Rect textureCoords = ycbcrEffect->mTextureCoords;
d3d9Device->SetVertexShaderConstantF(CBvTextureCoords,
ShaderConstantRect(
textureCoords.x,
textureCoords.y,
textureCoords.width,
textureCoords.height),
@@ -474,17 +474,17 @@ CompositorD3D9::DrawQuad(const gfx::Rect
d3d9Device->SetVertexShaderConstantF(CBvTextureCoords,
ShaderConstantRect(
textureCoords.x,
textureCoords.y,
textureCoords.width,
textureCoords.height),
1);
- SetSamplerForFilter(effectComponentAlpha->mFilter);
+ SetSamplerForSamplingFilter(effectComponentAlpha->mSamplingFilter);
maskTexture = mDeviceManager->SetShaderMode(DeviceManagerD3D9::COMPONENTLAYERPASS1, maskType);
SetMask(aEffectChain, maskTexture);
d3d9Device->SetTexture(0, sourceOnBlack->GetD3D9Texture());
d3d9Device->SetTexture(1, sourceOnWhite->GetD3D9Texture());
d3d9Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);
d3d9Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR);
d3d9Device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
@@ -759,24 +759,24 @@ CompositorD3D9::PrepareViewport(const gf
void
CompositorD3D9::EnsureSize()
{
mSize = mWidget->GetClientSize();
}
void
-CompositorD3D9::SetSamplerForFilter(Filter aFilter)
+CompositorD3D9::SetSamplerForSamplingFilter(SamplingFilter aSamplingFilter)
{
- switch (aFilter) {
- case Filter::LINEAR:
+ switch (aSamplingFilter) {
+ case SamplingFilter::LINEAR:
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
return;
- case Filter::POINT:
+ case SamplingFilter::POINT:
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
return;
default:
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
device()->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
}
}
--- a/gfx/layers/d3d9/CompositorD3D9.h
+++ b/gfx/layers/d3d9/CompositorD3D9.h
@@ -119,17 +119,17 @@ public:
// If the offset is 0, 0 that's okay.
}
virtual already_AddRefed<DataTextureSource>
CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) override;
private:
// ensure mSize is up to date with respect to mWidget
void EnsureSize();
- void SetSamplerForFilter(gfx::Filter aFilter);
+ void SetSamplerForSamplingFilter(gfx::SamplingFilter aSamplingFilter);
void PaintToTarget();
void SetMask(const EffectChain &aEffectChain, uint32_t aMaskTexture);
/**
* Ensure we have a swap chain and it is ready for rendering.
* Requires mDeviceManger to be non-null.
* Returns true if we have a working swap chain; false otherwise.
* If we cannot create or validate the swap chain due to a bad device manager,
* then the device will be destroyed and set mDeviceManager to null. We will
--- a/gfx/layers/ipc/CompositorBench.cpp
+++ b/gfx/layers/ipc/CompositorBench.cpp
@@ -221,17 +221,18 @@ public:
virtual void Teardown(Compositor* aCompositor) {
mSurface = nullptr;
mTexture = nullptr;
free(mBuf);
}
already_AddRefed<Effect> CreateEffect(size_t i) {
- return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture, Filter::POINT, true);
+ return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture,
+ SamplingFilter::POINT, true);
}
};
class StressTexturedQuadBench : public BenchTest {
public:
StressTexturedQuadBench()
: BenchTest("Stress Textured Quad (10s 256x256 quads)")
{}
@@ -264,17 +265,18 @@ public:
virtual void Teardown(Compositor* aCompositor) {
mSurface = nullptr;
mTexture = nullptr;
free(mBuf);
}
virtual already_AddRefed<Effect> CreateEffect(size_t i) {
- return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture, Filter::POINT, true);
+ return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture,
+ SamplingFilter::POINT, true);
}
};
#ifdef MOZ_WIDGET_GONK
class TrivialGrallocQuadBench : public BenchTest {
public:
TrivialGrallocQuadBench()
: BenchTest("Travial Gralloc Quad (10s 256x256 quads)")
@@ -306,17 +308,18 @@ public:
virtual void Teardown(Compositor* aCompositor) {
mGralloc = nullptr;
mTexture = nullptr;
free(mBuf);
}
virtual already_AddRefed<Effect> CreateEffect(size_t i) {
- return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture, Filter::POINT);
+ return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture,
+ SamplingFilter::POINT);
}
};
class StressGrallocQuadBench : public BenchTest {
public:
StressGrallocQuadBench()
: BenchTest("Stress Gralloc Quad (10s 256x256 quads)")
{}
@@ -347,17 +350,18 @@ public:
virtual void Teardown(Compositor* aCompositor) {
mGralloc = nullptr;
mTexture = nullptr;
free(mBuf);
}
virtual already_AddRefed<Effect> CreateEffect(size_t i) {
- return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture, Filter::POINT);
+ return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture,
+ SamplingFilter::POINT);
}
};
#endif
static void RunCompositorBench(Compositor* aCompositor, const gfx::Rect& aScreenRect)
{
std::vector<BenchTest*> tests;
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -449,17 +449,17 @@ LayerTransactionParent::RecvUpdate(Infal
}
case Specific::TCanvasLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] canvas layer"));
CanvasLayerComposite* canvasLayer = layerParent->AsCanvasLayerComposite();
if (!canvasLayer) {
return false;
}
- canvasLayer->SetFilter(specific.get_CanvasLayerAttributes().filter());
+ canvasLayer->SetSamplingFilter(specific.get_CanvasLayerAttributes().samplingFilter());
canvasLayer->SetBounds(specific.get_CanvasLayerAttributes().bounds());
break;
}
case Specific::TRefLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] ref layer"));
RefLayerComposite* refLayer = layerParent->AsRefLayerComposite();
if (!refLayer) {
@@ -472,17 +472,17 @@ LayerTransactionParent::RecvUpdate(Infal
case Specific::TImageLayerAttributes: {
MOZ_LAYERS_LOG(("[ParentSide] image layer"));
ImageLayerComposite* imageLayer = layerParent->AsImageLayerComposite();
if (!imageLayer) {
return false;
}
const ImageLayerAttributes& attrs = specific.get_ImageLayerAttributes();
- imageLayer->SetFilter(attrs.filter());
+ imageLayer->SetSamplingFilter(attrs.samplingFilter());
imageLayer->SetScaleToSize(attrs.scaleToSize(), attrs.scaleMode());
break;
}
default:
NS_RUNTIMEABORT("not reached");
}
updateHitTestingTree = true;
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -12,17 +12,17 @@ include protocol PLayer;
include protocol PImageContainer;
include protocol PRenderFrame;
include protocol PTexture;
include "gfxipc/ShadowLayerUtils.h";
include "mozilla/GfxMessageUtils.h";
include "ImageLayers.h";
-using mozilla::gfx::Filter from "mozilla/gfx/2D.h";
+using mozilla::gfx::SamplingFilter 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";
using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
using nscoord from "nsCoord.h";
using struct nsRect from "nsRect.h";
using struct nsPoint from "nsPoint.h";
using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
@@ -253,24 +253,24 @@ struct ContainerLayerAttributes {
float inheritedYScale;
float presShellResolution;
bool scaleToResolution;
EventRegionsOverride eventRegionsOverride;
uint32_t hmdDeviceID;
int32_t inputFrameID;
};
struct ColorLayerAttributes { LayerColor color; IntRect bounds; };
-struct CanvasLayerAttributes { Filter filter; IntRect bounds; };
+struct CanvasLayerAttributes { SamplingFilter samplingFilter; 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 { Filter filter; IntSize scaleToSize; ScaleMode scaleMode; };
+struct ImageLayerAttributes { SamplingFilter samplingFilter; IntSize scaleToSize; ScaleMode scaleMode; };
union SpecificLayerAttributes {
null_t;
PaintedLayerAttributes;
ContainerLayerAttributes;
ColorLayerAttributes;
CanvasLayerAttributes;
RefLayerAttributes;
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -61,17 +61,17 @@ namespace layers {
using namespace mozilla::gl;
static void
BindMaskForProgram(ShaderProgramOGL* aProgram, TextureSourceOGL* aSourceMask,
GLenum aTexUnit, const gfx::Matrix4x4& aTransform)
{
MOZ_ASSERT(LOCAL_GL_TEXTURE0 <= aTexUnit && aTexUnit <= LOCAL_GL_TEXTURE31);
- aSourceMask->BindTexture(aTexUnit, gfx::Filter::LINEAR);
+ aSourceMask->BindTexture(aTexUnit, gfx::SamplingFilter::LINEAR);
aProgram->SetMaskTextureUnit(aTexUnit - LOCAL_GL_TEXTURE0);
aProgram->SetMaskLayerTransform(aTransform);
}
void
CompositorOGL::BindBackdrop(ShaderProgramOGL* aProgram, GLuint aBackdrop, GLenum aTexUnit)
{
MOZ_ASSERT(aBackdrop);
@@ -1243,19 +1243,19 @@ CompositorOGL::DrawQuad(const Rect& aRec
case EffectTypes::RGB: {
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
TextureSource *source = texturedEffect->mTexture;
didSetBlendMode = SetBlendMode(gl(), blendMode, texturedEffect->mPremultiplied);
- gfx::Filter filter = texturedEffect->mFilter;
+ gfx::SamplingFilter samplingFilter = texturedEffect->mSamplingFilter;
- source->AsSourceOGL()->BindTexture(LOCAL_GL_TEXTURE0, filter);
+ source->AsSourceOGL()->BindTexture(LOCAL_GL_TEXTURE0, samplingFilter);
program->SetTextureUnit(0);
Matrix4x4 textureTransform = source->AsSourceOGL()->GetTextureTransform();
program->SetTextureTransform(textureTransform);
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE1, maskQuadTransform);
@@ -1276,19 +1276,19 @@ CompositorOGL::DrawQuad(const Rect& aRec
TextureSourceOGL* sourceCb = sourceYCbCr->GetSubSource(Cb)->AsSourceOGL();
TextureSourceOGL* sourceCr = sourceYCbCr->GetSubSource(Cr)->AsSourceOGL();
if (!sourceY || !sourceCb || !sourceCr) {
NS_WARNING("Invalid layer texture.");
return;
}
- sourceY->BindTexture(LOCAL_GL_TEXTURE0, effectYCbCr->mFilter);
- sourceCb->BindTexture(LOCAL_GL_TEXTURE1, effectYCbCr->mFilter);
- sourceCr->BindTexture(LOCAL_GL_TEXTURE2, effectYCbCr->mFilter);
+ sourceY->BindTexture(LOCAL_GL_TEXTURE0, effectYCbCr->mSamplingFilter);
+ sourceCb->BindTexture(LOCAL_GL_TEXTURE1, effectYCbCr->mSamplingFilter);
+ sourceCr->BindTexture(LOCAL_GL_TEXTURE2, effectYCbCr->mSamplingFilter);
program->SetYCbCrTextureUnits(Y, Cb, Cr);
program->SetTextureTransform(Matrix4x4());
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE3, maskQuadTransform);
}
if (mixBlendBackdrop) {
@@ -1309,18 +1309,18 @@ CompositorOGL::DrawQuad(const Rect& aRec
TextureSourceOGL* sourceY = sourceNV12->GetSubSource(Y)->AsSourceOGL();
TextureSourceOGL* sourceCbCr = sourceNV12->GetSubSource(CbCr)->AsSourceOGL();
if (!sourceY || !sourceCbCr) {
NS_WARNING("Invalid layer texture.");
return;
}
- sourceY->BindTexture(LOCAL_GL_TEXTURE0, effectNV12->mFilter);
- sourceCbCr->BindTexture(LOCAL_GL_TEXTURE1, effectNV12->mFilter);
+ sourceY->BindTexture(LOCAL_GL_TEXTURE0, effectNV12->mSamplingFilter);
+ sourceCbCr->BindTexture(LOCAL_GL_TEXTURE1, effectNV12->mSamplingFilter);
if (config.mFeatures & ENABLE_TEXTURE_RECT) {
// This is used by IOSurface that use 0,0...w,h coordinate rather then 0,0..1,1.
program->SetCbCrTexCoordMultiplier(sourceCbCr->GetSize().width, sourceCbCr->GetSize().height);
}
program->SetNV12TextureUnits(Y, CbCr);
program->SetTextureTransform(Matrix4x4());
@@ -1382,18 +1382,18 @@ CompositorOGL::DrawQuad(const Rect& aRec
TextureSourceOGL* sourceOnBlack = effectComponentAlpha->mOnBlack->AsSourceOGL();
if (!sourceOnBlack->IsValid() ||
!sourceOnWhite->IsValid()) {
NS_WARNING("Invalid layer texture for component alpha");
return;
}
- sourceOnBlack->BindTexture(LOCAL_GL_TEXTURE0, effectComponentAlpha->mFilter);
- sourceOnWhite->BindTexture(LOCAL_GL_TEXTURE1, effectComponentAlpha->mFilter);
+ sourceOnBlack->BindTexture(LOCAL_GL_TEXTURE0, effectComponentAlpha->mSamplingFilter);
+ sourceOnWhite->BindTexture(LOCAL_GL_TEXTURE1, effectComponentAlpha->mSamplingFilter);
program->SetBlackTextureUnit(0);
program->SetWhiteTextureUnit(1);
program->SetTextureTransform(Matrix4x4());
if (maskType != MaskType::MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE2, maskQuadTransform);
}
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
@@ -132,29 +132,30 @@ MacIOSurfaceTextureSourceOGL::GetSize()
gfx::SurfaceFormat
MacIOSurfaceTextureSourceOGL::GetFormat() const
{
return mSurface->HasAlpha() ? gfx::SurfaceFormat::R8G8B8A8
: gfx::SurfaceFormat::R8G8B8X8;
}
void
-MacIOSurfaceTextureSourceOGL::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
+MacIOSurfaceTextureSourceOGL::BindTexture(GLenum aTextureUnit,
+ gfx::SamplingFilter aSamplingFilter)
{
gl::GLContext* gl = this->gl();
if (!gl || !gl->MakeCurrent()) {
NS_WARNING("Trying to bind a texture without a working GLContext");
return;
}
GLuint tex = mCompositor->GetTemporaryTexture(GetTextureTarget(), aTextureUnit);
gl->fActiveTexture(aTextureUnit);
gl->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, tex);
mSurface->CGLTexImageIOSurface2D(gl::GLContextCGL::Cast(gl)->GetCGLContext());
- ApplyFilterToBoundTexture(gl, aFilter, LOCAL_GL_TEXTURE_RECTANGLE_ARB);
+ ApplySamplingFilterToBoundTexture(gl, aSamplingFilter, LOCAL_GL_TEXTURE_RECTANGLE_ARB);
}
void
MacIOSurfaceTextureSourceOGL::SetCompositor(Compositor* aCompositor)
{
mCompositor = AssertGLCompositor(aCompositor);
if (mCompositor && mNextSibling) {
mNextSibling->SetCompositor(aCompositor);
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
@@ -27,17 +27,18 @@ public:
MacIOSurfaceTextureSourceOGL(CompositorOGL* aCompositor,
MacIOSurface* aSurface);
virtual ~MacIOSurfaceTextureSourceOGL();
virtual const char* Name() const override { return "MacIOSurfaceTextureSourceOGL"; }
virtual TextureSourceOGL* AsSourceOGL() override { return this; }
- virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) override;
+ virtual void BindTexture(GLenum activetex,
+ gfx::SamplingFilter aSamplingFilter) override;
virtual bool IsValid() const override { return !!gl(); }
virtual gfx::IntSize GetSize() const override;
virtual gfx::SurfaceFormat GetFormat() const override;
virtual GLenum GetTextureTarget() const override { return LOCAL_GL_TEXTURE_RECTANGLE_ARB; }
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -276,22 +276,23 @@ TextureImageTextureSourceOGL::GetFormat(
}
gfx::IntRect TextureImageTextureSourceOGL::GetTileRect()
{
return mTexImage->GetTileRect();
}
void
-TextureImageTextureSourceOGL::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
+TextureImageTextureSourceOGL::BindTexture(GLenum aTextureUnit,
+ gfx::SamplingFilter aSamplingFilter)
{
MOZ_ASSERT(mTexImage,
"Trying to bind a TextureSource that does not have an underlying GL texture.");
mTexImage->BindTexture(aTextureUnit);
- SetFilter(mCompositor->gl(), aFilter);
+ SetSamplingFilter(mCompositor->gl(), aSamplingFilter);
}
////////////////////////////////////////////////////////////////////////
// GLTextureSource
GLTextureSource::GLTextureSource(CompositorOGL* aCompositor,
GLuint aTextureHandle,
GLenum aTarget,
@@ -330,26 +331,27 @@ GLTextureSource::DeleteTextureHandle()
GLContext* gl = this->gl();
if (mTextureHandle != 0 && gl && gl->MakeCurrent()) {
gl->fDeleteTextures(1, &mTextureHandle);
}
mTextureHandle = 0;
}
void
-GLTextureSource::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
+GLTextureSource::BindTexture(GLenum aTextureUnit,
+ gfx::SamplingFilter aSamplingFilter)
{
MOZ_ASSERT(mTextureHandle != 0);
GLContext* gl = this->gl();
if (!gl || !gl->MakeCurrent()) {
return;
}
gl->fActiveTexture(aTextureUnit);
gl->fBindTexture(mTextureTarget, mTextureHandle);
- ApplyFilterToBoundTexture(gl, aFilter, mTextureTarget);
+ ApplySamplingFilterToBoundTexture(gl, aSamplingFilter, mTextureTarget);
}
void
GLTextureSource::SetCompositor(Compositor* aCompositor)
{
CompositorOGL* glCompositor = AssertGLCompositor(aCompositor);
if (!glCompositor) {
return;
@@ -394,34 +396,35 @@ SurfaceTextureSource::SurfaceTextureSour
, mFormat(aFormat)
, mTextureTarget(aTarget)
, mWrapMode(aWrapMode)
, mSize(aSize)
{
}
void
-SurfaceTextureSource::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
+SurfaceTextureSource::BindTexture(GLenum aTextureUnit,
+ gfx::SamplingFilter aSamplingFilter)
{
MOZ_ASSERT(mSurfTex);
GLContext* gl = this->gl();
if (!gl || !gl->MakeCurrent()) {
NS_WARNING("Trying to bind a texture without a GLContext");
return;
}
gl->fActiveTexture(aTextureUnit);
// SurfaceTexture spams us if there are any existing GL errors, so
// we'll clear them here in order to avoid that.
gl->FlushErrors();
mSurfTex->UpdateTexImage();
- ApplyFilterToBoundTexture(gl, aFilter, mTextureTarget);
+ ApplySamplingFilterToBoundTexture(gl, aSamplingFilter, mTextureTarget);
}
void
SurfaceTextureSource::SetCompositor(Compositor* aCompositor)
{
CompositorOGL* glCompositor = AssertGLCompositor(aCompositor);
if (!glCompositor) {
DeallocateDeviceData();
@@ -564,17 +567,18 @@ EGLImageTextureSource::EGLImageTextureSo
, mWrapMode(aWrapMode)
, mSize(aSize)
{
MOZ_ASSERT(mTextureTarget == LOCAL_GL_TEXTURE_2D ||
mTextureTarget == LOCAL_GL_TEXTURE_EXTERNAL);
}
void
-EGLImageTextureSource::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
+EGLImageTextureSource::BindTexture(GLenum aTextureUnit,
+ gfx::SamplingFilter aSamplingFilter)
{
GLContext* gl = this->gl();
if (!gl || !gl->MakeCurrent()) {
NS_WARNING("Trying to bind a texture without a GLContext");
return;
}
MOZ_ASSERT(DoesEGLContextSupportSharingWithEGLImage(gl),
@@ -582,17 +586,17 @@ EGLImageTextureSource::BindTexture(GLenu
GLuint tex = mCompositor->GetTemporaryTexture(mTextureTarget, aTextureUnit);
gl->fActiveTexture(aTextureUnit);
gl->fBindTexture(mTextureTarget, tex);
gl->fEGLImageTargetTexture2D(mTextureTarget, mImage);
- ApplyFilterToBoundTexture(gl, aFilter, mTextureTarget);
+ ApplySamplingFilterToBoundTexture(gl, aSamplingFilter, mTextureTarget);
}
void
EGLImageTextureSource::SetCompositor(Compositor* aCompositor)
{
mCompositor = AssertGLCompositor(aCompositor);
}
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -43,22 +43,22 @@ class AndroidSurfaceTexture;
namespace layers {
class Compositor;
class CompositorOGL;
class TextureImageTextureSourceOGL;
class GLTextureSource;
-inline void ApplyFilterToBoundTexture(gl::GLContext* aGL,
- gfx::Filter aFilter,
- GLuint aTarget = LOCAL_GL_TEXTURE_2D)
+inline void ApplySamplingFilterToBoundTexture(gl::GLContext* aGL,
+ gfx::SamplingFilter aSamplingFilter,
+ GLuint aTarget = LOCAL_GL_TEXTURE_2D)
{
GLenum filter =
- (aFilter == gfx::Filter::POINT ? LOCAL_GL_NEAREST : LOCAL_GL_LINEAR);
+ (aSamplingFilter == gfx::SamplingFilter::POINT ? LOCAL_GL_NEAREST : LOCAL_GL_LINEAR);
aGL->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MIN_FILTER, filter);
aGL->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MAG_FILTER, filter);
}
/*
* TextureHost implementations for the OpenGL backend.
*
@@ -77,53 +77,54 @@ inline void ApplyFilterToBoundTexture(gl
/**
* TextureSourceOGL provides the necessary API for CompositorOGL to composite
* a TextureSource.
*/
class TextureSourceOGL
{
public:
TextureSourceOGL()
- : mHasCachedFilter(false)
+ : mHasCachedSamplingFilter(false)
{}
virtual bool IsValid() const = 0;
- virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) = 0;
+ virtual void BindTexture(GLenum aTextureUnit,
+ gfx::SamplingFilter aSamplingFilter) = 0;
virtual gfx::IntSize GetSize() const = 0;
virtual GLenum GetTextureTarget() const { return LOCAL_GL_TEXTURE_2D; }
virtual gfx::SurfaceFormat GetFormat() const = 0;
virtual GLenum GetWrapMode() const = 0;
virtual gfx::Matrix4x4 GetTextureTransform() { return gfx::Matrix4x4(); }
virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() { return nullptr; }
virtual GLTextureSource* AsGLTextureSource() { return nullptr; }
- void SetFilter(gl::GLContext* aGL, gfx::Filter aFilter)
+ void SetSamplingFilter(gl::GLContext* aGL, gfx::SamplingFilter aSamplingFilter)
{
- if (mHasCachedFilter &&
- mCachedFilter == aFilter) {
+ if (mHasCachedSamplingFilter &&
+ mCachedSamplingFilter == aSamplingFilter) {
return;
}
- mHasCachedFilter = true;
- mCachedFilter = aFilter;
- ApplyFilterToBoundTexture(aGL, aFilter, GetTextureTarget());
+ mHasCachedSamplingFilter = true;
+ mCachedSamplingFilter = aSamplingFilter;
+ ApplySamplingFilterToBoundTexture(aGL, aSamplingFilter, GetTextureTarget());
}
- void ClearCachedFilter() { mHasCachedFilter = false; }
+ void ClearCachedFilter() { mHasCachedSamplingFilter = false; }
private:
- gfx::Filter mCachedFilter;
- bool mHasCachedFilter;
+ gfx::SamplingFilter mCachedSamplingFilter;
+ bool mHasCachedSamplingFilter;
};
/**
* A TextureSource backed by a TextureImage.
*
* Depending on the underlying TextureImage, may support texture tiling, so
* make sure to check AsBigImageIterator() and use the texture accordingly.
*
@@ -163,17 +164,18 @@ public:
virtual void DeallocateDeviceData() override
{
mTexImage = nullptr;
SetUpdateSerial(0);
}
virtual TextureSourceOGL* AsSourceOGL() override { return this; }
- virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) override;
+ virtual void BindTexture(GLenum aTextureUnit,
+ gfx::SamplingFilter aSamplingFilter) override;
virtual gfx::IntSize GetSize() const override;
virtual gfx::SurfaceFormat GetFormat() const override;
virtual bool IsValid() const override { return !!mTexImage; }
virtual void SetCompositor(Compositor* aCompositor) override;
@@ -239,17 +241,18 @@ public:
~GLTextureSource();
virtual const char* Name() const override { return "GLTextureSource"; }
virtual GLTextureSource* AsGLTextureSource() override { return this; }
virtual TextureSourceOGL* AsSourceOGL() override { return this; }
- virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) override;
+ virtual void BindTexture(GLenum activetex,
+ gfx::SamplingFilter aSamplingFilter) override;
virtual bool IsValid() const override;
virtual gfx::IntSize GetSize() const override { return mSize; }
virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; }
virtual GLenum GetTextureTarget() const override { return mTextureTarget; }
@@ -348,17 +351,18 @@ public:
GLenum aTarget,
GLenum aWrapMode,
gfx::IntSize aSize);
virtual const char* Name() const override { return "SurfaceTextureSource"; }
virtual TextureSourceOGL* AsSourceOGL() override { return this; }
- virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) override;
+ virtual void BindTexture(GLenum activetex,
+ gfx::SamplingFilter aSamplingFilter) override;
virtual bool IsValid() const override;
virtual gfx::IntSize GetSize() const override { return mSize; }
virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; }
virtual gfx::Matrix4x4 GetTextureTransform() override;
@@ -442,17 +446,18 @@ public:
GLenum aTarget,
GLenum aWrapMode,
gfx::IntSize aSize);
virtual const char* Name() const override { return "EGLImageTextureSource"; }
virtual TextureSourceOGL* AsSourceOGL() override { return this; }
- virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) override;
+ virtual void BindTexture(GLenum activetex,
+ gfx::SamplingFilter aSamplingFilter) override;
virtual bool IsValid() const override;
virtual gfx::IntSize GetSize() const override { return mSize; }
virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; }
virtual gfx::Matrix4x4 GetTextureTransform() override;
--- a/gfx/layers/opengl/X11TextureSourceOGL.cpp
+++ b/gfx/layers/opengl/X11TextureSourceOGL.cpp
@@ -35,17 +35,18 @@ X11TextureSourceOGL::DeallocateDeviceDat
gl::sGLXLibrary.ReleaseTexImage(mSurface->XDisplay(), mSurface->GetGLXPixmap());
gl()->fDeleteTextures(1, &mTexture);
mTexture = 0;
}
}
}
void
-X11TextureSourceOGL::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
+X11TextureSourceOGL::BindTexture(GLenum aTextureUnit,
+ gfx::SamplingFilter aSamplingFilter)
{
gl()->fActiveTexture(aTextureUnit);
if (!mTexture) {
gl()->fGenTextures(1, &mTexture);
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
@@ -53,17 +54,17 @@ X11TextureSourceOGL::BindTexture(GLenum
} else {
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
if (mUpdated) {
gl::sGLXLibrary.UpdateTexImage(mSurface->XDisplay(), mSurface->GetGLXPixmap());
mUpdated = false;
}
}
- ApplyFilterToBoundTexture(gl(), aFilter, LOCAL_GL_TEXTURE_2D);
+ ApplySamplingFilterToBoundTexture(gl(), aSamplingFilter, LOCAL_GL_TEXTURE_2D);
}
IntSize
X11TextureSourceOGL::GetSize() const
{
return mSurface->GetSize();
}
--- a/gfx/layers/opengl/X11TextureSourceOGL.h
+++ b/gfx/layers/opengl/X11TextureSourceOGL.h
@@ -24,17 +24,17 @@ class X11TextureSourceOGL
public:
X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface);
~X11TextureSourceOGL();
virtual X11TextureSourceOGL* AsSourceOGL() override { return this; }
virtual bool IsValid() const override { return !!gl(); } ;
- virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) override;
+ virtual void BindTexture(GLenum aTextureUnit, gfx::SamplingFilter aSamplingFilter) override;
virtual gfx::IntSize GetSize() const override;
virtual GLenum GetTextureTarget() const override { return LOCAL_GL_TEXTURE_2D; }
virtual gfx::SurfaceFormat GetFormat() const override;
virtual GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; }
--- a/gfx/thebes/gfxBlur.cpp
+++ b/gfx/thebes/gfxBlur.cpp
@@ -600,17 +600,17 @@ RepeatOrStretchSurface(DrawTarget& aDT,
// Calling FillRect on a D2D backend with a repeating pattern is much slower
// than DrawSurface, so special case the D2D backend here.
aDT.DrawSurface(aSurface, aDest, aSrc);
return;
}
SurfacePattern pattern(aSurface, ExtendMode::REPEAT,
Matrix::Translation(aDest.TopLeft() - aSrc.TopLeft()),
- Filter::GOOD, RoundedToInt(aSrc));
+ SamplingFilter::GOOD, RoundedToInt(aSrc));
aDT.FillRect(aDest, pattern);
}
static void
DrawCorner(DrawTarget& aDT, SourceSurface* aSurface,
const Rect& aDest, const Rect& aSrc, Rect& aSkipRect)
{
if (aSkipRect.Contains(aDest)) {
--- a/gfx/thebes/gfxDrawable.cpp
+++ b/gfx/thebes/gfxDrawable.cpp
@@ -31,17 +31,17 @@ gfxSurfaceDrawable::gfxSurfaceDrawable(S
bool
gfxSurfaceDrawable::DrawWithSamplingRect(DrawTarget* aDrawTarget,
CompositionOp aOp,
AntialiasMode aAntialiasMode,
const gfxRect& aFillRect,
const gfxRect& aSamplingRect,
ExtendMode aExtendMode,
- const Filter& aFilter,
+ const SamplingFilter aSamplingFilter,
gfxFloat aOpacity)
{
if (!mSourceSurface) {
return true;
}
// When drawing with CLAMP we can expand the sampling rect to the nearest pixel
// without changing the result.
@@ -50,55 +50,55 @@ gfxSurfaceDrawable::DrawWithSamplingRect
IntRect intRect(samplingRect.x, samplingRect.y, samplingRect.width, samplingRect.height);
IntSize size = mSourceSurface->GetSize();
if (!IntRect(0, 0, size.width, size.height).Contains(intRect)) {
return false;
}
DrawInternal(aDrawTarget, aOp, aAntialiasMode, aFillRect, intRect,
- ExtendMode::CLAMP, aFilter, aOpacity, gfxMatrix());
+ ExtendMode::CLAMP, aSamplingFilter, aOpacity, gfxMatrix());
return true;
}
bool
gfxSurfaceDrawable::Draw(gfxContext* aContext,
const gfxRect& aFillRect,
ExtendMode aExtendMode,
- const Filter& aFilter,
+ const SamplingFilter aSamplingFilter,
gfxFloat aOpacity,
const gfxMatrix& aTransform)
{
if (!mSourceSurface) {
return true;
}
DrawInternal(aContext->GetDrawTarget(), aContext->CurrentOp(),
aContext->CurrentAntialiasMode(), aFillRect, IntRect(),
- aExtendMode, aFilter, aOpacity, aTransform);
+ aExtendMode, aSamplingFilter, aOpacity, aTransform);
return true;
}
void
gfxSurfaceDrawable::DrawInternal(DrawTarget* aDrawTarget,
CompositionOp aOp,
AntialiasMode aAntialiasMode,
const gfxRect& aFillRect,
const IntRect& aSamplingRect,
ExtendMode aExtendMode,
- const Filter& aFilter,
+ const SamplingFilter aSamplingFilter,
gfxFloat aOpacity,
const gfxMatrix& aTransform)
{
Matrix patternTransform = ToMatrix(aTransform * mTransform);
patternTransform.Invert();
SurfacePattern pattern(mSourceSurface, aExtendMode,
- patternTransform, aFilter, aSamplingRect);
+ patternTransform, aSamplingFilter, aSamplingRect);
Rect fillRect = ToRect(aFillRect);
if (aOp == CompositionOp::OP_SOURCE && aOpacity == 1.0) {
// Emulate cairo operator source which is bound by mask!
aDrawTarget->ClearRect(fillRect);
aDrawTarget->FillRect(fillRect, pattern);
} else {
@@ -110,29 +110,30 @@ gfxSurfaceDrawable::DrawInternal(DrawTar
gfxCallbackDrawable::gfxCallbackDrawable(gfxDrawingCallback* aCallback,
const IntSize aSize)
: gfxDrawable(aSize)
, mCallback(aCallback)
{
}
already_AddRefed<gfxSurfaceDrawable>
-gfxCallbackDrawable::MakeSurfaceDrawable(const Filter aFilter)
+gfxCallbackDrawable::MakeSurfaceDrawable(const SamplingFilter aSamplingFilter)
{
SurfaceFormat format =
gfxPlatform::GetPlatform()->Optimal2DFormatForContent(gfxContentType::COLOR_ALPHA);
RefPtr<DrawTarget> dt =
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(mSize,
format);
if (!dt || !dt->IsValid())
return nullptr;
RefPtr<gfxContext> ctx = gfxContext::ForDrawTarget(dt);
MOZ_ASSERT(ctx); // already checked for target above
- Draw(ctx, gfxRect(0, 0, mSize.width, mSize.height), ExtendMode::CLAMP, aFilter);
+ Draw(ctx, gfxRect(0, 0, mSize.width, mSize.height), ExtendMode::CLAMP,
+ aSamplingFilter);
RefPtr<SourceSurface> surface = dt->Snapshot();
if (surface) {
RefPtr<gfxSurfaceDrawable> drawable = new gfxSurfaceDrawable(surface, mSize);
return drawable.forget();
}
return nullptr;
}
@@ -149,30 +150,31 @@ IsRepeatingExtendMode(ExtendMode aExtend
return false;
}
}
bool
gfxCallbackDrawable::Draw(gfxContext* aContext,
const gfxRect& aFillRect,
ExtendMode aExtendMode,
- const Filter& aFilter,
+ const SamplingFilter aSamplingFilter,
gfxFloat aOpacity,
const gfxMatrix& aTransform)
{
if ((IsRepeatingExtendMode(aExtendMode) || aOpacity != 1.0) && !mSurfaceDrawable) {
- mSurfaceDrawable = MakeSurfaceDrawable(aFilter);
+ mSurfaceDrawable = MakeSurfaceDrawable(aSamplingFilter);
}
if (mSurfaceDrawable)
- return mSurfaceDrawable->Draw(aContext, aFillRect, aExtendMode, aFilter,
+ return mSurfaceDrawable->Draw(aContext, aFillRect, aExtendMode,
+ aSamplingFilter,
aOpacity, aTransform);
if (mCallback)
- return (*mCallback)(aContext, aFillRect, aFilter, aTransform);
+ return (*mCallback)(aContext, aFillRect, aSamplingFilter, aTransform);
return false;
}
gfxPatternDrawable::gfxPatternDrawable(gfxPattern* aPattern,
const IntSize aSize)
: gfxDrawable(aSize)
, mPattern(aPattern)
@@ -189,20 +191,21 @@ public:
: mDrawable(aDrawable) {
NS_ASSERTION(aDrawable, "aDrawable is null!");
}
virtual ~DrawingCallbackFromDrawable() {}
virtual bool operator()(gfxContext* aContext,
const gfxRect& aFillRect,
- const Filter& aFilter,
+ const SamplingFilter aSamplingFilter,
const gfxMatrix& aTransform = gfxMatrix())
{
- return mDrawable->Draw(aContext, aFillRect, ExtendMode::CLAMP, aFilter, 1.0,
+ return mDrawable->Draw(aContext, aFillRect, ExtendMode::CLAMP,
+ aSamplingFilter, 1.0,
aTransform);
}
private:
RefPtr<gfxDrawable> mDrawable;
};
already_AddRefed<gfxCallbackDrawable>
gfxPatternDrawable::MakeCallbackDrawable()
@@ -213,17 +216,17 @@ gfxPatternDrawable::MakeCallbackDrawable
new gfxCallbackDrawable(callback, mSize);
return callbackDrawable.forget();
}
bool
gfxPatternDrawable::Draw(gfxContext* aContext,
const gfxRect& aFillRect,
ExtendMode aExtendMode,
- const Filter& aFilter,
+ const SamplingFilter aSamplingFilter,
gfxFloat aOpacity,
const gfxMatrix& aTransform)
{
DrawTarget& aDrawTarget = *aContext->GetDrawTarget();
if (!mPattern)
return false;
@@ -231,17 +234,18 @@ gfxPatternDrawable::Draw(gfxContext* aCo
// We can't use mPattern directly: We want our repeated tiles to have
// the size mSize, which might not be the case in mPattern.
// So we need to draw mPattern into a surface of size mSize, create
// a pattern from the surface and draw that pattern.
// gfxCallbackDrawable and gfxSurfaceDrawable already know how to do
// those things, so we use them here. Drawing mPattern into the surface
// will happen through this Draw() method with aRepeat = false.
RefPtr<gfxCallbackDrawable> callbackDrawable = MakeCallbackDrawable();
- return callbackDrawable->Draw(aContext, aFillRect, aExtendMode, aFilter,
+ return callbackDrawable->Draw(aContext, aFillRect, aExtendMode,
+ aSamplingFilter,
aOpacity, aTransform);
}
gfxMatrix oldMatrix = mPattern->GetMatrix();
mPattern->SetMatrix(aTransform * oldMatrix);
DrawOptions drawOptions(aOpacity);
aDrawTarget.FillRect(ToRect(aFillRect),
*mPattern->GetPattern(&aDrawTarget), drawOptions);
--- a/gfx/thebes/gfxDrawable.h
+++ b/gfx/thebes/gfxDrawable.h
@@ -25,36 +25,36 @@ public:
typedef mozilla::gfx::AntialiasMode AntialiasMode;
typedef mozilla::gfx::CompositionOp CompositionOp;
typedef mozilla::gfx::DrawTarget DrawTarget;
explicit gfxDrawable(const mozilla::gfx::IntSize aSize)
: mSize(aSize) {}
/**
- * Draw into aContext filling aFillRect, possibly repeating, using aFilter.
+ * Draw into aContext filling aFillRect, possibly repeating, using aSamplingFilter.
* aTransform is a userspace to "image"space matrix. For example, if Draw
* draws using a gfxPattern, this is the matrix that should be set on the
* pattern prior to rendering it.
* @return whether drawing was successful
*/
virtual bool Draw(gfxContext* aContext,
const gfxRect& aFillRect,
mozilla::gfx::ExtendMode aExtendMode,
- const mozilla::gfx::Filter& aFilter,
+ const mozilla::gfx::SamplingFilter aSamplingFilter,
gfxFloat aOpacity = 1.0,
const gfxMatrix& aTransform = gfxMatrix()) = 0;
virtual bool DrawWithSamplingRect(DrawTarget* aDrawTarget,
CompositionOp aOp,
AntialiasMode aAntialiasMode,
const gfxRect& aFillRect,
const gfxRect& aSamplingRect,
mozilla::gfx::ExtendMode aExtendMode,
- const mozilla::gfx::Filter& aFilter,
+ const mozilla::gfx::SamplingFilter aSamplingFilter,
gfxFloat aOpacity = 1.0)
{
return false;
}
virtual mozilla::gfx::IntSize Size() { return mSize; }
protected:
@@ -72,37 +72,37 @@ class gfxSurfaceDrawable : public gfxDra
public:
gfxSurfaceDrawable(mozilla::gfx::SourceSurface* aSurface, const mozilla::gfx::IntSize aSize,
const gfxMatrix aTransform = gfxMatrix());
virtual ~gfxSurfaceDrawable() {}
virtual bool Draw(gfxContext* aContext,
const gfxRect& aFillRect,
mozilla::gfx::ExtendMode aExtendMode,
- const mozilla::gfx::Filter& aFilter,
+ const mozilla::gfx::SamplingFilter aSamplingFilter,
gfxFloat aOpacity = 1.0,
const gfxMatrix& aTransform = gfxMatrix());
virtual bool DrawWithSamplingRect(DrawTarget* aDrawTarget,
CompositionOp aOp,
AntialiasMode aAntialiasMode,
const gfxRect& aFillRect,
const gfxRect& aSamplingRect,
mozilla::gfx::ExtendMode aExtendMode,
- const mozilla::gfx::Filter& aFilter,
+ const mozilla::gfx::SamplingFilter aSamplingFilter,
gfxFloat aOpacity = 1.0);
protected:
void DrawInternal(DrawTarget* aDrawTarget,
CompositionOp aOp,
AntialiasMode aAntialiasMode,
const gfxRect& aFillRect,
const mozilla::gfx::IntRect& aSamplingRect,
mozilla::gfx::ExtendMode aExtendMode,
- const mozilla::gfx::Filter& aFilter,
+ const mozilla::gfx::SamplingFilter aSamplingFilter,
gfxFloat aOpacity,
const gfxMatrix& aTransform = gfxMatrix());
RefPtr<mozilla::gfx::SourceSurface> mSourceSurface;
const gfxMatrix mTransform;
};
/**
@@ -112,47 +112,49 @@ protected:
class gfxDrawingCallback {
NS_INLINE_DECL_REFCOUNTING(gfxDrawingCallback)
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~gfxDrawingCallback() {}
public:
/**
- * Draw into aContext filling aFillRect using aFilter.
+ * Draw into aContext filling aFillRect using aSamplingFilter.
* aTransform is a userspace to "image"space matrix. For example, if Draw
* draws using a gfxPattern, this is the matrix that should be set on the
* pattern prior to rendering it.
* @return whether drawing was successful
*/
virtual bool operator()(gfxContext* aContext,
const gfxRect& aFillRect,
- const mozilla::gfx::Filter& aFilter,
+ const mozilla::gfx::SamplingFilter aSamplingFilter,
const gfxMatrix& aTransform = gfxMatrix()) = 0;
};
/**
* gfxCallbackDrawable
* A convenience implementation of gfxDrawable for callbacks.
*/
class gfxCallbackDrawable : public gfxDrawable {
public:
gfxCallbackDrawable(gfxDrawingCallback* aCallback, const mozilla::gfx::IntSize aSize);
virtual ~gfxCallbackDrawable() {}
virtual bool Draw(gfxContext* aContext,
const gfxRect& aFillRect,
mozilla::gfx::ExtendMode aExtendMode,
- const mozilla::gfx::Filter& aFilter,
+ const mozilla::gfx::SamplingFilter aSamplingFilter,
gfxFloat aOpacity = 1.0,
const gfxMatrix& aTransform = gfxMatrix());
protected:
- already_AddRefed<gfxSurfaceDrawable> MakeSurfaceDrawable(mozilla::gfx::Filter aFilter = mozilla::gfx::Filter::LINEAR);
+ already_AddRefed<gfxSurfaceDrawable>
+ MakeSurfaceDrawable(mozilla::gfx::SamplingFilter aSamplingFilter =
+ mozilla::gfx::SamplingFilter::LINEAR);
RefPtr<gfxDrawingCallback> mCallback;
RefPtr<gfxSurfaceDrawable> mSurfaceDrawable;
};
/**
* gfxPatternDrawable
* A convenience implementation of gfxDrawable for patterns.
@@ -161,17 +163,17 @@ class gfxPatternDrawable : public gfxDra
public:
gfxPatternDrawable(gfxPattern* aPattern,
const mozilla::gfx::IntSize aSize);
virtual ~gfxPatternDrawable();
virtual bool Draw(gfxContext* aContext,
const gfxRect& aFillRect,
mozilla::gfx::ExtendMode aExtendMode,
- const mozilla::gfx::Filter& aFilter,
+ const mozilla::gfx::SamplingFilter aSamplingFilter,
gfxFloat aOpacity = 1.0,
const gfxMatrix& aTransform = gfxMatrix());
protected:
already_AddRefed<gfxCallbackDrawable> MakeCallbackDrawable();
RefPtr<gfxPattern> mPattern;
--- a/gfx/thebes/gfxPattern.cpp
+++ b/gfx/thebes/gfxPattern.cpp
@@ -42,17 +42,17 @@ gfxPattern::gfxPattern(gfxFloat cx0, gfx
}
// Azure
gfxPattern::gfxPattern(SourceSurface *aSurface, const Matrix &aPatternToUserSpace)
: mPatternToUserSpace(aPatternToUserSpace)
, mExtend(ExtendMode::CLAMP)
{
mGfxPattern.InitSurfacePattern(aSurface, mExtend, Matrix(), // matrix is overridden in GetPattern()
- mozilla::gfx::Filter::GOOD);
+ mozilla::gfx::SamplingFilter::GOOD);
}
void
gfxPattern::AddColorStop(gfxFloat offset, const Color& c)
{
if (mGfxPattern.GetPattern()->GetType() != PatternType::LINEAR_GRADIENT &&
mGfxPattern.GetPattern()->GetType() != PatternType::RADIAL_GRADIENT) {
return;
@@ -177,32 +177,32 @@ gfxPattern::IsOpaque()
if (static_cast<SurfacePattern*>(mGfxPattern.GetPattern())->mSurface->GetFormat() == SurfaceFormat::B8G8R8X8) {
return true;
}
return false;
}
void
-gfxPattern::SetFilter(gfx::Filter filter)
+gfxPattern::SetSamplingFilter(gfx::SamplingFilter filter)
{
if (mGfxPattern.GetPattern()->GetType() != PatternType::SURFACE) {
return;
}
- static_cast<SurfacePattern*>(mGfxPattern.GetPattern())->mFilter = filter;
+ static_cast<SurfacePattern*>(mGfxPattern.GetPattern())->mSamplingFilter = filter;
}
-Filter
-gfxPattern::Filter() const
+SamplingFilter
+gfxPattern::SamplingFilter() const
{
if (mGfxPattern.GetPattern()->GetType() != PatternType::SURFACE) {
- return gfx::Filter::GOOD;
+ return gfx::SamplingFilter::GOOD;
}
- return static_cast<const SurfacePattern*>(mGfxPattern.GetPattern())->mFilter;
+ return static_cast<const SurfacePattern*>(mGfxPattern.GetPattern())->mSamplingFilter;
}
bool
gfxPattern::GetSolidColor(Color& aColorOut)
{
if (mGfxPattern.GetPattern()->GetType() == PatternType::COLOR) {
aColorOut = static_cast<ColorPattern*>(mGfxPattern.GetPattern())->mColor;
return true;
--- a/gfx/thebes/gfxPattern.h
+++ b/gfx/thebes/gfxPattern.h
@@ -51,18 +51,18 @@ public:
mozilla::gfx::Matrix *aOriginalUserToDevice = nullptr);
bool IsOpaque();
// clamp, repeat, reflect
void SetExtend(mozilla::gfx::ExtendMode aExtend);
int CairoStatus();
- void SetFilter(mozilla::gfx::Filter filter);
- mozilla::gfx::Filter Filter() const;
+ void SetSamplingFilter(mozilla::gfx::SamplingFilter aSamplingFilter);
+ mozilla::gfx::SamplingFilter SamplingFilter() const;
/* returns TRUE if it succeeded */
bool GetSolidColor(mozilla::gfx::Color& aColorOut);
private:
// Private destructor, to discourage deletion outside of Release():
~gfxPattern() {}
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -448,60 +448,61 @@ CreateSamplingRestrictedDrawable(gfxDraw
if (!target || !target->IsValid()) {
return nullptr;
}
RefPtr<gfxContext> tmpCtx = gfxContext::ForDrawTarget(target);
MOZ_ASSERT(tmpCtx); // already checked the target above
tmpCtx->SetOp(OptimalFillOp());
- aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), ExtendMode::REPEAT, Filter::LINEAR,
+ aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), ExtendMode::REPEAT,
+ SamplingFilter::LINEAR,
1.0, gfxMatrix::Translation(needed.TopLeft()));
RefPtr<SourceSurface> surface = target->Snapshot();
RefPtr<gfxDrawable> drawable = new gfxSurfaceDrawable(surface, size, gfxMatrix::Translation(-needed.TopLeft()));
return drawable.forget();
}
#endif // !MOZ_GFX_OPTIMIZE_MOBILE
/* These heuristics are based on Source/WebCore/platform/graphics/skia/ImageSkia.cpp:computeResamplingMode() */
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
-static Filter ReduceResamplingFilter(Filter aFilter,
- int aImgWidth, int aImgHeight,
- float aSourceWidth, float aSourceHeight)
+static SamplingFilter ReduceResamplingFilter(SamplingFilter aSamplingFilter,
+ 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).
const int kSmallImageSizeThreshold = 8;
// The amount an image can be stretched in a single direction before we
// say that it is being stretched so much that it must be a line or
// background that doesn't need resampling.
const float kLargeStretch = 3.0f;
if (aImgWidth <= kSmallImageSizeThreshold
|| aImgHeight <= kSmallImageSizeThreshold) {
// Never resample small images. These are often used for borders and
// rules (think 1x1 images used to make lines).
- return Filter::POINT;
+ return SamplingFilter::POINT;
}
if (aImgHeight * kLargeStretch <= aSourceHeight || aImgWidth * kLargeStretch <= aSourceWidth) {
// Large image tiling detected.
// Don't resample if it is being tiled a lot in only one direction.
// This is trying to catch cases where somebody has created a border
// (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 Filter::POINT;
+ return SamplingFilter::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.
- return aFilter;
+ return aSamplingFilter;
}
/* Some notes on other heuristics:
The Skia backend also uses nearest for backgrounds that are stretched by
a large amount. I'm not sure this is common enough for us to worry about
now. It also uses nearest for backgrounds/avoids high quality for images
that are very slightly scaled. I'm also not sure that very slightly
scaled backgrounds are common enough us to worry about.
@@ -512,25 +513,25 @@ static Filter ReduceResamplingFilter(Fil
resampling during load. It also avoids high quality if the transformation
is not just a scale and translation
WebKit bug #40045 added code to avoid resampling different parts
of an image with different methods by using a resampling hint size.
It currently looks unused in WebKit but it's something to watch out for.
*/
- return aFilter;
+ return aSamplingFilter;
}
#else
-static Filter ReduceResamplingFilter(Filter aFilter,
- int aImgWidth, int aImgHeight,
- int aSourceWidth, int aSourceHeight)
+static SamplingFilter ReduceResamplingFilter(SamplingFilter aSamplingFilter,
+ int aImgWidth, int aImgHeight,
+ int aSourceWidth, int aSourceHeight)
{
// Just pass the filter through unchanged
- return aFilter;
+ return aSamplingFilter;
}
#endif
#ifdef MOZ_WIDGET_COCOA
// Only prescale a temporary surface if we're going to repeat it often.
// Scaling is expensive on OS X and without prescaling, we'd scale
// every tile of the repeated rect. However, using a temp surface also potentially uses
// more memory if the scaled image is large. So only prescale on a temp
@@ -544,17 +545,17 @@ ShouldUseTempSurface(Rect aImageRect, Re
return (repeatX >= 5) || (repeatY >= 5);
}
static bool
PrescaleAndTileDrawable(gfxDrawable* aDrawable,
gfxContext* aContext,
const ImageRegion& aRegion,
Rect aImageRect,
- const Filter& aFilter,
+ const SamplingFilter aSamplingFilter,
const SurfaceFormat aFormat,
gfxFloat aOpacity,
ExtendMode aExtendMode)
{
gfxSize scaleFactor = aContext->CurrentMatrix().ScaleFactors(true);
gfxMatrix scaleMatrix = gfxMatrix::Scaling(scaleFactor.width, scaleFactor.height);
const float fuzzFactor = 0.01;
@@ -598,83 +599,85 @@ PrescaleAndTileDrawable(gfxDrawable* aDr
return false;
}
RefPtr<gfxContext> tmpCtx = gfxContext::ForDrawTarget(scaledDT);
MOZ_ASSERT(tmpCtx); // already checked the target above
scaledDT->SetTransform(ToMatrix(scaleMatrix));
gfxRect gfxImageRect(aImageRect.x, aImageRect.y, aImageRect.width, aImageRect.height);
- aDrawable->Draw(tmpCtx, gfxImageRect, aExtendMode, aFilter, 1.0, gfxMatrix());
+ aDrawable->Draw(tmpCtx, gfxImageRect, aExtendMode, aSamplingFilter, 1.0, gfxMatrix());
RefPtr<SourceSurface> scaledImage = scaledDT->Snapshot();
{
gfxContextMatrixAutoSaveRestore autoSR(aContext);
Matrix withoutScale = ToMatrix(aContext->CurrentMatrix());
DrawTarget* destDrawTarget = aContext->GetDrawTarget();
// The translation still is in scaled units
withoutScale.PreScale(1.0 / scaleFactor.width, 1.0 / scaleFactor.height);
aContext->SetMatrix(ThebesMatrix(withoutScale));
DrawOptions drawOptions(aOpacity, aContext->CurrentOp(),
aContext->CurrentAntialiasMode());
SurfacePattern scaledImagePattern(scaledImage, aExtendMode,
- Matrix(), aFilter);
+ Matrix(), aSamplingFilter);
destDrawTarget->FillRect(scaledNeededRect, scaledImagePattern, drawOptions);
}
return true;
}
#endif // MOZ_WIDGET_COCOA
/* static */ void
gfxUtils::DrawPixelSnapped(gfxContext* aContext,
gfxDrawable* aDrawable,
const gfxSize& aImageSize,
const ImageRegion& aRegion,
const SurfaceFormat aFormat,
- Filter aFilter,
+ SamplingFilter aSamplingFilter,
uint32_t aImageFlags,
gfxFloat aOpacity)
{
PROFILER_LABEL("gfxUtils", "DrawPixelSnapped",
js::ProfileEntry::Category::GRAPHICS);
gfxRect imageRect(gfxPoint(0, 0), aImageSize);
gfxRect region(aRegion.Rect());
ExtendMode extendMode = aRegion.GetExtendMode();
RefPtr<gfxDrawable> drawable = aDrawable;
- aFilter = ReduceResamplingFilter(aFilter,
- imageRect.Width(), imageRect.Height(),
- region.Width(), region.Height());
+ aSamplingFilter =
+ ReduceResamplingFilter(aSamplingFilter,
+ imageRect.Width(), imageRect.Height(),
+ region.Width(), region.Height());
// OK now, the hard part left is to account for the subimage sampling
// restriction. If all the transforms involved are just integer
// translations, then we assume no resampling will occur so there's
// nothing to do.
// XXX if only we had source-clipping in cairo!
if (aContext->CurrentMatrix().HasNonIntegerTranslation()) {
if ((extendMode != ExtendMode::CLAMP) || !aRegion.RestrictionContains(imageRect)) {
if (drawable->DrawWithSamplingRect(aContext->GetDrawTarget(),
aContext->CurrentOp(),
aContext->CurrentAntialiasMode(),
aRegion.Rect(),
aRegion.Restriction(),
- extendMode, aFilter, aOpacity)) {
+ extendMode, aSamplingFilter,
+ aOpacity)) {
return;
}
#ifdef MOZ_WIDGET_COCOA
if (PrescaleAndTileDrawable(aDrawable, aContext, aRegion,
- ToRect(imageRect), aFilter,
+ ToRect(imageRect), aSamplingFilter,
aFormat, aOpacity, extendMode)) {
return;
}
#endif
// On Mobile, we don't ever want to do this; it has the potential for
// allocating very large temporary surfaces, especially since we'll
// do full-page snapshots often (see bug 749426).
@@ -689,17 +692,18 @@ gfxUtils::DrawPixelSnapped(gfxContext*
// filled a surface with the tiled pattern; this surface can now be
// drawn without tiling.
extendMode = ExtendMode::CLAMP;
}
#endif
}
}
- drawable->Draw(aContext, aRegion.Rect(), extendMode, aFilter, aOpacity, gfxMatrix());
+ drawable->Draw(aContext, aRegion.Rect(), extendMode, aSamplingFilter,
+ aOpacity, gfxMatrix());
}
/* static */ int
gfxUtils::ImageFormatToDepth(gfxImageFormat aFormat)
{
switch (aFormat) {
case SurfaceFormat::A8R8G8B8_UINT32:
return 32;
--- a/gfx/thebes/gfxUtils.h
+++ b/gfx/thebes/gfxUtils.h
@@ -77,17 +77,17 @@ public:
* will tweak the rects and transforms that it gets from the pixel snapping
* algorithm before passing them on to this method.
*/
static void DrawPixelSnapped(gfxContext* aContext,
gfxDrawable* aDrawable,
const gfxSize& aImageSize,
const ImageRegion& aRegion,
const mozilla::gfx::SurfaceFormat aFormat,
- mozilla::gfx::Filter aFilter,
+ mozilla::gfx::SamplingFilter aSamplingFilter,
uint32_t aImageFlags = imgIContainer::FLAG_NONE,
gfxFloat aOpacity = 1.0);
/**
* Clip aContext to the region aRegion.
*/
static void ClipToRegion(gfxContext* aContext, const nsIntRegion& aRegion);
--- a/gfx/thebes/gfxWindowsNativeDrawing.cpp
+++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp
@@ -274,19 +274,19 @@ gfxWindowsNativeDrawing::PaintToContext(
AutoRestoreTransform autoRestoreTransform(dt);
Matrix newTransform = dt->GetTransform();
newTransform.PreTranslate(ToPoint(mNativeRect.TopLeft()));
dt->SetTransform(newTransform);
Rect rect(Point(0.0, 0.0), ToSize(mNativeRect.Size()));
Matrix m = Matrix::Scaling(1.0 / mScale.width, 1.0 / mScale.height);
- Filter filter = (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING)
- ? Filter::LINEAR
- : Filter::GOOD;
+ SamplingFilter filter = (mNativeDrawFlags & DO_NEAREST_NEIGHBOR_FILTERING)
+ ? SamplingFilter::LINEAR
+ : SamplingFilter::GOOD;
SurfacePattern pat(source, ExtendMode::CLAMP, m, filter);
dt->FillRect(rect, pat);
}
mRenderState = RENDER_STATE_DONE;
} else {
NS_ERROR("Invalid RenderState in gfxWindowsNativeDrawing::PaintToContext");
}