Bug 811850: Fix gfx 2d recording to be 64-bit neutral. r=jrmuizel

This commit is contained in:
Bas Schouten 2012-11-14 20:55:02 +00:00
parent fb108fc4cc
commit c90c33f2b7
3 changed files with 31 additions and 10 deletions

View File

@ -181,7 +181,15 @@ RecordedEvent::StorePattern(PatternStorage &aDestination, const Pattern &aSource
void
RecordedEvent::RecordStrokeOptions(std::ostream &aStream, const StrokeOptions &aStrokeOptions) const
{
WriteElement(aStream, aStrokeOptions);
JoinStyle joinStyle = aStrokeOptions.mLineJoin;
CapStyle capStyle = aStrokeOptions.mLineCap;
WriteElement(aStream, uint64_t(aStrokeOptions.mDashLength));
WriteElement(aStream, aStrokeOptions.mDashOffset);
WriteElement(aStream, aStrokeOptions.mLineWidth);
WriteElement(aStream, aStrokeOptions.mMiterLimit);
WriteElement(aStream, joinStyle);
WriteElement(aStream, capStyle);
if (!aStrokeOptions.mDashPattern) {
return;
@ -193,7 +201,19 @@ RecordedEvent::RecordStrokeOptions(std::ostream &aStream, const StrokeOptions &a
void
RecordedEvent::ReadStrokeOptions(std::istream &aStream, StrokeOptions &aStrokeOptions)
{
ReadElement(aStream, aStrokeOptions);
uint64_t dashLength;
JoinStyle joinStyle;
CapStyle capStyle;
ReadElement(aStream, dashLength);
ReadElement(aStream, aStrokeOptions.mDashOffset);
ReadElement(aStream, aStrokeOptions.mLineWidth);
ReadElement(aStream, aStrokeOptions.mMiterLimit);
ReadElement(aStream, joinStyle);
ReadElement(aStream, capStyle);
aStrokeOptions.mDashLength = dashLength;
aStrokeOptions.mLineJoin = joinStyle;
aStrokeOptions.mLineCap = capStyle;
if (!aStrokeOptions.mDashLength) {
return;
@ -887,7 +907,7 @@ void
RecordedPathCreation::RecordToStream(ostream &aStream) const
{
WriteElement(aStream, mRefPtr);
WriteElement(aStream, mPathOps.size());
WriteElement(aStream, uint64_t(mPathOps.size()));
WriteElement(aStream, mFillRule);
typedef std::vector<PathOp> pathOpVec;
for (pathOpVec::const_iterator iter = mPathOps.begin(); iter != mPathOps.end(); iter++) {
@ -908,13 +928,13 @@ RecordedPathCreation::RecordToStream(ostream &aStream) const
RecordedPathCreation::RecordedPathCreation(istream &aStream)
: RecordedEvent(PATHCREATION)
{
size_t size;
uint64_t size;
ReadElement(aStream, mRefPtr);
ReadElement(aStream, size);
ReadElement(aStream, mFillRule);
for (size_t i = 0; i < size; i++) {
for (uint64_t i = 0; i < size; i++) {
PathOp newPathOp;
ReadElement(aStream, newPathOp.mType);
if (sPointCount[newPathOp.mType] >= 1) {

View File

@ -20,7 +20,7 @@ namespace gfx {
// loss of backwards compatibility. Old streams will not work in a player
// using a newer major revision. And new streams will not work in a player
// using an older major revision.
const uint16_t kMajorRevision = 1;
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;
@ -212,7 +212,7 @@ protected:
virtual ReferencePtr GetObject() const;
DrawTarget *mDT;
ReferencePtr mDT;
};
class RecordedDrawTargetCreation : public RecordedEvent {
@ -801,7 +801,7 @@ private:
friend class RecordedEvent;
ReferencePtr mRefPtr;
DrawTarget *mDT;
ReferencePtr mDT;
RecordedSnapshot(std::istream &aStream);
};

View File

@ -42,7 +42,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>USE_SSE2;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);GFX_LOG_DEBUG;GFX_LOG_WARNING;MFBT_STAND_ALONE;XP_WIN</PreprocessorDefinitions>
<PreprocessorDefinitions>INITGUID;USE_SSE2;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);GFX_LOG_DEBUG;GFX_LOG_WARNING;MFBT_STAND_ALONE;XP_WIN</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -62,10 +62,11 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>USE_SSE2;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>INITGUID;USE_SSE2;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>./</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>