From b42bf6109b5785da61ac4854aac1947347744cf6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 5 Feb 2020 22:03:12 +0100 Subject: [PATCH] fb_generic: add possibility to handle with unscaled images in showFrame() --- src/driver/fb_generic.cpp | 22 +++++++++++++++++----- src/driver/fb_generic.h | 5 +++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index b1d367231..73b6a7d7e 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -1576,7 +1576,7 @@ bool CFrameBuffer::showFrame(const std::string & filename, int fallback_mode) std::string picture = getIconPath(filename, ""); bool ret = false; - if (access(picture.c_str(), F_OK) == 0) + if (access(picture.c_str(), F_OK) == 0 && !(fallback_mode & SHOW_FRAME_FALLBACK_MODE_IMAGE_UNSCALED)) { if (videoDecoder) { @@ -1593,16 +1593,28 @@ bool CFrameBuffer::showFrame(const std::string & filename, int fallback_mode) } else { - dprintf(DEBUG_NORMAL,"[CFrameBuffer]\[%s - %d], image not found: %s\n", __func__, __LINE__, picture.c_str()); - picture = ""; + if (!(fallback_mode & SHOW_FRAME_FALLBACK_MODE_IMAGE_UNSCALED)) + { + dprintf(DEBUG_NORMAL,"[CFrameBuffer]\[%s - %d], image not found: %s\n", __func__, __LINE__, picture.c_str()); + picture = ""; + } } if (!ret) { if (fallback_mode) { - if ((fallback_mode & SHOW_FRAME_FALLBACK_MODE_IMAGE) && !picture.empty()) - ret = g_PicViewer->DisplayImage(picture, 0, 0, getScreenWidth(true), getScreenHeight(true), TM_NONE); + if (fallback_mode & (SHOW_FRAME_FALLBACK_MODE_IMAGE | SHOW_FRAME_FALLBACK_MODE_IMAGE_UNSCALED) && !picture.empty()) + { + if (fallback_mode & SHOW_FRAME_FALLBACK_MODE_IMAGE_UNSCALED) + { + SetTransparent(TM_NONE); + ret = g_PicViewer->ShowImage(picture.c_str(), false); + SetTransparentDefault(); + } + else + ret = g_PicViewer->DisplayImage(picture, 0, 0, getScreenWidth(true), getScreenHeight(true), TM_NONE); + } else ret = false; diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index b1fe5adb3..3e284e3bb 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -271,8 +271,9 @@ class CFrameBuffer : public sigc::trackable { SHOW_FRAME_FALLBACK_MODE_OFF = 0, SHOW_FRAME_FALLBACK_MODE_IMAGE = 1, - SHOW_FRAME_FALLBACK_MODE_BLACKSCREEN = 2, - SHOW_FRAME_FALLBACK_MODE_CALLBACK = 4 + SHOW_FRAME_FALLBACK_MODE_IMAGE_UNSCALED = 2, + SHOW_FRAME_FALLBACK_MODE_BLACKSCREEN = 4, + SHOW_FRAME_FALLBACK_MODE_CALLBACK = 8 }; bool showFrame(const std::string & filename, int fallback_mode = SHOW_FRAME_FALLBACK_MODE_OFF); void stopFrame();