Bug 1025491 - Remove the DumpAsPNG() code in FilterNodeSoftware.cpp. r=mstange
authorJonathan Watt <jwatt@jwatt.org>
Sun, 15 Jun 2014 01:34:01 +0100
changeset 188764 57f27c0396615eddf44fad520706ce5078ea2e0f
parent 188763 82418d47c4979d4089f1eeefb99b852fd1aaa792
child 188765 53e5f619cb62cdea1abe5f45d360e951346a89d3
push id44911
push userjwatt@jwatt.org
push dateSun, 15 Jun 2014 00:34:28 +0000
treeherdermozilla-inbound@57f27c039661 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1025491
milestone33.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 1025491 - Remove the DumpAsPNG() code in FilterNodeSoftware.cpp. r=mstange
gfx/2d/FilterNodeSoftware.cpp
gfx/thebes/gfxASurface.cpp
gfx/thebes/gfxASurface.h
gfx/thebes/gfxUtils.cpp
widget/gonk/nsWindow.cpp
--- a/gfx/2d/FilterNodeSoftware.cpp
+++ b/gfx/2d/FilterNodeSoftware.cpp
@@ -14,32 +14,17 @@
 #include <map>
 #include "FilterProcessing.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/DebugOnly.h"
 
 // #define DEBUG_DUMP_SURFACES
 
 #ifdef DEBUG_DUMP_SURFACES
-#include "gfxImageSurface.h"
-namespace mozilla {
-namespace gfx {
-static void
-DumpAsPNG(SourceSurface* aSurface)
-{
-  RefPtr<DataSourceSurface> dataSource = aSurface->GetDataSurface();
-  IntSize size = dataSource->GetSize();
-  nsRefPtr<gfxImageSurface> imageSurface =
-    new gfxImageSurface(dataSource->GetData(), gfxIntSize(size.width, size.height),
-                        dataSource->Stride(),
-                        aSurface->GetFormat() == SurfaceFormat::A8 ? gfxImageFormat::A8 : gfxImageFormat::ARGB32);
-  imageSurface->PrintAsDataURL();
-}
-} // namespace gfx
-} // namespace mozilla
+#include "gfxUtils.h" // not part of Moz2D
 #endif
 
 namespace mozilla {
 namespace gfx {
 
 namespace {
 
 /**
@@ -667,17 +652,17 @@ FilterNodeSoftware::Draw(DrawTarget* aDr
     printf("output returned null\n");
     printf("</pre>\n");
 #endif
     return;
   }
 
 #ifdef DEBUG_DUMP_SURFACES
   printf("output from %s:\n", GetName());
-  printf("<img src='"); DumpAsPNG(result); printf("'>\n");
+  printf("<img src='"); gfxUtils::DumpAsDataURL(result); printf("'>\n");
   printf("</pre>\n");
 #endif
 
   Point sourceToDestOffset = aDestPoint - aSourceRect.TopLeft();
   Rect renderedSourceRect = Rect(outputRect).Intersect(aSourceRect);
   Rect renderedDestRect = renderedSourceRect + sourceToDestOffset;
   if (result->GetFormat() == SurfaceFormat::A8) {
     // Interpret the result as having implicitly black color channels.
@@ -847,17 +832,17 @@ FilterNodeSoftware::GetInputDataSourceSu
 
   SurfaceFormat currentFormat = result->GetFormat();
   if (DesiredFormat(currentFormat, aFormatHint) == SurfaceFormat::B8G8R8A8 &&
       currentFormat != SurfaceFormat::B8G8R8A8) {
     result = FilterProcessing::ConvertToB8G8R8A8(result);
   }
 
 #ifdef DEBUG_DUMP_SURFACES
-  printf("<img src='"); DumpAsPNG(result); printf("'></section>");
+  printf("<img src='"); gfxUtils::DumpAsDataURL(result); printf("'></section>");
 #endif
 
   MOZ_ASSERT(!result || result->GetSize() == aRect.Size(), "wrong surface size");
 
   return result.forget();
 }
 
 IntRect
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -695,23 +695,16 @@ gfxASurface::WriteAsPNG(const char* aFil
 
 void
 gfxASurface::DumpAsDataURL(FILE* aOutput)
 {
   WriteAsPNG_internal(aOutput, false);
 }
 
 void
-gfxASurface::PrintAsDataURL()
-{
-  WriteAsPNG_internal(stdout, false);
-  fprintf(stdout, "\n");
-}
-
-void
 gfxASurface::CopyAsDataURL()
 {
   WriteAsPNG_internal(nullptr, false);
 }
 
 /**
  * Write to a PNG file. If aBinary is true, then it is written
  * as binary, otherwise as a data URL. If no file is specified then
--- a/gfx/thebes/gfxASurface.h
+++ b/gfx/thebes/gfxASurface.h
@@ -185,21 +185,16 @@ public:
     void WriteAsPNG(const char* aFile);
 
     /**
      * Write as a PNG encoded Data URL to a file.
      */
     void DumpAsDataURL(FILE* aOutput = stdout);
 
     /**
-     * Write as a PNG encoded Data URL to stdout.
-     */
-    void PrintAsDataURL();
-
-    /**
      * Copy a PNG encoded Data URL to the clipboard.
      */
     void CopyAsDataURL();
 
     void WriteAsPNG_internal(FILE* aFile, bool aBinary);
 
     void SetOpaqueRect(const gfxRect& aRect);
 
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gfxUtils.h"
 #include "gfxContext.h"
+#include "gfxImageSurface.h"
 #include "gfxPlatform.h"
 #include "gfxDrawable.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "nsRegion.h"
 #include "yuv_convert.h"
 #include "ycbcr_to_rgb565.h"
 #include "GeckoProfiler.h"
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -21,16 +21,17 @@
 
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/Hal.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/FileUtils.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "Framebuffer.h"
 #include "gfxContext.h"
+#include "gfxImageSurface.h"
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "GLContextProvider.h"
 #include "GLContext.h"
 #include "nsAutoPtr.h"
 #include "nsAppShell.h"
 #include "nsIdleService.h"
 #include "nsScreenManagerGonk.h"