From 4a0891ad259ab9f4fc90ffe1dccb5eabe1cfa9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 3 May 2025 21:41:00 +0200 Subject: [PATCH] python: avoid using outdated names w/o GL suffix in Text bindings. --- src/python/magnum/test/test_text_gl.py | 2 +- src/python/magnum/text.cpp | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/python/magnum/test/test_text_gl.py b/src/python/magnum/test/test_text_gl.py index 47873bb..09e205b 100644 --- a/src/python/magnum/test/test_text_gl.py +++ b/src/python/magnum/test/test_text_gl.py @@ -63,7 +63,7 @@ class GlyphCacheGL(GLTestCase): cache = text.GlyphCacheGL(PixelFormat.R8_UNORM, (128, 128)) self.assertEqual(cache.padding, (1, 1)) -class DistanceFieldGlyphCache(GLTestCase): +class DistanceFieldGlyphCacheGL(GLTestCase): def test(self): cache = text.DistanceFieldGlyphCacheGL((1024, 1024), (128, 128), 2) diff --git a/src/python/magnum/text.cpp b/src/python/magnum/text.cpp index ac02330..b3142b4 100644 --- a/src/python/magnum/text.cpp +++ b/src/python/magnum/text.cpp @@ -91,8 +91,7 @@ void text(py::module_& m) { #endif /* Glyph caches */ - py::class_ abstractGlyphCache{m, "AbstractGlyphCache", "Base for glyph caches"}; - abstractGlyphCache + py::class_{m, "AbstractGlyphCache", "Base for glyph caches"} /** @todo features */ .def_property_readonly("format", &Text::AbstractGlyphCache::format, "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 anything */ ; - py::class_ glyphCache{m, "GlyphCacheGL", "OpenGL glyph cache"}; - glyphCache + py::class_{m, "GlyphCacheGL", "OpenGL implementation of a glyph cache"} .def(py::init(), "Constructor", py::arg("format"), py::arg("size"), py::arg("padding") = Vector2i{1}) /* The default behavior when returning a reference seems to be that it increfs the originating instance and decrefs it again after the variable gets deleted. This is verified in test_text_gl.py to be extra sure. */ .def_property_readonly("texture", &Text::GlyphCacheGL::texture, "Cache texture"); - py::class_ distanceFieldGlyphCache{m, "DistanceFieldGlyphCacheGL", "OpenGL glyph cache with distance field rendering"}; - distanceFieldGlyphCache + py::class_{m, "DistanceFieldGlyphCacheGL", "OpenGL glyph cache with distance field rendering"} .def(py::init(), "Constructor", py::arg("size"), py::arg("processed_size"), py::arg("radius")); /* Font */