summaryrefslogtreecommitdiffstats
path: root/gfx/thebes/gfxFontTest.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /gfx/thebes/gfxFontTest.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/thebes/gfxFontTest.h')
-rw-r--r--gfx/thebes/gfxFontTest.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/gfx/thebes/gfxFontTest.h b/gfx/thebes/gfxFontTest.h
new file mode 100644
index 000000000..fa7cbbcd2
--- /dev/null
+++ b/gfx/thebes/gfxFontTest.h
@@ -0,0 +1,84 @@
+/* -*- 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/. */
+
+#ifndef GFX_FONT_TEST_H
+#define GFX_FONT_TEST_H
+
+#include "nsString.h"
+#include "nsTArray.h"
+
+#include "cairo.h"
+
+struct gfxFontTestItem {
+ gfxFontTestItem(const nsCString& fontName,
+ cairo_glyph_t *cglyphs, int nglyphs)
+ : platformFont(fontName)
+ {
+ glyphs = new cairo_glyph_t[nglyphs];
+ memcpy (glyphs, cglyphs, sizeof(cairo_glyph_t) * nglyphs);
+ num_glyphs = nglyphs;
+ }
+
+ gfxFontTestItem(const gfxFontTestItem& other) {
+ platformFont = other.platformFont;
+ num_glyphs = other.num_glyphs;
+ glyphs = new cairo_glyph_t[num_glyphs];
+ memcpy (glyphs, other.glyphs, sizeof(cairo_glyph_t) * num_glyphs);
+ }
+
+ ~gfxFontTestItem() {
+ delete [] glyphs;
+ }
+
+ nsCString platformFont;
+ cairo_glyph_t *glyphs;
+ int num_glyphs;
+};
+
+
+class gfxFontTestStore {
+public:
+ gfxFontTestStore() { }
+
+ void AddItem (const nsCString& fontString,
+ cairo_glyph_t *cglyphs, int nglyphs)
+ {
+ items.AppendElement(gfxFontTestItem(fontString, cglyphs, nglyphs));
+ }
+
+ void AddItem (const nsString& fontString,
+ cairo_glyph_t *cglyphs, int nglyphs)
+ {
+ items.AppendElement(gfxFontTestItem(NS_ConvertUTF16toUTF8(fontString), cglyphs, nglyphs));
+ }
+
+ nsTArray<gfxFontTestItem> items;
+
+public:
+ static gfxFontTestStore *CurrentStore() {
+ return sCurrentStore;
+ }
+
+ static gfxFontTestStore *NewStore() {
+ if (sCurrentStore)
+ delete sCurrentStore;
+
+ sCurrentStore = new gfxFontTestStore;
+ return sCurrentStore;
+ }
+
+ static void DeleteStore() {
+ if (sCurrentStore)
+ delete sCurrentStore;
+
+ sCurrentStore = nullptr;
+ }
+
+protected:
+ static gfxFontTestStore *sCurrentStore;
+};
+
+
+#endif /* GFX_FONT_TEST_H */