From 4df8d1d0881ec6d0f3f64bb98d0e6d31ecf751fc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 15 Jun 2013 21:47:39 +0200 Subject: [PATCH] CComponentsPicture: add member function paintPicture() compact calling in paint() --- src/gui/components/cc_item_picture.cpp | 20 +++++++++++++------- src/gui/components/cc_item_picture.h | 1 + 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index b02c25f81..9fd61678f 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -167,23 +167,29 @@ void CComponentsPicture::initVarPicture() height = max(max(pic_height, pic_max_h), height) + sw ; } -void CComponentsPicture::paint(bool do_save_bg) +void CComponentsPicture::paintPicture() { - initVarPicture(); - paintInit(do_save_bg); pic_painted = false; - + + if (do_paint){ #ifdef DEBUG_CC printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d)\n", __FUNCTION__, pic_name.c_str(), do_paint); #endif - - if (do_paint){ if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF) pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0 /*pic_max_h*/, pic_offset, pic_paint, pic_paintBg, col_body); else if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) pic_painted = g_PicViewer->DisplayImage(pic_name, pic_x, pic_y, pic_width, pic_height); - do_paint = false; } + + if (pic_painted) + do_paint = false; +} + +void CComponentsPicture::paint(bool do_save_bg) +{ + initVarPicture(); + paintInit(do_save_bg); + paintPicture(); } void CComponentsPicture::hide(bool no_restore) diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index fc404039f..b0e6449cb 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -65,6 +65,7 @@ class CComponentsPicture : public CComponentsItem void init( const int x_pos, const int y_pos, const std::string& image_name, const int alignment, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow); + void paintPicture(); public: CComponentsPicture( const int x_pos, const int y_pos, const int w, const int h,