From 5b176f97a43544d810c7122f1f8a1042bbce2be8 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 6 Dec 2022 16:57:01 +0100 Subject: [PATCH] Now avoiding unnecessary processing in cDvbSubtitleConverter::FinishPage() if there are no areas --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ dvbsubtitle.c | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ccd83b16..54c55d57 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2207,6 +2207,8 @@ Marko M for reporting a possible call to poll() in cSectionHandler::Action() without any filters for avoiding the memcpy() call in cGlyph::cGlyph() if the bitmap is empty + for avoiding unnecessary processing in cDvbSubtitleConverter::FinishPage() if there + are no areas Patrick Rother for reporting a bug in defining timers that only differ in the day of week diff --git a/HISTORY b/HISTORY index 86b83a7a..eccc607e 100644 --- a/HISTORY +++ b/HISTORY @@ -9828,3 +9828,5 @@ Video Disk Recorder Revision History (reported by Marko Mäkelä). - Now avoiding the memcpy() call in cGlyph::cGlyph() if the bitmap is empty (thanks to Marko Mäkelä). +- Now avoiding unnecessary processing in cDvbSubtitleConverter::FinishPage() if there + are no areas (thanks to Marko Mäkelä). diff --git a/dvbsubtitle.c b/dvbsubtitle.c index c1dfef4d..d7f9ac93 100644 --- a/dvbsubtitle.c +++ b/dvbsubtitle.c @@ -7,7 +7,7 @@ * Original author: Marco Schluessler * With some input from the "subtitles plugin" by Pekka Virtanen * - * $Id: dvbsubtitle.c 5.1 2021/03/17 15:24:34 kls Exp $ + * $Id: dvbsubtitle.c 5.2 2022/12/06 16:57:01 kls Exp $ */ #include "dvbsubtitle.h" @@ -1770,11 +1770,13 @@ void cDvbSubtitleConverter::FinishPage(cDvbSubtitlePage *Page) return; int NumAreas; tArea *Areas = Page->GetAreas(NumAreas); + if (!Areas) + return; tArea AreaCombined = Page->CombineAreas(NumAreas, Areas); tArea AreaOsd = Page->ScaleArea(AreaCombined, osdFactorX, osdFactorY); int Bpp = 8; bool Reduced = false; - if (osd && NumAreas > 0) { + if (osd) { while (osd->CanHandleAreas(&AreaOsd, 1) != oeOk) { dbgoutput("CanHandleAreas: %d
\n", osd->CanHandleAreas(&AreaOsd, 1)); int HalfBpp = Bpp / 2;