зеркало из https://github.com/mozilla/gecko-dev.git
Bug 887916: Implement recording for MaskSurface calls. r=jrmuizel
This commit is contained in:
Родитель
2c0c0de513
Коммит
28ede182a7
|
@ -719,7 +719,7 @@ public:
|
|||
virtual void MaskSurface(const Pattern &aSource,
|
||||
SourceSurface *aMask,
|
||||
Point aOffset,
|
||||
const DrawOptions &aOptions = DrawOptions()) { MOZ_ASSERT(0); };
|
||||
const DrawOptions &aOptions = DrawOptions()) = 0;
|
||||
|
||||
/*
|
||||
* Push a clip to the DrawTarget.
|
||||
|
|
|
@ -107,6 +107,10 @@ public:
|
|||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
virtual void MaskSurface(const Pattern &aSource,
|
||||
SourceSurface *aMask,
|
||||
Point aOffset,
|
||||
const DrawOptions &aOptions = DrawOptions()) { MOZ_ASSERT(0); };
|
||||
|
||||
virtual void PushClip(const Path *aPath);
|
||||
virtual void PushClipRect(const Rect &aRect);
|
||||
|
|
|
@ -248,6 +248,16 @@ DrawTargetRecording::Mask(const Pattern &aSource,
|
|||
mFinalDT->Mask(*AdjustedPattern(aSource), *AdjustedPattern(aMask), aOptions);
|
||||
}
|
||||
|
||||
void
|
||||
DrawTargetRecording::MaskSurface(const Pattern &aSource,
|
||||
SourceSurface *aMask,
|
||||
Point aOffset,
|
||||
const DrawOptions &aOptions)
|
||||
{
|
||||
mRecorder->RecordEvent(RecordedMaskSurface(this, aSource, aMask, aOffset, aOptions));
|
||||
mFinalDT->MaskSurface(*AdjustedPattern(aSource), GetSourceSurface(aMask), aOffset, aOptions);
|
||||
}
|
||||
|
||||
void
|
||||
DrawTargetRecording::Stroke(const Path *aPath,
|
||||
const Pattern &aPattern,
|
||||
|
|
|
@ -172,6 +172,11 @@ public:
|
|||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
|
||||
virtual void MaskSurface(const Pattern &aSource,
|
||||
SourceSurface *aMask,
|
||||
Point aOffset,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
|
||||
/*
|
||||
* Push a clip to the DrawTarget.
|
||||
*
|
||||
|
|
|
@ -75,6 +75,10 @@ public:
|
|||
virtual void Mask(const Pattern &aSource,
|
||||
const Pattern &aMask,
|
||||
const DrawOptions &aOptions = DrawOptions());
|
||||
virtual void MaskSurface(const Pattern &aSource,
|
||||
SourceSurface *aMask,
|
||||
Point aOffset,
|
||||
const DrawOptions &aOptions = DrawOptions()) { MOZ_ASSERT(0); };
|
||||
virtual void PushClip(const Path *aPath);
|
||||
virtual void PushClipRect(const Rect& aRect);
|
||||
virtual void PopClip();
|
||||
|
|
|
@ -58,6 +58,7 @@ RecordedEvent::LoadEventFromStream(std::istream &aStream, EventType aType)
|
|||
LOAD_EVENT_TYPE(SNAPSHOT, RecordedSnapshot);
|
||||
LOAD_EVENT_TYPE(SCALEDFONTCREATION, RecordedScaledFontCreation);
|
||||
LOAD_EVENT_TYPE(SCALEDFONTDESTRUCTION, RecordedScaledFontDestruction);
|
||||
LOAD_EVENT_TYPE(MASKSURFACE, RecordedMaskSurface);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1216,5 +1217,40 @@ RecordedScaledFontDestruction::OutputSimpleEventInfo(stringstream &aStringStream
|
|||
aStringStream << "[" << mRefPtr << "] ScaledFont Destroyed";
|
||||
}
|
||||
|
||||
void
|
||||
RecordedMaskSurface::PlayEvent(Translator *aTranslator) const
|
||||
{
|
||||
aTranslator->LookupDrawTarget(mDT)->
|
||||
MaskSurface(*GenericPattern(mPattern, aTranslator),
|
||||
aTranslator->LookupSourceSurface(mRefMask),
|
||||
mOffset, mOptions);
|
||||
}
|
||||
|
||||
void
|
||||
RecordedMaskSurface::RecordToStream(ostream &aStream) const
|
||||
{
|
||||
RecordedDrawingEvent::RecordToStream(aStream);
|
||||
RecordPatternData(aStream, mPattern);
|
||||
WriteElement(aStream, mRefMask);
|
||||
WriteElement(aStream, mOffset);
|
||||
WriteElement(aStream, mOptions);
|
||||
}
|
||||
|
||||
RecordedMaskSurface::RecordedMaskSurface(istream &aStream)
|
||||
: RecordedDrawingEvent(MASKSURFACE, aStream)
|
||||
{
|
||||
ReadPatternData(aStream, mPattern);
|
||||
ReadElement(aStream, mRefMask);
|
||||
ReadElement(aStream, mOffset);
|
||||
ReadElement(aStream, mOptions);
|
||||
}
|
||||
|
||||
void
|
||||
RecordedMaskSurface::OutputSimpleEventInfo(stringstream &aStringStream) const
|
||||
{
|
||||
aStringStream << "[" << mDT << "] MaskSurface (" << mRefMask << ") Offset: (" << mOffset.x << "x" << mOffset.y << ") Pattern: ";
|
||||
OutputSimplePatternInfo(mPattern, aStringStream);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace gfx {
|
|||
const uint16_t kMajorRevision = 2;
|
||||
// A change in minor revision means additions of new events. New streams will
|
||||
// not play in older players.
|
||||
const uint16_t kMinorRevision = 0;
|
||||
const uint16_t kMinorRevision = 1;
|
||||
|
||||
struct ReferencePtr
|
||||
{
|
||||
|
@ -160,7 +160,8 @@ public:
|
|||
GRADIENTSTOPSDESTRUCTION,
|
||||
SNAPSHOT,
|
||||
SCALEDFONTCREATION,
|
||||
SCALEDFONTDESTRUCTION
|
||||
SCALEDFONTDESTRUCTION,
|
||||
MASKSURFACE
|
||||
};
|
||||
|
||||
virtual void PlayEvent(Translator *aTranslator) const {}
|
||||
|
@ -865,6 +866,33 @@ private:
|
|||
RecordedScaledFontDestruction(std::istream &aStream);
|
||||
};
|
||||
|
||||
class RecordedMaskSurface : public RecordedDrawingEvent {
|
||||
public:
|
||||
RecordedMaskSurface(DrawTarget *aDT, const Pattern &aPattern, ReferencePtr aRefMask,
|
||||
const Point &aOffset, const DrawOptions &aOptions)
|
||||
: RecordedDrawingEvent(MASKSURFACE, aDT), mRefMask(aRefMask), mOffset(aOffset)
|
||||
, mOptions(aOptions)
|
||||
{
|
||||
StorePattern(mPattern, aPattern);
|
||||
}
|
||||
|
||||
virtual void PlayEvent(Translator *aTranslator) const;
|
||||
|
||||
virtual void RecordToStream(std::ostream &aStream) const;
|
||||
virtual void OutputSimpleEventInfo(std::stringstream &aStringStream) const;
|
||||
|
||||
virtual std::string GetName() const { return "MaskSurface"; }
|
||||
private:
|
||||
friend class RecordedEvent;
|
||||
|
||||
RecordedMaskSurface(std::istream &aStream);
|
||||
|
||||
PatternStorage mPattern;
|
||||
ReferencePtr mRefMask;
|
||||
Point mOffset;
|
||||
DrawOptions mOptions;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче