Ticket #762: progdetails-speed.patch
File progdetails-speed.patch, 4.2 KB (added by , 20 years ago) |
---|
-
libs/libmyth/uitypes.h
666 666 protected: 667 667 void refreshImage(); 668 668 void updateBackground(); 669 void loadBackgroundImg(bool &changed); 669 670 670 671 QRect m_displayArea; 671 672 QRect m_textArea; … … 684 685 // widget background image 685 686 QPixmap *m_image; // the completed image including the rich text 686 687 688 QString m_backgroundFile; //< current source of background image 689 QImage m_backgroundImage; //< background image (only m_bgImage*) 690 687 691 bool m_showScrollArrows; 688 692 bool m_showUpArrow; 689 693 bool m_showDnArrow; -
libs/libmyth/uitypes.cpp
3 3 #include <qapplication.h> 4 4 #include <qsimplerichtext.h> 5 5 #include <qbitmap.h> 6 #include <sys/time.h> 6 7 7 8 using namespace std; 8 9 … … 2053 2054 m_image = new QPixmap(m_displayArea.width(), m_displayArea.height(), 24); 2054 2055 m_background = new QPixmap(m_displayArea.width(), m_displayArea.height(), 24); 2055 2056 m_compBackground = new QPixmap(m_displayArea.width(), m_displayArea.height(), 24); 2057 m_backgroundFile = ""; 2056 2058 2057 2059 m_bgImageReg = m_bgImageSel = ""; 2058 2060 m_showScrollArrows = true; … … 2087 2089 m_bgImageReg = bgImageReg; 2088 2090 m_bgImageSel = bgImageSel; 2089 2091 2090 updateBackground(); 2092 bool needreload = false; 2093 loadBackgroundImg(needreload); 2094 if (needreload) updateBackground(); 2091 2095 } 2092 2096 2093 2097 void UIRichTextType::SetBackground(QPixmap *background) … … 2098 2102 updateBackground(); 2099 2103 } 2100 2104 2101 void UIRichTextType:: updateBackground(void)2105 void UIRichTextType::loadBackgroundImg(bool &changed) 2102 2106 { 2103 2107 QString file = ""; 2108 changed = false; 2104 2109 2105 2110 file = isFocused() ? m_bgImageSel : m_bgImageReg; 2106 2111 2107 2112 // paint our background image over the window background 2108 2113 if (file != "") 2109 2114 { 2110 if (gContext->FindThemeFile(file) )2115 if (gContext->FindThemeFile(file) && file != m_backgroundFile) 2111 2116 { 2112 QImage *sourceImg = new QImage();2113 if (sourceImg ->load(file))2117 QImage sourceImg; 2118 if (sourceImg.load(file)) 2114 2119 { 2115 QImage scalerImg; 2116 scalerImg = sourceImg->smoothScale( 2120 m_backgroundImage = sourceImg.smoothScale( 2117 2121 (int)(m_displayArea.width()), 2118 2122 (int)(m_displayArea.height())); 2119 QPainter p(m_compBackground); 2120 p.drawPixmap(QPoint(0, 0), *m_background); 2121 p.drawImage(QPoint(0, 0), scalerImg); 2123 m_backgroundFile = file; 2124 changed = true; 2122 2125 } 2123 delete sourceImg;2124 2126 } 2125 2127 } 2128 } 2129 2130 void UIRichTextType::updateBackground(void) 2131 { 2132 // paint our background image over the window background 2133 QPainter p(m_compBackground); 2134 if (m_background) p.drawPixmap(QPoint(0, 0), *m_background); 2135 if (!m_backgroundFile.isEmpty()) 2136 p.drawImage(QPoint(0, 0), m_backgroundImage); 2126 2137 refreshImage(); 2127 2138 } 2128 2139 … … 2248 2259 bool UIRichTextType::takeFocus() 2249 2260 { 2250 2261 bool res = UIType::takeFocus(); 2251 updateBackground(); 2262 bool needreload = false; 2263 loadBackgroundImg(needreload); 2264 if (needreload) updateBackground(); 2252 2265 2253 2266 return res; 2254 2267 } … … 2256 2269 void UIRichTextType::looseFocus() 2257 2270 { 2258 2271 UIType::looseFocus(); 2259 2260 updateBackground(); 2272 bool needreload = false; 2273 loadBackgroundImg(needreload); 2274 if (needreload) updateBackground(); 2261 2275 } 2262 2276 2263 2277 // ****************************************************************** -
libs/libmythtv/progdetails.cpp
34 34 if (m_richText) 35 35 { 36 36 m_richText->SetText(m_details); 37 m_richText->SetBackground(&my_background);38 37 } 39 38 } 40 39