Bug 1019704 - Stop creating Thebes backed gfxContexts in the old gtests. r=mattwoodrow
authorJonathan Watt <jwatt@jwatt.org>
Wed, 04 Jun 2014 08:08:39 +0100
changeset 186472 b61f2deb78fa7497ead85e8e582d245ccf619a13
parent 186471 8f0e194a29430c0081ce44c046794248899ba876
child 186473 c5953a77827641fdf9c17c3e6745599cb47fce16
push id26891
push usercbook@mozilla.com
push dateWed, 04 Jun 2014 13:32:40 +0000
treeherdermozilla-central@4faf95ee3620 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1019704
milestone32.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 1019704 - Stop creating Thebes backed gfxContexts in the old gtests. r=mattwoodrow
gfx/tests/gtest/gfxFontSelectionTest.cpp
gfx/tests/gtest/gfxTextRunPerfTest.cpp
gfx/tests/gtest/gfxWordCacheTest.cpp
--- a/gfx/tests/gtest/gfxFontSelectionTest.cpp
+++ b/gfx/tests/gtest/gfxFontSelectionTest.cpp
@@ -1,29 +1,32 @@
 /* -*- 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 "gtest/gtest.h"
 
+#include "mozilla/gfx/2D.h"
+#include "mozilla/RefPtr.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsString.h"
 #include "nsDependentString.h"
 
 #include "mozilla/Preferences.h"
 
 #include "gfxContext.h"
 #include "gfxFont.h"
 #include "gfxPlatform.h"
 
 #include "gfxFontTest.h"
 
 using namespace mozilla;
+using namespace mozilla::gfx;
 
 enum {
     S_UTF8 = 0,
     S_ASCII = 1
 };
 
 class FrameTextRunCache;
 
@@ -180,22 +183,21 @@ struct TestEntry {
     nsTArray<ExpectItem> expectItems;
 };
 
 static already_AddRefed<gfxContext>
 MakeContext ()
 {
     const int size = 200;
 
-    nsRefPtr<gfxASurface> surface;
+    RefPtr<DrawTarget> drawTarget = gfxPlatform::GetPlatform()->
+        CreateOffscreenContentDrawTarget(IntSize(size, size),
+                                         SurfaceFormat::B8G8R8X8);
+    nsRefPtr<gfxContext> ctx = new gfxContext(drawTarget);
 
-    surface = gfxPlatform::GetPlatform()->
-        CreateOffscreenSurface(IntSize(size, size),
-                               gfxASurface::ContentFromFormat(gfxImageFormat::RGB24));
-    nsRefPtr<gfxContext> ctx = new gfxContext(surface);
     return ctx.forget();
 }
 
 TestEntry*
 AddTest (nsTArray<TestEntry>& testList,
          const char *utf8FamilyString,
          const gfxFontStyle& fontStyle,
          int stringType,
--- a/gfx/tests/gtest/gfxTextRunPerfTest.cpp
+++ b/gfx/tests/gtest/gfxTextRunPerfTest.cpp
@@ -1,53 +1,55 @@
 /* -*- 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 "gtest/gtest.h"
 
 #include "mozilla/ArrayUtils.h"
+#include "mozilla/gfx/2D.h"
+#include "mozilla/RefPtr.h"
 
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsString.h"
 #include "nsDependentString.h"
 
 #include "prinrval.h"
 
 #include "gfxContext.h"
 #include "gfxFont.h"
 #include "gfxPlatform.h"
 
 #include "gfxFontTest.h"
 
 using namespace mozilla;
+using namespace mozilla::gfx;
 
 struct TestEntry {
   const char* mFamilies;
   const char* mString;
 };
 
 TestEntry testList[] = {
 #include "per-word-runs.h"
 { nullptr, nullptr } // terminator
 };
 
 static already_AddRefed<gfxContext>
 MakeContext ()
 {
     const int size = 200;
 
-    nsRefPtr<gfxASurface> surface;
+    RefPtr<DrawTarget> drawTarget = gfxPlatform::GetPlatform()->
+        CreateOffscreenContentDrawTarget(IntSize(size, size),
+                                         SurfaceFormat::B8G8R8X8);
+    nsRefPtr<gfxContext> ctx = new gfxContext(drawTarget);
 
-    surface = gfxPlatform::GetPlatform()->
-        CreateOffscreenSurface(IntSize(size, size),
-                               gfxASurface::ContentFromFormat(gfxImageFormat::RGB24));
-    nsRefPtr<gfxContext> ctx = new gfxContext(surface);
     return ctx.forget();
 }
 
 const char* lastFamilies = nullptr;
 
 static void
 RunTest (TestEntry *test, gfxContext *ctx) {
     nsRefPtr<gfxFontGroup> fontGroup;
--- a/gfx/tests/gtest/gfxWordCacheTest.cpp
+++ b/gfx/tests/gtest/gfxWordCacheTest.cpp
@@ -1,29 +1,34 @@
 /* -*- 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 "gtest/gtest.h"
 
+#include "mozilla/gfx/2D.h"
+#include "mozilla/RefPtr.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsString.h"
 #include "nsDependentString.h"
 
 #include "prinrval.h"
 
 #include "gfxContext.h"
 #include "gfxFont.h"
 #include "gfxPlatform.h"
 
 #include "gfxFontTest.h"
 #include "mozilla/Attributes.h"
 
+using namespace mozilla;
+using namespace mozilla::gfx;
+
 class FrameTextRunCache;
 
 static FrameTextRunCache *gTextRuns = nullptr;
 
 /*
  * Cache textruns and expire them after 3*10 seconds of no use.
  */
 class FrameTextRunCache MOZ_FINAL : public nsExpirationTracker<gfxTextRun,3> {
@@ -73,23 +78,22 @@ MakeTextRun(const char16_t *aText, uint3
    return textRun.forget();
 }
 
 static already_AddRefed<gfxContext>
 MakeContext ()
 {
    const int size = 200;
 
-   nsRefPtr<gfxASurface> surface;
+    RefPtr<DrawTarget> drawTarget = gfxPlatform::GetPlatform()->
+        CreateOffscreenContentDrawTarget(IntSize(size, size),
+                                         SurfaceFormat::B8G8R8X8);
+    nsRefPtr<gfxContext> ctx = new gfxContext(drawTarget);
 
-   surface = gfxPlatform::GetPlatform()->
-       CreateOffscreenSurface(IntSize(size, size),
-                              gfxASurface::ContentFromFormat(gfxImageFormat::RGB24));
-   nsRefPtr<gfxContext> ctx = new gfxContext(surface);
-   return ctx.forget();
+    return ctx.forget();
 }
 
 TEST(Gfx, WordCache) {
    gTextRuns = new FrameTextRunCache();
 
    nsRefPtr<gfxContext> ctx = MakeContext();
    {
        gfxFontStyle style (mozilla::gfx::FontStyle::NORMAL,