Bug 1059033 - Part 5: Implement OptimizeSourceSurface for DrawTargetCG. r=Bas
☠☠ backed out by 21b1152c66cc ☠ ☠
authorMatt Woodrow <mwoodrow@mozilla.com>
Tue, 02 Sep 2014 12:35:32 +1200
changeset 225814 bb3885b57d4853d06e635a8364e045eaae3dc498
parent 225813 76897f52ac2cb6b5a4b86279109a7de6dea82dc9
child 225815 07b3695aa02f162db0614396a3896976f58113a4
push idunknown
push userunknown
push dateunknown
reviewersBas
bugs1059033
milestone34.0a1
Bug 1059033 - Part 5: Implement OptimizeSourceSurface for DrawTargetCG. r=Bas
gfx/2d/DrawTargetCG.cpp
--- a/gfx/2d/DrawTargetCG.cpp
+++ b/gfx/2d/DrawTargetCG.cpp
@@ -249,17 +249,22 @@ GetRetainedImageFromSourceSurface(Source
 
 TemporaryRef<SourceSurface>
 DrawTargetCG::OptimizeSourceSurface(SourceSurface *aSurface) const
 {
   if (aSurface->GetType() == SurfaceType::COREGRAPHICS_IMAGE ||
       aSurface->GetType() == SurfaceType::COREGRAPHICS_CGCONTEXT) {
     return aSurface;
   }
-  return aSurface->GetDataSurface();
+  RefPtr<DataSourceSurface> data = aSurface->GetDataSurface();
+
+  return CreateSourceSurfaceFromData(data->GetData(),
+                                     data->GetSize(),
+                                     data->Stride(),
+                                     data->GetFormat());
 }
 
 class UnboundnessFixer
 {
     CGRect mClipBounds;
     CGLayerRef mLayer;
     CGContextRef mCg;
   public: