Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1616)

Unified Diff: Source/platform/fonts/GlyphBuffer.h

Issue 327243005: Remove GlyphBufferAdvance abstraction. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase again Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/fonts/WidthIterator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/GlyphBuffer.h
diff --git a/Source/platform/fonts/GlyphBuffer.h b/Source/platform/fonts/GlyphBuffer.h
index c7eba85abe69bb4fa57f80c7d18b4b1b16dc9e86..5e33a10d516ffb8e4c74dfc41f4cb23eb5926ec3 100644
--- a/Source/platform/fonts/GlyphBuffer.h
+++ b/Source/platform/fonts/GlyphBuffer.h
@@ -34,31 +34,10 @@
#include "platform/geometry/FloatSize.h"
#include "wtf/Vector.h"
-#if OS(MACOSX)
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-
namespace WebCore {
class SimpleFontData;
-// CG uses CGSize instead of FloatSize so that the result of advances()
-// can be passed directly to CGContextShowGlyphsWithAdvances in FontMac.mm
-#if OS(MACOSX)
-struct GlyphBufferAdvance : CGSize {
-public:
- GlyphBufferAdvance(CGSize size) : CGSize(size)
- {
- }
-
- void setWidth(CGFloat width) { this->CGSize::width = width; }
- CGFloat width() const { return this->CGSize::width; }
- CGFloat height() const { return this->CGSize::height; }
-};
-#else
-typedef FloatSize GlyphBufferAdvance;
-#endif
-
class GlyphBuffer {
public:
bool isEmpty() const { return m_fontData.isEmpty(); }
@@ -72,9 +51,9 @@ public:
}
Glyph* glyphs(unsigned from) { return m_glyphs.data() + from; }
- GlyphBufferAdvance* advances(unsigned from) { return m_advances.data() + from; }
+ FloatSize* advances(unsigned from) { return m_advances.data() + from; }
const Glyph* glyphs(unsigned from) const { return m_glyphs.data() + from; }
- const GlyphBufferAdvance* advances(unsigned from) const { return m_advances.data() + from; }
+ const FloatSize* advances(unsigned from) const { return m_advances.data() + from; }
const SimpleFontData* fontDataAt(unsigned index) const { return m_fontData[index]; }
@@ -85,27 +64,15 @@ public:
FloatSize advanceAt(unsigned index) const
{
-#if OS(MACOSX)
- return FloatSize(m_advances[index]);
-#else
- return m_advances[index];
-#endif
+ return m_advances[index];
}
void add(Glyph glyph, const SimpleFontData* font, float width)
{
- m_fontData.append(font);
- m_glyphs.append(glyph);
-
-#if OS(MACOSX)
- CGSize advance = { width, 0 };
- m_advances.append(advance);
-#else
- m_advances.append(FloatSize(width, 0));
-#endif
+ add(glyph, font, FloatSize(width, 0));
}
- void add(Glyph glyph, const SimpleFontData* font, GlyphBufferAdvance advance)
+ void add(Glyph glyph, const SimpleFontData* font, const FloatSize& advance)
{
m_fontData.append(font);
m_glyphs.append(glyph);
@@ -121,7 +88,7 @@ public:
void expandLastAdvance(float width)
{
ASSERT(!isEmpty());
- GlyphBufferAdvance& lastAdvance = m_advances.last();
+ FloatSize& lastAdvance = m_advances.last();
lastAdvance.setWidth(lastAdvance.width() + width);
}
@@ -136,14 +103,14 @@ private:
m_glyphs[index1] = m_glyphs[index2];
m_glyphs[index2] = g;
- GlyphBufferAdvance s = m_advances[index1];
+ FloatSize s = m_advances[index1];
m_advances[index1] = m_advances[index2];
m_advances[index2] = s;
}
Vector<const SimpleFontData*, 2048> m_fontData;
Vector<Glyph, 2048> m_glyphs;
- Vector<GlyphBufferAdvance, 2048> m_advances;
+ Vector<FloatSize, 2048> m_advances;
};
}
« no previous file with comments | « no previous file | Source/platform/fonts/WidthIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698