Browse Source

Merge branch 'master' into compatibility

Vladimír Vondruš 13 years ago
parent
commit
ba675e4fac
  1. 2
      src/MeshTools/Interleave.h
  2. 3
      src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp
  3. 10
      src/Text/GlyphCache.cpp
  4. 2
      src/Text/GlyphCache.h

2
src/MeshTools/Interleave.h

@ -66,7 +66,7 @@ class Interleave {
std::tie(std::ignore, std::ignore, data) = operator()(attributes...);
mesh.setVertexCount(_attributeCount);
buffer.setData({data, _attributeCount*_stride}, usage);
buffer.setData(data, usage);
}
/* Specialization for only one attribute array */

3
src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp

@ -107,8 +107,7 @@ std::vector<std::pair<std::string, Containers::Array<unsigned char>>> MagnumFont
Utility::ConfigurationGroup* group = configuration.addGroup("glyph");
group->setValue("advance", font.glyphAdvance(oldGlyphId));
group->setValue("position", glyph.first+cache.padding());
group->setValue("rectangle", Range2Di(glyph.second.bottomLeft()+cache.padding(),
glyph.second.topRight()-cache.padding()));
group->setValue("rectangle", glyph.second.padded(-cache.padding()));
}
std::ostringstream confOut;

10
src/Text/GlyphCache.cpp

@ -87,16 +87,14 @@ std::vector<Range2Di> GlyphCache::reserve(const std::vector<Vector2i>& sizes) {
return TextureTools::atlas(_size, sizes, _padding);
}
void GlyphCache::insert(const UnsignedInt glyph, Vector2i position, Range2Di rectangle) {
position -= _padding;
rectangle.bottomLeft() -= _padding;
rectangle.topRight() += _padding;
void GlyphCache::insert(const UnsignedInt glyph, const Vector2i& position, const Range2Di& rectangle) {
const std::pair<Vector2i, Range2Di> glyphData = {position-_padding, rectangle.padded(_padding)};
/* Overwriting "Not Found" glyph */
if(glyph == 0) glyphs[0] = {position, rectangle};
if(glyph == 0) glyphs[0] = glyphData;
/* Inserting new glyph */
else CORRADE_INTERNAL_ASSERT_OUTPUT(glyphs.insert({glyph, {position, rectangle}}).second);
else CORRADE_INTERNAL_ASSERT_OUTPUT(glyphs.insert({glyph, glyphData}).second);
}
void GlyphCache::setImage(const Vector2i& offset, const ImageReference2D& image) {

2
src/Text/GlyphCache.h

@ -176,7 +176,7 @@ class MAGNUM_TEXT_EXPORT GlyphCache {
* See also @ref setImage() to upload glyph image.
* @see @ref padding()
*/
void insert(UnsignedInt glyph, Vector2i position, Range2Di rectangle);
void insert(UnsignedInt glyph, const Vector2i& position, const Range2Di& rectangle);
/**
* @brief Set cache image

Loading…
Cancel
Save