mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 950312 - Part 3: Add Layers API to see what blend modes are supported. r=roc
This commit is contained in:
parent
23232a9040
commit
898541f214
@ -802,6 +802,7 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mParentBackend);
|
||||
WriteParam(aMsg, aParam.mSupportedBlendModes.serialize());
|
||||
WriteParam(aMsg, aParam.mMaxTextureSize);
|
||||
WriteParam(aMsg, aParam.mSupportsTextureBlitting);
|
||||
WriteParam(aMsg, aParam.mSupportsPartialUploads);
|
||||
@ -809,10 +810,14 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mParentBackend) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMaxTextureSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSupportsTextureBlitting) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads);
|
||||
uint32_t supportedBlendModes = 0;
|
||||
bool result = ReadParam(aMsg, aIter, &aResult->mParentBackend) &&
|
||||
ReadParam(aMsg, aIter, &supportedBlendModes) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMaxTextureSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSupportsTextureBlitting) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads);
|
||||
aResult->mSupportedBlendModes.deserialize(supportedBlendModes);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <sys/types.h> // for int32_t
|
||||
#include "LayersTypes.h" // for LayersBackend, etc
|
||||
#include "nsXULAppAPI.h" // for GeckoProcessType, etc
|
||||
#include "mozilla/gfx/Types.h"
|
||||
#include "mozilla/EnumSet.h"
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
@ -192,6 +194,7 @@ struct TextureFactoryIdentifier
|
||||
{
|
||||
LayersBackend mParentBackend;
|
||||
GeckoProcessType mParentProcessId;
|
||||
EnumSet<gfx::CompositionOp> mSupportedBlendModes;
|
||||
int32_t mMaxTextureSize;
|
||||
bool mSupportsTextureBlitting;
|
||||
bool mSupportsPartialUploads;
|
||||
@ -203,6 +206,7 @@ struct TextureFactoryIdentifier
|
||||
bool aSupportsPartialUploads = false)
|
||||
: mParentBackend(aLayersBackend)
|
||||
, mParentProcessId(aParentProcessId)
|
||||
, mSupportedBlendModes(gfx::CompositionOp::OP_OVER)
|
||||
, mMaxTextureSize(aMaxTextureSize)
|
||||
, mSupportsTextureBlitting(aSupportsTextureBlitting)
|
||||
, mSupportsPartialUploads(aSupportsPartialUploads)
|
||||
|
@ -617,6 +617,17 @@ public:
|
||||
mRegionToClear = aRegion;
|
||||
}
|
||||
|
||||
virtual bool SupportsMixBlendModes(EnumSet<gfx::CompositionOp>& aMixBlendModes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SupportsMixBlendMode(gfx::CompositionOp aMixBlendMode)
|
||||
{
|
||||
EnumSet<gfx::CompositionOp> modes(aMixBlendMode);
|
||||
return SupportsMixBlendModes(modes);
|
||||
}
|
||||
|
||||
protected:
|
||||
nsRefPtr<Layer> mRoot;
|
||||
gfx::UserData mUserData;
|
||||
|
@ -144,6 +144,8 @@ public:
|
||||
virtual int32_t GetMaxTextureSize() const { return INT32_MAX; }
|
||||
bool CompositorMightResample() { return mCompositorMightResample; }
|
||||
|
||||
virtual bool SupportsMixBlendModes(EnumSet<gfx::CompositionOp>& aMixBlendModes) MOZ_OVERRIDE { return true; }
|
||||
|
||||
protected:
|
||||
enum TransactionPhase {
|
||||
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
|
||||
|
@ -167,6 +167,11 @@ public:
|
||||
|
||||
virtual void DidComposite();
|
||||
|
||||
virtual bool SupportsMixBlendModes(EnumSet<gfx::CompositionOp>& aMixBlendModes) MOZ_OVERRIDE
|
||||
{
|
||||
return (GetTextureFactoryIdentifier().mSupportedBlendModes & aMixBlendModes) == aMixBlendModes;
|
||||
}
|
||||
|
||||
protected:
|
||||
enum TransactionPhase {
|
||||
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
|
||||
|
@ -29,7 +29,7 @@ class EnumSet
|
||||
{ }
|
||||
|
||||
EnumSet(T aEnum)
|
||||
: mBitField(aEnum)
|
||||
: mBitField(bitFor(aEnum))
|
||||
{ }
|
||||
|
||||
EnumSet(T aEnum1, T aEnum2)
|
||||
@ -162,9 +162,17 @@ class EnumSet
|
||||
return count;
|
||||
}
|
||||
|
||||
uint32_t serialize() const {
|
||||
return mBitField;
|
||||
}
|
||||
|
||||
void deserialize(uint32_t aValue) {
|
||||
mBitField = aValue;
|
||||
}
|
||||
|
||||
private:
|
||||
static uint32_t bitFor(T aEnum) {
|
||||
uint32_t bitNumber(aEnum);
|
||||
uint32_t bitNumber = (uint32_t)aEnum;
|
||||
MOZ_ASSERT(bitNumber < 32);
|
||||
return 1U << bitNumber;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user