diff --git a/es-app/src/SystemScreenSaver.cpp b/es-app/src/SystemScreenSaver.cpp index 0543cfed1..942a8a742 100644 --- a/es-app/src/SystemScreenSaver.cpp +++ b/es-app/src/SystemScreenSaver.cpp @@ -209,7 +209,7 @@ void SystemScreenSaver::renderScreenSaver() { // Render black background Renderer::setMatrix(Transform4x4f::Identity()); - Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x000000FF, 0x000000FF); + Renderer::drawRect(0.0f, 0.0f, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x000000FF, 0x000000FF); // Only render the video if the state requires it if ((int)mState >= STATE_FADE_IN_VIDEO) @@ -222,7 +222,7 @@ void SystemScreenSaver::renderScreenSaver() { // Render black background Renderer::setMatrix(Transform4x4f::Identity()); - Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x000000FF, 0x000000FF); + Renderer::drawRect(0.0f, 0.0f, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x000000FF, 0x000000FF); // Only render the video if the state requires it if ((int)mState >= STATE_FADE_IN_VIDEO) @@ -249,7 +249,7 @@ void SystemScreenSaver::renderScreenSaver() { Renderer::setMatrix(Transform4x4f::Identity()); unsigned char color = screensaver_behavior == "dim" ? 0x000000A0 : 0x000000FF; - Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), color, color); + Renderer::drawRect(0.0f, 0.0f, Renderer::getScreenWidth(), Renderer::getScreenHeight(), color, color); } } diff --git a/es-app/src/components/AsyncReqComponent.cpp b/es-app/src/components/AsyncReqComponent.cpp index e08b27f3c..7693ae6b4 100644 --- a/es-app/src/components/AsyncReqComponent.cpp +++ b/es-app/src/components/AsyncReqComponent.cpp @@ -42,7 +42,7 @@ void AsyncReqComponent::render(const Transform4x4f& /*parentTrans*/) Renderer::setMatrix(trans); Vector3f point(Math::cosf(mTime * 0.01f) * 12, Math::sinf(mTime * 0.01f) * 12, 0); - Renderer::drawRect((int)point.x(), (int)point.y(), 8, 8, 0x0000FFFF, 0x0000FFFF); + Renderer::drawRect(point.x(), point.y(), 8.0f, 8.0f, 0x0000FFFF, 0x0000FFFF); } std::vector AsyncReqComponent::getHelpPrompts() diff --git a/es-app/src/components/RatingComponent.cpp b/es-app/src/components/RatingComponent.cpp index bf8341b15..73e18edb0 100644 --- a/es-app/src/components/RatingComponent.cpp +++ b/es-app/src/components/RatingComponent.cpp @@ -106,7 +106,6 @@ void RatingComponent::render(const Transform4x4f& parentTrans) return; Transform4x4f trans = parentTrans * getTransform(); - trans.round(); Renderer::setMatrix(trans); mFilledTexture->bind(); diff --git a/es-app/src/components/ScraperSearchComponent.cpp b/es-app/src/components/ScraperSearchComponent.cpp index 33f942dee..752c4a8e6 100644 --- a/es-app/src/components/ScraperSearchComponent.cpp +++ b/es-app/src/components/ScraperSearchComponent.cpp @@ -359,9 +359,7 @@ void ScraperSearchComponent::render(const Transform4x4f& parentTrans) if(mBlockAccept) { Renderer::setMatrix(trans); - Renderer::drawRect(0.f, 0.f, mSize.x(), mSize.y(), 0x00000011, 0x00000011); - //Renderer::drawRect((int)mResultList->getPosition().x(), (int)mResultList->getPosition().y(), - // (int)mResultList->getSize().x(), (int)mResultList->getSize().y(), 0x0000011, 0x00000011); + Renderer::drawRect(0.0f, 0.0f, mSize.x(), mSize.y(), 0x00000011, 0x00000011); mBusyAnim.render(trans); } diff --git a/es-app/src/components/TextListComponent.h b/es-app/src/components/TextListComponent.h index 44fcb3924..b9c0f3670 100644 --- a/es-app/src/components/TextListComponent.h +++ b/es-app/src/components/TextListComponent.h @@ -173,7 +173,7 @@ void TextListComponent::render(const Transform4x4f& parentTrans) mSelectorImage.render(trans); } else { Renderer::setMatrix(trans); - Renderer::drawRect(0.f, (mCursor - startEntry)*entrySize + mSelectorOffsetY, mSize.x(), + Renderer::drawRect(0.0f, (mCursor - startEntry)*entrySize + mSelectorOffsetY, mSize.x(), mSelectorHeight, mSelectorColor, mSelectorColorEnd, mSelectorColorGradientHorizontal); } } diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index e0a096ee9..44e299c49 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -434,7 +434,7 @@ void SystemView::renderCarousel(const Transform4x4f& trans) Renderer::pushClipRect(Vector2i((int)clipPos.x(), (int)clipPos.y()), Vector2i((int)mCarousel.size.x(), (int)mCarousel.size.y())); Renderer::setMatrix(carouselTrans); - Renderer::drawRect(0.0, 0.0, mCarousel.size.x(), mCarousel.size.y(), mCarousel.color, mCarousel.colorEnd, mCarousel.colorGradientHorizontal); + Renderer::drawRect(0.0f, 0.0f, mCarousel.size.x(), mCarousel.size.y(), mCarousel.color, mCarousel.colorEnd, mCarousel.colorGradientHorizontal); // draw logos Vector2f logoSpacing(0.0, 0.0); // NB: logoSpacing will include the size of the logo itself as well! diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 95ecbd861..3489628f6 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -424,7 +424,7 @@ void ViewController::render(const Transform4x4f& parentTrans) { unsigned int fadeColor = 0x00000000 | (unsigned char)(mFadeOpacity * 255); Renderer::setMatrix(parentTrans); - Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), fadeColor, fadeColor); + Renderer::drawRect(0.0f, 0.0f, Renderer::getScreenWidth(), Renderer::getScreenHeight(), fadeColor, fadeColor); } } diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index 35975c445..c51bf9ff5 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -301,7 +301,7 @@ void Window::renderLoadingScreen(std::string text) { Transform4x4f trans = Transform4x4f::Identity(); Renderer::setMatrix(trans); - Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x000000FF, 0x000000FF); + Renderer::drawRect(0.0f, 0.0f, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x000000FF, 0x000000FF); ImageComponent splash(this, true); splash.setResize(Renderer::getScreenWidth() * 0.6f, 0.0f); diff --git a/es-core/src/components/ButtonComponent.cpp b/es-core/src/components/ButtonComponent.cpp index 0ada6ece6..d0f47ce3a 100644 --- a/es-core/src/components/ButtonComponent.cpp +++ b/es-core/src/components/ButtonComponent.cpp @@ -86,14 +86,12 @@ void ButtonComponent::updateImage() void ButtonComponent::render(const Transform4x4f& parentTrans) { Transform4x4f trans = parentTrans * getTransform(); - trans.round(); mBox.render(trans); if(mTextCache) { Vector3f centerOffset((mSize.x() - mTextCache->metrics.size.x()) / 2, (mSize.y() - mTextCache->metrics.size.y()) / 2, 0); - centerOffset.round(); trans = trans.translate(centerOffset); Renderer::setMatrix(trans); diff --git a/es-core/src/components/ComponentList.cpp b/es-core/src/components/ComponentList.cpp index c21c8308a..1a3524f78 100644 --- a/es-core/src/components/ComponentList.cpp +++ b/es-core/src/components/ComponentList.cpp @@ -161,7 +161,6 @@ void ComponentList::render(const Transform4x4f& parentTrans) return; Transform4x4f trans = parentTrans * getTransform(); - trans.round(); // clip everything to be inside our bounds Vector3f dim(mSize.x(), mSize.y(), 0); diff --git a/es-core/src/components/DateTimeEditComponent.cpp b/es-core/src/components/DateTimeEditComponent.cpp index 20440edc9..79bcb8e9c 100644 --- a/es-core/src/components/DateTimeEditComponent.cpp +++ b/es-core/src/components/DateTimeEditComponent.cpp @@ -146,7 +146,6 @@ void DateTimeEditComponent::render(const Transform4x4f& parentTrans) // vertically center Vector3f off(0, (mSize.y() - mTextCache->metrics.size.y()) / 2, 0); trans.translate(off); - trans.round(); Renderer::setMatrix(trans); @@ -159,8 +158,8 @@ void DateTimeEditComponent::render(const Transform4x4f& parentTrans) { if(mEditIndex >= 0 && (unsigned int)mEditIndex < mCursorBoxes.size()) { - Renderer::drawRect((int)mCursorBoxes[mEditIndex][0], (int)mCursorBoxes[mEditIndex][1], - (int)mCursorBoxes[mEditIndex][2], (int)mCursorBoxes[mEditIndex][3], 0x00000022, 0x00000022); + Renderer::drawRect(mCursorBoxes[mEditIndex][0], mCursorBoxes[mEditIndex][1], + mCursorBoxes[mEditIndex][2], mCursorBoxes[mEditIndex][3], 0x00000022, 0x00000022); } } } diff --git a/es-core/src/components/NinePatchComponent.cpp b/es-core/src/components/NinePatchComponent.cpp index daac1fe19..96301de10 100644 --- a/es-core/src/components/NinePatchComponent.cpp +++ b/es-core/src/components/NinePatchComponent.cpp @@ -98,7 +98,6 @@ void NinePatchComponent::render(const Transform4x4f& parentTrans) return; Transform4x4f trans = parentTrans * getTransform(); - trans.round(); if(mTexture && mVertices != NULL) { diff --git a/es-core/src/components/SliderComponent.cpp b/es-core/src/components/SliderComponent.cpp index d027ee40c..aba8174c4 100644 --- a/es-core/src/components/SliderComponent.cpp +++ b/es-core/src/components/SliderComponent.cpp @@ -61,7 +61,6 @@ void SliderComponent::update(int deltaTime) void SliderComponent::render(const Transform4x4f& parentTrans) { Transform4x4f trans = parentTrans * getTransform(); - trans.round(); Renderer::setMatrix(trans); // render suffix diff --git a/es-core/src/components/TextComponent.cpp b/es-core/src/components/TextComponent.cpp index ba5c03f68..bd8b7cdc0 100644 --- a/es-core/src/components/TextComponent.cpp +++ b/es-core/src/components/TextComponent.cpp @@ -102,7 +102,7 @@ void TextComponent::render(const Transform4x4f& parentTrans) if (mRenderBackground) { Renderer::setMatrix(trans); - Renderer::drawRect(0.f, 0.f, mSize.x(), mSize.y(), mBgColor, mBgColor); + Renderer::drawRect(0.0f, 0.0f, mSize.x(), mSize.y(), mBgColor, mBgColor); } if(mTextCache) @@ -127,11 +127,10 @@ void TextComponent::render(const Transform4x4f& parentTrans) { // draw the "textbox" area, what we are aligned within Renderer::setMatrix(trans); - Renderer::drawRect(0.f, 0.f, mSize.x(), mSize.y(), 0xFF000033, 0xFF000033); + Renderer::drawRect(0.0f, 0.0f, mSize.x(), mSize.y(), 0xFF000033, 0xFF000033); } trans.translate(off); - trans.round(); Renderer::setMatrix(trans); // draw the text area, where the text actually is going diff --git a/es-core/src/components/TextEditComponent.cpp b/es-core/src/components/TextEditComponent.cpp index dcd9b4647..6d98139bb 100644 --- a/es-core/src/components/TextEditComponent.cpp +++ b/es-core/src/components/TextEditComponent.cpp @@ -254,8 +254,6 @@ void TextEditComponent::render(const Transform4x4f& parentTrans) Renderer::pushClipRect(clipPos, clipDim); trans.translate(Vector3f(-mScrollOffset.x(), -mScrollOffset.y(), 0)); - trans.round(); - Renderer::setMatrix(trans); if(mTextCache) diff --git a/es-core/src/renderers/Renderer.cpp b/es-core/src/renderers/Renderer.cpp index 42c0fe698..e0c841891 100644 --- a/es-core/src/renderers/Renderer.cpp +++ b/es-core/src/renderers/Renderer.cpp @@ -238,20 +238,18 @@ namespace Renderer void drawRect(const float _x, const float _y, const float _w, const float _h, const unsigned int _color, const unsigned int _colorEnd, bool horizontalGradient, const Blend::Factor _srcBlendFactor, const Blend::Factor _dstBlendFactor) { - drawRect((int)Math::round(_x), (int)Math::round(_y), (int)Math::round(_w), (int)Math::round(_h), _color, _colorEnd, horizontalGradient, _srcBlendFactor, _dstBlendFactor); - - } // drawRect - - void drawRect(const int _x, const int _y, const int _w, const int _h, const unsigned int _color, const unsigned int _colorEnd, bool horizontalGradient, const Blend::Factor _srcBlendFactor, const Blend::Factor _dstBlendFactor) - { + const float x = Math::round(_x); + const float y = Math::round(_y); + const float w = Math::round(_w); + const float h = Math::round(_h); const unsigned int color = convertColor(_color); const unsigned int colorEnd = convertColor(_colorEnd); Vertex vertices[4]; - vertices[0] = { { (float)(_x ), (float)(_y ) }, { 0.0f, 0.0f }, color }; - vertices[1] = { { (float)(_x ), (float)(_y + _h) }, { 0.0f, 0.0f }, horizontalGradient ? colorEnd : color }; - vertices[2] = { { (float)(_x + _w), (float)(_y ) }, { 0.0f, 0.0f }, horizontalGradient ? color : colorEnd }; - vertices[3] = { { (float)(_x + _w), (float)(_y + _h) }, { 0.0f, 0.0f }, colorEnd }; + vertices[0] = { { _x ,_y }, { 0.0f, 0.0f }, color }; + vertices[1] = { { _x ,_y + _h }, { 0.0f, 0.0f }, horizontalGradient ? colorEnd : color }; + vertices[2] = { { _x + _w,_y }, { 0.0f, 0.0f }, horizontalGradient ? color : colorEnd }; + vertices[3] = { { _x + _w,_y + _h }, { 0.0f, 0.0f }, colorEnd }; bindTexture(0); drawTriangleStrips(vertices, 4, _srcBlendFactor, _dstBlendFactor); diff --git a/es-core/src/renderers/Renderer.h b/es-core/src/renderers/Renderer.h index 4fcaa1a9b..3b41e338d 100644 --- a/es-core/src/renderers/Renderer.h +++ b/es-core/src/renderers/Renderer.h @@ -67,7 +67,6 @@ namespace Renderer void pushClipRect (const Vector2i& _pos, const Vector2i& _size); void popClipRect (); void drawRect (const float _x, const float _y, const float _w, const float _h, const unsigned int _color, const unsigned int _colorEnd, bool horizontalGradient = false, const Blend::Factor _srcBlendFactor = Blend::SRC_ALPHA, const Blend::Factor _dstBlendFactor = Blend::ONE_MINUS_SRC_ALPHA); - void drawRect (const int _x, const int _y, const int _w, const int _h, const unsigned int _color, const unsigned int _colorEnd, bool horizontalGradient = false, const Blend::Factor _srcBlendFactor = Blend::SRC_ALPHA, const Blend::Factor _dstBlendFactor = Blend::ONE_MINUS_SRC_ALPHA); SDL_Window* getSDLWindow (); int getWindowWidth (); diff --git a/es-core/src/renderers/Renderer_GL21.cpp b/es-core/src/renderers/Renderer_GL21.cpp index f3b4247ec..a792bfab2 100644 --- a/es-core/src/renderers/Renderer_GL21.cpp +++ b/es-core/src/renderers/Renderer_GL21.cpp @@ -1,6 +1,7 @@ #if defined(USE_OPENGL_21) #include "renderers/Renderer.h" +#include "math/Transform4x4f.h" #include "Log.h" #include "Settings.h" @@ -193,8 +194,10 @@ namespace Renderer void setMatrix(const Transform4x4f& _matrix) { + Transform4x4f matrix = _matrix; + matrix.round(); glMatrixMode(GL_MODELVIEW); - glLoadMatrixf((GLfloat*)&_matrix); + glLoadMatrixf((GLfloat*)&matrix); } // setMatrix diff --git a/es-core/src/renderers/Renderer_GLES10.cpp b/es-core/src/renderers/Renderer_GLES10.cpp index 3a99b45d1..adb417ea1 100644 --- a/es-core/src/renderers/Renderer_GLES10.cpp +++ b/es-core/src/renderers/Renderer_GLES10.cpp @@ -193,8 +193,10 @@ namespace Renderer void setMatrix(const Transform4x4f& _matrix) { + Transform4x4f matrix = _matrix; + matrix.round(); glMatrixMode(GL_MODELVIEW); - glLoadMatrixf((GLfloat*)&_matrix); + glLoadMatrixf((GLfloat*)&matrix); } // setMatrix