Bug 739679 - Part 5: Remove memset for 565 surfaces. r=mwoodrow
authorBenoit Girard <b56girard@gmail.com>
Wed, 18 Apr 2012 20:40:08 -0400
changeset 95496 9924dff6dbe98bb5fff7c14a363b0a331d343bcc
parent 95495 502de391e55b5efd3bb2ab62188cca6696bcf9df
child 95497 190aa5af83987f5361a29d99027d5be9bb78e620
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwoodrow
bugs739679
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 739679 - Part 5: Remove memset for 565 surfaces. r=mwoodrow
gfx/layers/basic/BasicTiledThebesLayer.cpp
gfx/thebes/gfxReusableSurfaceWrapper.cpp
--- a/gfx/layers/basic/BasicTiledThebesLayer.cpp
+++ b/gfx/layers/basic/BasicTiledThebesLayer.cpp
@@ -74,29 +74,32 @@ BasicTiledLayerBuffer::PaintThebes(Basic
   mThebesLayer = aLayer;
   mCallback = aCallback;
   mCallbackData = aCallbackData;
 
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   long start = PR_IntervalNow();
 #endif
   if (UseSinglePaintBuffer()) {
-    SAMPLE_LABEL("BasicTiledLayerBuffer", "PaintThebesSingleBuffer");
     const nsIntRect bounds = aPaintRegion.GetBounds();
-    mSinglePaintBuffer = new gfxImageSurface(gfxIntSize(bounds.width, bounds.height), GetFormat());
-    mSinglePaintBufferOffset = nsIntPoint(bounds.x, bounds.y);
+    {
+      SAMPLE_LABEL("BasicTiledLayerBuffer", "PaintThebesSingleBufferAlloc");
+      mSinglePaintBuffer = new gfxImageSurface(gfxIntSize(bounds.width, bounds.height), GetFormat(), !aLayer->CanUseOpaqueSurface());
+      mSinglePaintBufferOffset = nsIntPoint(bounds.x, bounds.y);
+    }
     nsRefPtr<gfxContext> ctxt = new gfxContext(mSinglePaintBuffer);
     ctxt->NewPath();
     ctxt->Translate(gfxPoint(-bounds.x, -bounds.y));
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
     if (PR_IntervalNow() - start > 3) {
       printf_stderr("Slow alloc %i\n", PR_IntervalNow() - start);
     }
     start = PR_IntervalNow();
 #endif
+    SAMPLE_LABEL("BasicTiledLayerBuffer", "PaintThebesSingleBufferDraw");
     mCallback(mThebesLayer, ctxt, aPaintRegion, aPaintRegion, mCallbackData);
   }
 
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   if (PR_IntervalNow() - start > 30) {
     const nsIntRect bounds = aPaintRegion.GetBounds();
     printf_stderr("Time to draw %i: %i, %i, %i, %i\n", PR_IntervalNow() - start, bounds.x, bounds.y, bounds.width, bounds.height);
     if (aPaintRegion.IsComplex()) {
@@ -128,17 +131,17 @@ BasicTiledLayerBuffer::PaintThebes(Basic
 
 BasicTiledLayerTile
 BasicTiledLayerBuffer::ValidateTileInternal(BasicTiledLayerTile aTile,
                                             const nsIntPoint& aTileOrigin,
                                             const nsIntRect& aDirtyRect)
 {
   if (aTile == GetPlaceholderTile()) {
     gfxImageSurface* tmpTile = new gfxImageSurface(gfxIntSize(GetTileLength(), GetTileLength()),
-                                                   GetFormat());
+                                                   GetFormat(), !mThebesLayer->CanUseOpaqueSurface());
     aTile = BasicTiledLayerTile(tmpTile);
   }
 
   gfxRect drawRect(aDirtyRect.x - aTileOrigin.x, aDirtyRect.y - aTileOrigin.y,
                    aDirtyRect.width, aDirtyRect.height);
 
   // Use the gfxReusableSurfaceWrapper, which will reuse the surface
   // if the compositor no longer has a read lock, otherwise the surface
--- a/gfx/thebes/gfxReusableSurfaceWrapper.cpp
+++ b/gfx/thebes/gfxReusableSurfaceWrapper.cpp
@@ -56,17 +56,17 @@ gfxReusableSurfaceWrapper::GetWritable(g
   NS_CheckThreadSafe(_mOwningThread.GetThread(), "Only the owner thread can call GetWritable");
 
   if (mReadCount == 0) {
     *aSurface = mSurface;
     return this;
   }
 
   // Something else is reading the surface, copy it
-  gfxImageSurface* copySurface = new gfxImageSurface(mSurface->GetSize(), mSurface->Format());
+  gfxImageSurface* copySurface = new gfxImageSurface(mSurface->GetSize(), mSurface->Format(), false);
   copySurface->CopyFrom(mSurface);
   *aSurface = copySurface;
 
   // We need to create a new wrapper since this wrapper has a read only lock.
   gfxReusableSurfaceWrapper* wrapper = new gfxReusableSurfaceWrapper(copySurface);
   return wrapper;
 }