Browse Source

Merge branch 'master' into compatibility

Vladimír Vondruš 13 years ago
parent
commit
4e8df64e93
  1. 11
      src/Math/Functions.h
  2. 9
      src/Math/Test/FunctionsTest.cpp
  3. 2
      src/Shaders/Flat.frag
  4. 2
      src/Text/configure.h.cmake
  5. 2
      src/Text/fontconverter.cpp

11
src/Math/Functions.h

@ -252,12 +252,21 @@ template<std::size_t size, class T> Vector<size, T> floor(const Vector<size, T>&
template<class T> inline T round(const T& a); template<class T> inline T round(const T& a);
#else #else
template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type round(T a) { template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type round(T a) {
#ifndef CORRADE_TARGET_NACL_NEWLIB
return std::round(a); return std::round(a);
#else
return (a > T(0)) ? std::floor(a + T(0.5)) : std::ceil(a - T(0.5));
#endif
} }
template<std::size_t size, class T> Vector<size, T> round(const Vector<size, T>& a) { template<std::size_t size, class T> Vector<size, T> round(const Vector<size, T>& a) {
Vector<size, T> out; Vector<size, T> out;
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i) {
#ifndef CORRADE_TARGET_NACL_NEWLIB
out[i] = std::round(a[i]); out[i] = std::round(a[i]);
#else
out[i] = round(a[i]);
#endif
}
return out; return out;
} }
#endif #endif

9
src/Math/Test/FunctionsTest.cpp

@ -167,6 +167,15 @@ void FunctionsTest::floor() {
void FunctionsTest::round() { void FunctionsTest::round() {
CORRADE_COMPARE(Math::round(2.3f), 2.0f); CORRADE_COMPARE(Math::round(2.3f), 2.0f);
CORRADE_COMPARE(Math::round(Vector3(2.3f, 0.7f, 1.5f)), Vector3(2.0f, 1.0f, 2.0f)); CORRADE_COMPARE(Math::round(Vector3(2.3f, 0.7f, 1.5f)), Vector3(2.0f, 1.0f, 2.0f));
/* We are working around missing std::round() in NaCl newlib, thus we must
test that the behavior is the same on both implementations */
CORRADE_COMPARE(Math::round(-2.0f), -2.0f);
CORRADE_COMPARE(Math::round(-1.5f), -2.0f);
CORRADE_COMPARE(Math::round(-1.3f), -1.0f);
CORRADE_COMPARE(Math::round(1.3f), 1.0f);
CORRADE_COMPARE(Math::round(1.5f), 2.0f);
CORRADE_COMPARE(Math::round(2.0f), 2.0f);
} }
void FunctionsTest::ceil() { void FunctionsTest::ceil() {

2
src/Shaders/Flat.frag

@ -46,7 +46,7 @@ layout(location = 1) uniform vec4 color;
# ifndef GL_ES # ifndef GL_ES
uniform lowp vec4 color = vec4(1.0f, 1.0f, 1.0f, 1.0f); uniform lowp vec4 color = vec4(1.0f, 1.0f, 1.0f, 1.0f);
# else # else
unfirom lowp vec4 color; uniform lowp vec4 color;
# endif # endif
#endif #endif

2
src/Text/configure.h.cmake

@ -22,4 +22,4 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_DIR}" #define MAGNUM_PLUGINS_DIR "${MAGNUM_PLUGINS_INSTALL_DIR}"

2
src/Text/fontconverter.cpp

@ -55,7 +55,7 @@ FontConverter::FontConverter(const Arguments& arguments): Platform::WindowlessAp
.addOption("characters", "abcdefghijklmnopqrstuvwxyz" .addOption("characters", "abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789?!:,. ").setHelp("characters", "characters to include in the output") "0123456789?!:,. ").setHelp("characters", "characters to include in the output")
.addOption("font-size", "128").setHelpKey("font-size", "\"X Y\"").setHelp("font-size", "TTF font size") .addOption("font-size", "128").setHelpKey("font-size", "N").setHelp("font-size", "TTF font size")
.addOption("atlas-size", "2048 2048").setHelpKey("atlas-size", "\"X Y\"").setHelp("atlas-size", "glyph atlas size") .addOption("atlas-size", "2048 2048").setHelpKey("atlas-size", "\"X Y\"").setHelp("atlas-size", "glyph atlas size")
.addOption("output-size", "256 256").setHelpKey("output-size", "\"X Y\"").setHelp("output-size", "output atlas size. If set to zero size, distance field computation will not be used.") .addOption("output-size", "256 256").setHelpKey("output-size", "\"X Y\"").setHelp("output-size", "output atlas size. If set to zero size, distance field computation will not be used.")
.addOption("radius", "24").setHelpKey("radius", "N").setHelp("radius", "distance field computation radius") .addOption("radius", "24").setHelpKey("radius", "N").setHelp("radius", "distance field computation radius")

Loading…
Cancel
Save