gecko-dev/gfx/2d/FilterNodeD2D1.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

158 строки
5.5 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_GFX_FILTERNODED2D1_H_
#define MOZILLA_GFX_FILTERNODED2D1_H_
#include "2D.h"
#include "Filters.h"
#include <vector>
#include <d2d1_1.h>
#include <cguid.h>
namespace mozilla {
namespace gfx {
class FilterNodeD2D1 : public FilterNode {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeD2D1, override)
static already_AddRefed<FilterNode> Create(ID2D1DeviceContext* aDC,
FilterType aType);
FilterNodeD2D1(ID2D1Effect* aEffect, FilterType aType)
: mEffect(aEffect), mType(aType) {
InitUnmappedProperties();
}
virtual FilterBackend GetBackendType() { return FILTER_BACKEND_DIRECT2D1_1; }
virtual void SetInput(uint32_t aIndex, SourceSurface* aSurface);
virtual void SetInput(uint32_t aIndex, FilterNode* aFilter);
virtual void SetAttribute(uint32_t aIndex, uint32_t aValue);
virtual void SetAttribute(uint32_t aIndex, Float aValue);
virtual void SetAttribute(uint32_t aIndex, const Point& aValue);
virtual void SetAttribute(uint32_t aIndex, const Matrix5x4& aValue);
virtual void SetAttribute(uint32_t aIndex, const Point3D& aValue);
virtual void SetAttribute(uint32_t aIndex, const Size& aValue);
virtual void SetAttribute(uint32_t aIndex, const IntSize& aValue);
virtual void SetAttribute(uint32_t aIndex, const DeviceColor& aValue);
virtual void SetAttribute(uint32_t aIndex, const Rect& aValue);
virtual void SetAttribute(uint32_t aIndex, const IntRect& aValue);
virtual void SetAttribute(uint32_t aIndex, bool aValue);
virtual void SetAttribute(uint32_t aIndex, const Float* aValues,
uint32_t aSize);
virtual void SetAttribute(uint32_t aIndex, const IntPoint& aValue);
virtual void SetAttribute(uint32_t aIndex, const Matrix& aValue);
// Called by DrawTarget before it draws our OutputEffect, and recursively
// by the filter nodes that have this filter as one of their inputs. This
// gives us a chance to convert any input surfaces to the target format for
// the DrawTarget that we will draw to.
virtual void WillDraw(DrawTarget* aDT);
virtual ID2D1Effect* MainEffect() { return mEffect.get(); }
virtual ID2D1Effect* InputEffect() { return mEffect.get(); }
virtual ID2D1Effect* OutputEffect() { return mEffect.get(); }
protected:
friend class DrawTargetD2D1;
friend class DrawTargetD2D;
friend class FilterNodeConvolveD2D1;
void InitUnmappedProperties();
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<ID2D1Effect> mEffect;
std::vector<RefPtr<FilterNodeD2D1>> mInputFilters;
std::vector<RefPtr<SourceSurface>> mInputSurfaces;
FilterType mType;
private:
using FilterNode::SetAttribute;
using FilterNode::SetInput;
};
class FilterNodeConvolveD2D1 : public FilterNodeD2D1 {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeConvolveD2D1, override)
explicit FilterNodeConvolveD2D1(ID2D1DeviceContext* aDC);
void SetInput(uint32_t aIndex, FilterNode* aFilter) override;
void SetAttribute(uint32_t aIndex, uint32_t aValue) override;
void SetAttribute(uint32_t aIndex, const IntSize& aValue) override;
void SetAttribute(uint32_t aIndex, const IntPoint& aValue) override;
void SetAttribute(uint32_t aIndex, const IntRect& aValue) override;
ID2D1Effect* InputEffect() override;
private:
using FilterNode::SetAttribute;
using FilterNode::SetInput;
void UpdateChain();
void UpdateOffset();
void UpdateSourceRect();
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<ID2D1Effect> mExtendInputEffect;
RefPtr<ID2D1Effect> mBorderEffect;
ConvolveMatrixEdgeMode mEdgeMode;
IntPoint mTarget;
IntSize mKernelSize;
IntRect mSourceRect;
};
class FilterNodeOpacityD2D1 : public FilterNodeD2D1 {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeOpacityD2D1, override)
FilterNodeOpacityD2D1(ID2D1Effect* aEffect, FilterType aType)
: FilterNodeD2D1(aEffect, aType) {}
void SetAttribute(uint32_t aIndex, Float aValue) override;
};
class FilterNodeExtendInputAdapterD2D1 : public FilterNodeD2D1 {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodeExtendInputAdapterD2D1,
override)
FilterNodeExtendInputAdapterD2D1(ID2D1DeviceContext* aDC,
FilterNodeD2D1* aFilterNode,
FilterType aType);
ID2D1Effect* InputEffect() override { return mExtendInputEffect.get(); }
ID2D1Effect* OutputEffect() override {
return mWrappedFilterNode->OutputEffect();
}
private:
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<FilterNodeD2D1> mWrappedFilterNode;
RefPtr<ID2D1Effect> mExtendInputEffect;
};
class FilterNodePremultiplyAdapterD2D1 : public FilterNodeD2D1 {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FilterNodePremultiplyAdapterD2D1,
override)
FilterNodePremultiplyAdapterD2D1(ID2D1DeviceContext* aDC,
FilterNodeD2D1* aFilterNode,
FilterType aType);
ID2D1Effect* InputEffect() override { return mPrePremultiplyEffect.get(); }
ID2D1Effect* OutputEffect() override {
return mPostUnpremultiplyEffect.get();
}
private:
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<ID2D1Effect> mPrePremultiplyEffect;
RefPtr<ID2D1Effect> mPostUnpremultiplyEffect;
};
} // namespace gfx
} // namespace mozilla
#endif