summaryrefslogtreecommitdiffstats
path: root/gfx/thebes
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/thebes')
-rw-r--r--gfx/thebes/DeviceManagerDx.cpp1
-rw-r--r--gfx/thebes/DeviceManagerDx.h1
-rw-r--r--gfx/thebes/gfxDWriteFontList.cpp1
-rw-r--r--gfx/thebes/gfxFont-Impl.h83
-rw-r--r--gfx/thebes/gfxFont.cpp71
-rw-r--r--gfx/thebes/gfxFontEntry.cpp1
-rw-r--r--gfx/thebes/gfxFontInfoLoader.cpp4
-rw-r--r--gfx/thebes/gfxHarfBuzzShaper.h2
-rw-r--r--gfx/thebes/gfxMathTable.cpp1
-rw-r--r--gfx/thebes/gfxMatrix.cpp2
-rw-r--r--gfx/thebes/gfxPattern.cpp1
-rw-r--r--gfx/thebes/gfxSVGGlyphs.cpp1
-rw-r--r--gfx/thebes/gfxScriptItemizer.cpp2
-rw-r--r--gfx/thebes/gfxSkipChars.cpp1
-rw-r--r--gfx/thebes/gfxTextRun.cpp2
-rw-r--r--gfx/thebes/gfxTextRun.h1
-rw-r--r--gfx/thebes/moz.build32
17 files changed, 121 insertions, 86 deletions
diff --git a/gfx/thebes/DeviceManagerDx.cpp b/gfx/thebes/DeviceManagerDx.cpp
index 9f42974c3..5f505f88b 100644
--- a/gfx/thebes/DeviceManagerDx.cpp
+++ b/gfx/thebes/DeviceManagerDx.cpp
@@ -15,7 +15,6 @@
#include "mozilla/gfx/Logging.h"
#include "mozilla/layers/CompositorThread.h"
#include "nsIGfxInfo.h"
-#include <d3d11.h>
#include <ddraw.h>
namespace mozilla {
diff --git a/gfx/thebes/DeviceManagerDx.h b/gfx/thebes/DeviceManagerDx.h
index e29ab0731..25c028b55 100644
--- a/gfx/thebes/DeviceManagerDx.h
+++ b/gfx/thebes/DeviceManagerDx.h
@@ -20,6 +20,7 @@
#include <objbase.h>
#include <dxgi.h>
+#include <d3d11.h>
// This header is available in the June 2010 SDK and in the Win8 SDK
#include <d3dcommon.h>
diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp
index 5cc1fbb92..12e2d8adc 100644
--- a/gfx/thebes/gfxDWriteFontList.cpp
+++ b/gfx/thebes/gfxDWriteFontList.cpp
@@ -18,6 +18,7 @@
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsISimpleEnumerator.h"
+#include "GeckoProfiler.h"
#include "gfxGDIFontList.h"
diff --git a/gfx/thebes/gfxFont-Impl.h b/gfx/thebes/gfxFont-Impl.h
new file mode 100644
index 000000000..2661d1f40
--- /dev/null
+++ b/gfx/thebes/gfxFont-Impl.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; 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/. */
+
+#ifndef GFX_FONT_IMPL_H
+#define GFX_FONT_IMPL_H
+
+#include "mozilla/DebugOnly.h"
+using mozilla::DebugOnly;
+
+#ifdef __GNUC__
+#define GFX_MAYBE_UNUSED __attribute__((unused))
+#else
+#define GFX_MAYBE_UNUSED
+#endif
+
+template<typename T>
+gfxShapedWord*
+gfxFont::GetShapedWord(DrawTarget *aDrawTarget,
+ const T *aText,
+ uint32_t aLength,
+ uint32_t aHash,
+ Script aRunScript,
+ bool aVertical,
+ int32_t aAppUnitsPerDevUnit,
+ uint32_t aFlags,
+ gfxTextPerfMetrics *aTextPerf GFX_MAYBE_UNUSED)
+{
+ // if the cache is getting too big, flush it and start over
+ uint32_t wordCacheMaxEntries =
+ gfxPlatform::GetPlatform()->WordCacheMaxEntries();
+ if (mWordCache->Count() > wordCacheMaxEntries) {
+ NS_WARNING("flushing shaped-word cache");
+ ClearCachedWords();
+ }
+
+ // if there's a cached entry for this word, just return it
+ CacheHashKey key(aText, aLength, aHash,
+ aRunScript,
+ aAppUnitsPerDevUnit,
+ aFlags);
+
+ CacheHashEntry *entry = mWordCache->PutEntry(key);
+ if (!entry) {
+ NS_WARNING("failed to create word cache entry - expect missing text");
+ return nullptr;
+ }
+ gfxShapedWord* sw = entry->mShapedWord.get();
+
+ if (sw) {
+ sw->ResetAge();
+#ifndef RELEASE_OR_BETA
+ if (aTextPerf) {
+ aTextPerf->current.wordCacheHit++;
+ }
+#endif
+ return sw;
+ }
+
+#ifndef RELEASE_OR_BETA
+ if (aTextPerf) {
+ aTextPerf->current.wordCacheMiss++;
+ }
+#endif
+
+ sw = gfxShapedWord::Create(aText, aLength, aRunScript, aAppUnitsPerDevUnit,
+ aFlags);
+ entry->mShapedWord.reset(sw);
+ if (!sw) {
+ NS_WARNING("failed to create gfxShapedWord - expect missing text");
+ return nullptr;
+ }
+
+ DebugOnly<bool> ok =
+ ShapeText(aDrawTarget, aText, 0, aLength, aRunScript, aVertical, sw);
+
+ NS_WARNING_ASSERTION(ok, "failed to shape word - expect garbled text");
+
+ return sw;
+}
+
+#endif // GFX_FONT_IMPL_H \ No newline at end of file
diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp
index 490a866db..a73252759 100644
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxFont.h"
+#include "gfxFont-Impl.h"
#include "mozilla/BinarySearch.h"
#include "mozilla/DebugOnly.h"
@@ -44,6 +45,11 @@
#include "cairo.h"
+#ifdef XP_WIN
+#include "cairo-win32.h"
+#include "gfxWindowsPlatform.h"
+#endif
+
#include "harfbuzz/hb.h"
#include "harfbuzz/hb-ot.h"
#include "graphite2/Font.h"
@@ -2539,70 +2545,7 @@ IsBoundarySpace(char16_t aChar, char16_t aNextChar)
#define GFX_MAYBE_UNUSED
#endif
-template<typename T>
-gfxShapedWord*
-gfxFont::GetShapedWord(DrawTarget *aDrawTarget,
- const T *aText,
- uint32_t aLength,
- uint32_t aHash,
- Script aRunScript,
- bool aVertical,
- int32_t aAppUnitsPerDevUnit,
- uint32_t aFlags,
- gfxTextPerfMetrics *aTextPerf GFX_MAYBE_UNUSED)
-{
- // if the cache is getting too big, flush it and start over
- uint32_t wordCacheMaxEntries =
- gfxPlatform::GetPlatform()->WordCacheMaxEntries();
- if (mWordCache->Count() > wordCacheMaxEntries) {
- NS_WARNING("flushing shaped-word cache");
- ClearCachedWords();
- }
-
- // if there's a cached entry for this word, just return it
- CacheHashKey key(aText, aLength, aHash,
- aRunScript,
- aAppUnitsPerDevUnit,
- aFlags);
-
- CacheHashEntry *entry = mWordCache->PutEntry(key);
- if (!entry) {
- NS_WARNING("failed to create word cache entry - expect missing text");
- return nullptr;
- }
- gfxShapedWord* sw = entry->mShapedWord.get();
-
- if (sw) {
- sw->ResetAge();
-#ifndef RELEASE_OR_BETA
- if (aTextPerf) {
- aTextPerf->current.wordCacheHit++;
- }
-#endif
- return sw;
- }
-
-#ifndef RELEASE_OR_BETA
- if (aTextPerf) {
- aTextPerf->current.wordCacheMiss++;
- }
-#endif
-
- sw = gfxShapedWord::Create(aText, aLength, aRunScript, aAppUnitsPerDevUnit,
- aFlags);
- entry->mShapedWord.reset(sw);
- if (!sw) {
- NS_WARNING("failed to create gfxShapedWord - expect missing text");
- return nullptr;
- }
-
- DebugOnly<bool> ok =
- ShapeText(aDrawTarget, aText, 0, aLength, aRunScript, aVertical, sw);
-
- NS_WARNING_ASSERTION(ok, "failed to shape word - expect garbled text");
-
- return sw;
-}
+/* GetShapedWord is in gfxFont-Impl.h */
bool
gfxFont::CacheHashEntry::KeyEquals(const KeyTypePointer aKey) const
diff --git a/gfx/thebes/gfxFontEntry.cpp b/gfx/thebes/gfxFontEntry.cpp
index f33d6a9d8..695e94e9f 100644
--- a/gfx/thebes/gfxFontEntry.cpp
+++ b/gfx/thebes/gfxFontEntry.cpp
@@ -19,6 +19,7 @@
#include "gfxTypes.h"
#include "gfxContext.h"
#include "gfxFontConstants.h"
+#include "gfxGraphiteShaper.h"
#include "gfxHarfBuzzShaper.h"
#include "gfxUserFontSet.h"
#include "gfxPlatformFontList.h"
diff --git a/gfx/thebes/gfxFontInfoLoader.cpp b/gfx/thebes/gfxFontInfoLoader.cpp
index a53c96369..c9abef2ea 100644
--- a/gfx/thebes/gfxFontInfoLoader.cpp
+++ b/gfx/thebes/gfxFontInfoLoader.cpp
@@ -8,6 +8,10 @@
#include "nsIObserverService.h"
#include "nsThreadUtils.h" // for nsRunnable
#include "gfxPlatformFontList.h"
+#include "mozilla/gfx/Logging.h"
+#ifdef XP_WIN
+#include <d3d11.h>
+#endif
using namespace mozilla;
using services::GetObserverService;
diff --git a/gfx/thebes/gfxHarfBuzzShaper.h b/gfx/thebes/gfxHarfBuzzShaper.h
index 70d912cc0..b4b61159f 100644
--- a/gfx/thebes/gfxHarfBuzzShaper.h
+++ b/gfx/thebes/gfxHarfBuzzShaper.h
@@ -12,6 +12,8 @@
#include "nsUnicodeProperties.h"
#include "mozilla/gfx/2D.h"
+using namespace mozilla;
+
class gfxHarfBuzzShaper : public gfxFontShaper {
public:
explicit gfxHarfBuzzShaper(gfxFont *aFont);
diff --git a/gfx/thebes/gfxMathTable.cpp b/gfx/thebes/gfxMathTable.cpp
index f7047c747..d9f4462ff 100644
--- a/gfx/thebes/gfxMathTable.cpp
+++ b/gfx/thebes/gfxMathTable.cpp
@@ -8,6 +8,7 @@
#include "harfbuzz/hb-ot.h"
#define FixedToFloat(f) ((f) * (1.0 / 65536.0))
+#define FloatToFixed(f) (65536 * (f))
using namespace mozilla;
diff --git a/gfx/thebes/gfxMatrix.cpp b/gfx/thebes/gfxMatrix.cpp
index 8fcce4ce9..25a4d5a6f 100644
--- a/gfx/thebes/gfxMatrix.cpp
+++ b/gfx/thebes/gfxMatrix.cpp
@@ -8,6 +8,8 @@
#include "mozilla/gfx/Tools.h"
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
+using namespace mozilla::gfx;
+
#define CAIRO_MATRIX(x) reinterpret_cast<cairo_matrix_t*>((x))
#define CONST_CAIRO_MATRIX(x) reinterpret_cast<const cairo_matrix_t*>((x))
diff --git a/gfx/thebes/gfxPattern.cpp b/gfx/thebes/gfxPattern.cpp
index d937b992f..3092c8008 100644
--- a/gfx/thebes/gfxPattern.cpp
+++ b/gfx/thebes/gfxPattern.cpp
@@ -17,6 +17,7 @@
#include <vector>
+using namespace mozilla;
using namespace mozilla::gfx;
gfxPattern::gfxPattern(const Color& aColor)
diff --git a/gfx/thebes/gfxSVGGlyphs.cpp b/gfx/thebes/gfxSVGGlyphs.cpp
index 23f68f590..13c0420cc 100644
--- a/gfx/thebes/gfxSVGGlyphs.cpp
+++ b/gfx/thebes/gfxSVGGlyphs.cpp
@@ -38,6 +38,7 @@
#define UTF8_CHARSET NS_LITERAL_CSTRING("utf-8")
using namespace mozilla;
+using namespace mozilla::gfx;
typedef mozilla::dom::Element Element;
diff --git a/gfx/thebes/gfxScriptItemizer.cpp b/gfx/thebes/gfxScriptItemizer.cpp
index b9426ee6f..90e0ca98c 100644
--- a/gfx/thebes/gfxScriptItemizer.cpp
+++ b/gfx/thebes/gfxScriptItemizer.cpp
@@ -63,6 +63,8 @@
#define TOP() (parenStack[parenSP])
#define SYNC_FIXUP() (fixupCount = 0)
+using namespace mozilla::unicode;
+
void
gfxScriptItemizer::push(uint32_t endPairChar, Script newScriptCode)
{
diff --git a/gfx/thebes/gfxSkipChars.cpp b/gfx/thebes/gfxSkipChars.cpp
index d0fad53e2..0cd53c87b 100644
--- a/gfx/thebes/gfxSkipChars.cpp
+++ b/gfx/thebes/gfxSkipChars.cpp
@@ -5,6 +5,7 @@
#include "gfxSkipChars.h"
#include "mozilla/BinarySearch.h"
+#include "mozilla/gfx/Logging.h"
struct SkippedRangeStartComparator
{
diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp
index 1702cab66..2e2a0d239 100644
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -37,6 +37,8 @@
#include "cairo.h"
+#include <unicode/unorm2.h>
+
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::unicode;
diff --git a/gfx/thebes/gfxTextRun.h b/gfx/thebes/gfxTextRun.h
index c3673785c..3c9ded1dc 100644
--- a/gfx/thebes/gfxTextRun.h
+++ b/gfx/thebes/gfxTextRun.h
@@ -11,6 +11,7 @@
#include "nsString.h"
#include "gfxPoint.h"
#include "gfxFont.h"
+#include "gfxFont-Impl.h"
#include "gfxFontConstants.h"
#include "nsTArray.h"
#include "gfxSkipChars.h"
diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
index e253d7891..4201dea29 100644
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -17,6 +17,7 @@ EXPORTS += [
'gfxDrawable.h',
'gfxEnv.h',
'gfxFailure.h',
+ 'gfxFont-Impl.h',
'gfxFont.h',
'gfxFontConstants.h',
'gfxFontEntry.h',
@@ -148,11 +149,9 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'PrintTargetWindows.cpp',
]
if CONFIG['MOZ_ENABLE_DWRITE_FONT']:
- UNIFIED_SOURCES += [
- 'gfxDWriteFontList.cpp',
- ]
SOURCES += [
'gfxDWriteCommon.cpp',
+ 'gfxDWriteFontList.cpp',
'gfxDWriteFonts.cpp',
]
@@ -164,27 +163,14 @@ if CONFIG['INTEL_ARCHITECTURE']:
SOURCES['gfxAlphaRecoverySSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
SOURCES += [
- 'ContextStateTracker.cpp',
- # Includes mac system header conflicting with point/size,
- # and includes glxXlibSurface.h which drags in Xrender.h
- 'gfxASurface.cpp',
- # on X11, gfxDrawable.cpp includes X headers for an old workaround which
- # we could consider removing soon (affects Ubuntus older than 10.04 LTS)
- # which currently prevent it from joining UNIFIED_SOURCES.
- 'gfxDrawable.cpp',
- # gfxPlatform.cpp includes mac system header conflicting with point/size
- 'gfxPlatform.cpp',
- 'gfxPrefs.cpp',
- 'PrintTarget.cpp',
- 'PrintTargetThebes.cpp',
-]
-
-UNIFIED_SOURCES += [
'CJKCompatSVS.cpp',
+ 'ContextStateTracker.cpp',
'gfxAlphaRecovery.cpp',
+ 'gfxASurface.cpp',
'gfxBaseSharedMemorySurface.cpp',
'gfxBlur.cpp',
'gfxContext.cpp',
+ 'gfxDrawable.cpp',
'gfxFont.cpp',
'gfxFontEntry.cpp',
'gfxFontFeatures.cpp',
@@ -200,7 +186,9 @@ UNIFIED_SOURCES += [
'gfxMathTable.cpp',
'gfxMatrix.cpp',
'gfxPattern.cpp',
+ 'gfxPlatform.cpp',
'gfxPlatformFontList.cpp',
+ 'gfxPrefs.cpp',
'gfxRect.cpp',
'gfxScriptItemizer.cpp',
'gfxSkipChars.cpp',
@@ -209,16 +197,18 @@ UNIFIED_SOURCES += [
'gfxUserFontSet.cpp',
'gfxUtils.cpp',
'nsUnicodeRange.cpp',
+ 'PrintTarget.cpp',
+ 'PrintTargetThebes.cpp',
'SoftwareVsyncSource.cpp',
'VsyncSource.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
- UNIFIED_SOURCES += [
+ SOURCES += [
'gfxMacPlatformFontList.mm',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
- UNIFIED_SOURCES += [
+ SOURCES += [
'D3D11Checks.cpp',
'DeviceManagerDx.cpp',
]