remove some leftover code

This commit is contained in:
Vladimir Agafonkin
2014-05-27 18:19:24 +03:00
parent f75e3899b1
commit 6ab1dcbeeb
3 changed files with 8 additions and 26 deletions

View File

@@ -61,21 +61,17 @@ typedef std::vector<GlyphBox> GlyphBoxes;
struct PlacedGlyph {
explicit PlacedGlyph(const vec2<float> &tl, const vec2<float> &tr,
const vec2<float> &bl, const vec2<float> &br,
const Rect<uint16_t> &tex, uint32_t width,
uint32_t height, float angle, const GlyphBox &glyphBox)
const Rect<uint16_t> &tex, float angle, const GlyphBox &glyphBox)
: tl(tl),
tr(tr),
bl(bl),
br(br),
tex(tex),
width(width),
height(height),
angle(angle),
glyphBox(glyphBox) {}
vec2<float> tl, tr, bl, br;
Rect<uint16_t> tex;
uint32_t width, height;
float angle;
GlyphBox glyphBox;
};

View File

@@ -38,8 +38,6 @@ void TextBucket::addGlyphs(const PlacedGlyphs &glyphs, float placementZoom,
const auto &bl = glyph.bl;
const auto &br = glyph.br;
const auto &tex = glyph.tex;
const auto &width = glyph.width;
const auto &height = glyph.height;
const auto &angle = glyph.angle;
float minZoom = util::max(
@@ -78,13 +76,13 @@ void TextBucket::addGlyphs(const PlacedGlyphs &glyphs, float placementZoom,
tex.y, angle, minZoom, placementRange, maxZoom,
placementZoom);
vertexBuffer.add(glyphAnchor.x, glyphAnchor.y, tr.x, tr.y,
tex.x + width, tex.y, angle, minZoom, placementRange,
tex.x + tex.w, tex.y, angle, minZoom, placementRange,
maxZoom, placementZoom);
vertexBuffer.add(glyphAnchor.x, glyphAnchor.y, bl.x, bl.y, tex.x,
tex.y + height, angle, minZoom, placementRange,
tex.y + tex.h, angle, minZoom, placementRange,
maxZoom, placementZoom);
vertexBuffer.add(glyphAnchor.x, glyphAnchor.y, br.x, br.y,
tex.x + width, tex.y + height, angle, minZoom,
tex.x + tex.w, tex.y + tex.h, angle, minZoom,
placementRange, maxZoom, placementZoom);
// add the two triangles, referencing the four coordinates we just

View File

@@ -174,20 +174,8 @@ PlacedGlyphs getGlyphs(Anchor &anchor, float advance, const Shaping &shaping,
continue;
}
uint32_t width = glyph.metrics.width;
uint32_t height = glyph.metrics.height;
width += buffer * 2;
height += buffer * 2;
// Increase to next number divisible by 4, but at least 1.
// This is so we can scale down the texture coordinates and pack them
// into 2 bytes rather than 4 bytes.
width += (4 - width % 4);
height += (4 - height % 4);
float x =
(origin.x + placed.x + glyph.metrics.left - buffer + width / 2) *
(origin.x + placed.x + glyph.metrics.left - buffer + glyph.rect.w / 2) *
fontScale;
GlyphInstances glyphInstances;
@@ -204,8 +192,8 @@ PlacedGlyphs getGlyphs(Anchor &anchor, float advance, const Shaping &shaping,
const float x1 = origin.x + placed.x + glyph.metrics.left - buffer;
const float y1 = origin.y + placed.y - glyph.metrics.top - buffer;
const float x2 = x1 + width;
const float y2 = y1 + height;
const float x2 = x1 + glyph.rect.w;
const float y2 = y1 + glyph.rect.h;
const vec2<float> otl{x1, y1};
const vec2<float> otr{x2, y1};
@@ -249,7 +237,7 @@ PlacedGlyphs getGlyphs(Anchor &anchor, float advance, const Shaping &shaping,
// Remember the glyph for later insertion.
glyphs.emplace_back(PlacedGlyph{
tl, tr, bl, br, glyph.rect, width, height,
tl, tr, bl, br, glyph.rect,
static_cast<float>(
std::fmod((anchor.angle + rotate + instance.offset + 2 * M_PI),
(2 * M_PI))),