From c16ea3e8a2c9f91d043107bfa7e194304ec5e6ca Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 17 Apr 2014 15:27:45 -0300 Subject: [PATCH] Use Graphics object in ImageView::onPaint() --- src/ui/image_view.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ui/image_view.cpp b/src/ui/image_view.cpp index 0c04758b8..eff06a88b 100644 --- a/src/ui/image_view.cpp +++ b/src/ui/image_view.cpp @@ -12,8 +12,10 @@ #include #include "ui/draw.h" +#include "ui/graphics.h" #include "ui/image_view.h" #include "ui/message.h" +#include "ui/paint_event.h" #include "ui/preferred_size_event.h" #include "ui/system.h" #include "ui/theme.h" @@ -38,13 +40,18 @@ void ImageView::onPreferredSize(PreferredSizeEvent& ev) void ImageView::onPaint(PaintEvent& ev) { + Graphics* g = ev.getGraphics(); + gfx::Rect bounds = getClientBounds(); gfx::Rect icon; jwidget_get_texticon_info(this, NULL, NULL, &icon, getAlign(), m_bmp->w, m_bmp->h); - jdraw_rectexclude(getBounds(), icon, getBgColor()); + g->fillRect(getBgColor(), bounds); - blit(m_bmp, ji_screen, 0, 0, icon.x, icon.y, icon.w, icon.h); + icon.x -= getBounds().x; + icon.y -= getBounds().y; + + g->blit(m_bmp, 0, 0, icon.x, icon.y, icon.w, icon.h); } } // namespace ui