Browse Source

python: avoid using outdated names w/o GL suffix in Text bindings.

next
Vladimír Vondruš 1 year ago
parent
commit
4a0891ad25
  1. 2
      src/python/magnum/test/test_text_gl.py
  2. 9
      src/python/magnum/text.cpp

2
src/python/magnum/test/test_text_gl.py

@ -63,7 +63,7 @@ class GlyphCacheGL(GLTestCase):
cache = text.GlyphCacheGL(PixelFormat.R8_UNORM, (128, 128)) cache = text.GlyphCacheGL(PixelFormat.R8_UNORM, (128, 128))
self.assertEqual(cache.padding, (1, 1)) self.assertEqual(cache.padding, (1, 1))
class DistanceFieldGlyphCache(GLTestCase): class DistanceFieldGlyphCacheGL(GLTestCase):
def test(self): def test(self):
cache = text.DistanceFieldGlyphCacheGL((1024, 1024), (128, 128), 2) cache = text.DistanceFieldGlyphCacheGL((1024, 1024), (128, 128), 2)

9
src/python/magnum/text.cpp

@ -91,8 +91,7 @@ void text(py::module_& m) {
#endif #endif
/* Glyph caches */ /* Glyph caches */
py::class_<Text::AbstractGlyphCache> abstractGlyphCache{m, "AbstractGlyphCache", "Base for glyph caches"}; py::class_<Text::AbstractGlyphCache>{m, "AbstractGlyphCache", "Base for glyph caches"}
abstractGlyphCache
/** @todo features */ /** @todo features */
.def_property_readonly("format", &Text::AbstractGlyphCache::format, "Glyph cache format") .def_property_readonly("format", &Text::AbstractGlyphCache::format, "Glyph cache format")
.def_property_readonly("processed_format", &Text::AbstractGlyphCache::processedFormat, "Processed glyph cache format") .def_property_readonly("processed_format", &Text::AbstractGlyphCache::processedFormat, "Processed glyph cache format")
@ -103,16 +102,14 @@ void text(py::module_& m) {
/** @todo image, processedImage, setProcessedImage, once needed for /** @todo image, processedImage, setProcessedImage, once needed for
anything */ anything */
; ;
py::class_<Text::GlyphCacheGL, Text::AbstractGlyphCache> glyphCache{m, "GlyphCacheGL", "OpenGL glyph cache"}; py::class_<Text::GlyphCacheGL, Text::AbstractGlyphCache>{m, "GlyphCacheGL", "OpenGL implementation of a glyph cache"}
glyphCache
.def(py::init<PixelFormat, const Vector2i&, const Vector2i&>(), "Constructor", py::arg("format"), py::arg("size"), py::arg("padding") = Vector2i{1}) .def(py::init<PixelFormat, const Vector2i&, const Vector2i&>(), "Constructor", py::arg("format"), py::arg("size"), py::arg("padding") = Vector2i{1})
/* The default behavior when returning a reference seems to be that it /* The default behavior when returning a reference seems to be that it
increfs the originating instance and decrefs it again after the increfs the originating instance and decrefs it again after the
variable gets deleted. This is verified in test_text_gl.py to be variable gets deleted. This is verified in test_text_gl.py to be
extra sure. */ extra sure. */
.def_property_readonly("texture", &Text::GlyphCacheGL::texture, "Cache texture"); .def_property_readonly("texture", &Text::GlyphCacheGL::texture, "Cache texture");
py::class_<Text::DistanceFieldGlyphCacheGL, Text::GlyphCacheGL> distanceFieldGlyphCache{m, "DistanceFieldGlyphCacheGL", "OpenGL glyph cache with distance field rendering"}; py::class_<Text::DistanceFieldGlyphCacheGL, Text::GlyphCacheGL>{m, "DistanceFieldGlyphCacheGL", "OpenGL glyph cache with distance field rendering"}
distanceFieldGlyphCache
.def(py::init<const Vector2i&, const Vector2i&, UnsignedInt>(), "Constructor", py::arg("size"), py::arg("processed_size"), py::arg("radius")); .def(py::init<const Vector2i&, const Vector2i&, UnsignedInt>(), "Constructor", py::arg("size"), py::arg("processed_size"), py::arg("radius"));
/* Font */ /* Font */

Loading…
Cancel
Save