Bug 1316783: Record mSamplingRect for PatternType::SURFACE when using DrawTargetRecording. r=mstange
authorBob Owen <bobowencode@gmail.com>
Tue, 15 Nov 2016 11:09:51 +0000
changeset 322743 0e267219153db4d3f3eb10e78bd9f736ebc87166
parent 322742 5beca58068058e2531b1e50a38c000e5db44f0da
child 322744 8e124e64cef2554db60cc5cbfa1e7bc303efe627
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersmstange
bugs1316783
milestone53.0a1
Bug 1316783: Record mSamplingRect for PatternType::SURFACE when using DrawTargetRecording. r=mstange MozReview-Commit-ID: 8JWzW2cOSXK
gfx/2d/DrawTargetRecording.cpp
gfx/2d/RecordedEvent.cpp
gfx/2d/RecordedEvent.h
--- a/gfx/2d/DrawTargetRecording.cpp
+++ b/gfx/2d/DrawTargetRecording.cpp
@@ -240,17 +240,18 @@ struct AdjustedPattern
     case PatternType::COLOR:
       return mOrigPattern;
     case PatternType::SURFACE:
       {
         SurfacePattern *surfPat = static_cast<SurfacePattern*>(mOrigPattern);
         mPattern =
           new (mSurfPat) SurfacePattern(GetSourceSurface(surfPat->mSurface),
                                         surfPat->mExtendMode, surfPat->mMatrix,
-                                        surfPat->mSamplingFilter);
+                                        surfPat->mSamplingFilter,
+                                        surfPat->mSamplingRect);
         return mPattern;
       }
     case PatternType::LINEAR_GRADIENT:
       {
         LinearGradientPattern *linGradPat = static_cast<LinearGradientPattern*>(mOrigPattern);
         mPattern =
           new (mLinGradPat) LinearGradientPattern(linGradPat->mBegin, linGradPat->mEnd,
                                                   GetGradientStops(linGradPat->mStops),
--- a/gfx/2d/RecordedEvent.cpp
+++ b/gfx/2d/RecordedEvent.cpp
@@ -277,16 +277,17 @@ RecordedEvent::StorePattern(PatternStora
       SurfacePatternStorage *store =
         reinterpret_cast<SurfacePatternStorage*>(&aDestination.mStorage);
       const SurfacePattern *pat =
         static_cast<const SurfacePattern*>(&aSource);
       store->mExtend = pat->mExtendMode;
       store->mSamplingFilter = pat->mSamplingFilter;
       store->mMatrix = pat->mMatrix;
       store->mSurface = pat->mSurface;
+      store->mSamplingRect = pat->mSamplingRect;
       return;
     }
   }
 }
 
 void
 RecordedEvent::RecordStrokeOptions(std::ostream &aStream, const StrokeOptions &aStrokeOptions) const
 {
@@ -546,17 +547,18 @@ struct GenericPattern
     case PatternType::COLOR:
       return new (mColPat) ColorPattern(reinterpret_cast<ColorPatternStorage*>(&mStorage->mStorage)->mColor);
     case PatternType::SURFACE:
       {
         SurfacePatternStorage *storage = reinterpret_cast<SurfacePatternStorage*>(&mStorage->mStorage);
         mPattern =
           new (mSurfPat) SurfacePattern(mTranslator->LookupSourceSurface(storage->mSurface),
                                         storage->mExtend, storage->mMatrix,
-                                        storage->mSamplingFilter);
+                                        storage->mSamplingFilter,
+                                        storage->mSamplingRect);
         return mPattern;
       }
     case PatternType::LINEAR_GRADIENT:
       {
         LinearGradientPatternStorage *storage = reinterpret_cast<LinearGradientPatternStorage*>(&mStorage->mStorage);
         mPattern =
           new (mLinGradPat) LinearGradientPattern(storage->mBegin, storage->mEnd,
                                                   mTranslator->LookupGradientStops(storage->mStops),
--- a/gfx/2d/RecordedEvent.h
+++ b/gfx/2d/RecordedEvent.h
@@ -19,20 +19,20 @@ struct PathOp;
 class PathRecording;
 
 const uint32_t kMagicInt = 0xc001feed;
 
 // A change in major revision means a change in event binary format, causing
 // 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 = 4;
+const uint16_t kMajorRevision = 5;
 // A change in minor revision means additions of new events. New streams will
 // not play in older players.
-const uint16_t kMinorRevision = 1;
+const uint16_t kMinorRevision = 0;
 
 struct ReferencePtr
 {
   ReferencePtr()
     : mLongPtr(0)
   {}
 
   MOZ_IMPLICIT ReferencePtr(const void* aLongPtr)
@@ -136,16 +136,17 @@ struct RadialGradientPatternStorage
 };
 
 struct SurfacePatternStorage
 {
   ExtendMode mExtend;
   SamplingFilter mSamplingFilter;
   ReferencePtr mSurface;
   Matrix mMatrix;
+  IntRect mSamplingRect;
 };
 
 struct PatternStorage
 {
   PatternType mType;
   union {
     char *mStorage;
     char mColor[sizeof(ColorPatternStorage)];