From 6d61375cc72bad5c569d25c253adca4e3701dd27 Mon Sep 17 00:00:00 2001 From: Aaron Suen Date: Mon, 9 Mar 2015 09:32:11 -0400 Subject: Clean scaling pre-filter for formspec/HUD. --- src/hud.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/hud.cpp') diff --git a/src/hud.cpp b/src/hud.cpp index aabaa066c..0b34a7b5b 100644 --- a/src/hud.cpp +++ b/src/hud.cpp @@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "camera.h" #include "porting.h" #include "fontengine.h" +#include "guiscalingfilter.h" #include #ifdef HAVE_TOUCHSCREENGUI @@ -94,7 +95,7 @@ void Hud::drawItem(const ItemStack &item, const core::rect& rect, bool sele imgrect2.LowerRightCorner.Y += (m_padding*2); video::ITexture *texture = tsrc->getTexture(hotbar_selected_image); core::dimension2di imgsize(texture->getOriginalSize()); - driver->draw2DImage(texture, imgrect2, + draw2DImageFilterScaled(driver, texture, imgrect2, core::rect(core::position2d(0,0), imgsize), NULL, hbar_colors, true); } else { @@ -200,7 +201,7 @@ void Hud::drawItems(v2s32 upperleftpos, s32 itemcount, s32 offset, core::rect rect2 = imgrect2 + pos; video::ITexture *texture = tsrc->getTexture(hotbar_image); core::dimension2di imgsize(texture->getOriginalSize()); - driver->draw2DImage(texture, rect2, + draw2DImageFilterScaled(driver, texture, rect2, core::rect(core::position2d(0,0), imgsize), NULL, hbar_colors, true); } @@ -266,7 +267,7 @@ void Hud::drawLuaElements(v3s16 camera_offset) { (e->align.Y - 1.0) * dstsize.Y / 2); core::rect rect(0, 0, dstsize.X, dstsize.Y); rect += pos + offset + v2s32(e->offset.X, e->offset.Y); - driver->draw2DImage(texture, rect, + draw2DImageFilterScaled(driver, texture, rect, core::rect(core::position2d(0,0), imgsize), NULL, colors, true); break; } @@ -378,7 +379,7 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture, core::rect dstrect(0,0, dstd.Width, dstd.Height); dstrect += p; - driver->draw2DImage(stat_texture, dstrect, srcrect, NULL, colors, true); + draw2DImageFilterScaled(driver, stat_texture, dstrect, srcrect, NULL, colors, true); p += steppos; } @@ -388,7 +389,7 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture, core::rect dstrect(0,0, dstd.Width / 2, dstd.Height); dstrect += p; - driver->draw2DImage(stat_texture, dstrect, srcrect, NULL, colors, true); + draw2DImageFilterScaled(driver, stat_texture, dstrect, srcrect, NULL, colors, true); } } @@ -502,7 +503,7 @@ void drawItemStack(video::IVideoDriver *driver, { const video::SColor color(255,255,255,255); const video::SColor colors[] = {color,color,color,color}; - driver->draw2DImage(texture, rect, + draw2DImageFilterScaled(driver, texture, rect, core::rect(core::position2d(0,0), core::dimension2di(texture->getOriginalSize())), clip, colors, true); -- cgit v1.2.3