Ticket #8975: EffectsStruct.diff
File EffectsStruct.diff, 37.6 KB (added by , 14 years ago) |
---|
-
libs/libmythtv/videoout_vdpau.cpp
1092 1092 if (m_pips.contains(pipplayer)) 1093 1093 { 1094 1094 QRect rect = GetPIPRect(loc, pipplayer); 1095 Effects fx = { 255 }; 1095 1096 1096 1097 if (!m_pip_ready) 1097 1098 m_render->DrawBitmap(0, m_pip_surface, NULL, NULL, 0, 0, 0, 0); … … 1115 1116 QRect(QPoint(0,0), pipVideoDim), 1116 1117 rect, rect); 1117 1118 ok &= m_render->DrawBitmap(0, m_pip_surface, NULL, &rect, 1118 255, 0, 0, 0, true);1119 &fx, 0, 0, 0, true); 1119 1120 1120 1121 if (pipActive) 1121 1122 { … … 1128 1129 QSize(rect.width(), 10)); 1129 1130 QRect r = QRect(QPoint(rect.x() + rect.width(), rect.y() -10), 1130 1131 QSize(10, rect.height() + 20)); 1131 m_render->DrawBitmap(0, m_pip_surface, NULL, &l, 255, 127);1132 m_render->DrawBitmap(0, m_pip_surface, NULL, &t, 255, 127);1133 m_render->DrawBitmap(0, m_pip_surface, NULL, &b, 255, 127);1134 m_render->DrawBitmap(0, m_pip_surface, NULL, &r, 255, 127);1132 m_render->DrawBitmap(0, m_pip_surface, NULL, &l, &fx, 127); 1133 m_render->DrawBitmap(0, m_pip_surface, NULL, &t, &fx, 127); 1134 m_render->DrawBitmap(0, m_pip_surface, NULL, &b, &fx, 127); 1135 m_render->DrawBitmap(0, m_pip_surface, NULL, &r, &fx, 127); 1135 1136 } 1136 1137 1137 1138 m_pip_ready = ok; -
libs/libmythtv/osd.cpp
548 548 { 549 549 if (it.value()->IsVisible()) 550 550 { 551 it.value()->Draw(painter, 0, 0, 255, cliprect); 551 Effects fx = { 255 }; 552 it.value()->Draw(painter, 0, 0, fx, cliprect); 552 553 it.value()->SetAlpha(255); 553 554 it.value()->ResetNeedsRedraw(); 554 555 } … … 628 629 { 629 630 if (it.value()->NeedsRedraw()) 630 631 { 632 Effects fx = { 255 }; 631 633 if (it.value()->IsVisible()) 632 it.value()->Draw(painter, 0, 0, 255, cliprect);634 it.value()->Draw(painter, 0, 0, fx, cliprect); 633 635 it.value()->SetAlpha(255); 634 636 it.value()->ResetNeedsRedraw(); 635 637 } -
libs/libmythui/mythpainter.cpp
26 26 { 27 27 } 28 28 29 void MythPainter::DrawImage(int x, int y, MythImage *im, int alpha)29 void MythPainter::DrawImage(int x, int y, MythImage *im, Effects fx) 30 30 { 31 31 if (!im) 32 32 { … … 36 36 } 37 37 QRect dest = QRect(x, y, im->width(), im->height()); 38 38 QRect src = im->rect(); 39 DrawImage(dest, im, src, alpha);39 DrawImage(dest, im, src, fx); 40 40 } 41 41 42 void MythPainter::DrawImage(const QPoint &topLeft, MythImage *im, int alpha)42 void MythPainter::DrawImage(const QPoint &topLeft, MythImage *im, Effects fx) 43 43 { 44 DrawImage(topLeft.x(), topLeft.y(), im, alpha);44 DrawImage(topLeft.x(), topLeft.y(), im, fx); 45 45 } 46 46 47 47 // the following assume graphics hardware operates natively at 32bpp -
libs/libmythui/mythpainter_qt.cpp
109 109 } 110 110 111 111 void MythQtPainter::DrawImage(const QRect &r, MythImage *im, 112 const QRect &src, int alpha)112 const QRect &src, const Effects &fx) 113 113 { 114 114 if (!painter) 115 115 { … … 122 122 if (qim->NeedsRegen()) 123 123 qim->RegeneratePixmap(); 124 124 125 painter->setOpacity(static_cast<float>( alpha) / 255.0);125 painter->setOpacity(static_cast<float>(fx.alpha) / 255.0); 126 126 painter->drawPixmap(r.topLeft(), *(qim->GetPixmap()), src); 127 127 painter->setOpacity(1.0); 128 128 } 129 129 130 130 void MythQtPainter::DrawText(const QRect &r, const QString &msg, 131 131 int flags, const MythFontProperties &font, 132 int alpha, const QRect &boundRect)132 const Effects &fx, const QRect &boundRect) 133 133 { 134 134 if (!painter) 135 135 { … … 137 137 return; 138 138 } 139 139 140 (void) alpha;140 (void)fx.alpha; 141 141 142 painter->setOpacity(static_cast<float>( alpha) / 255.0);142 painter->setOpacity(static_cast<float>(fx.alpha) / 255.0); 143 143 144 144 painter->setFont(font.face()); 145 145 … … 160 160 painter->drawText(a, flags, msg); 161 161 } 162 162 163 if (font.hasOutline() && alpha > 128)163 if (font.hasOutline() && fx.alpha > 128) 164 164 { 165 165 QColor outlineColor; 166 166 int outlineSize, outlineAlpha; -
libs/libmythui/mythmainwindow.cpp
696 696 for (screenit = redrawList.begin(); screenit != redrawList.end(); 697 697 ++screenit) 698 698 { 699 (*screenit)->Draw(d->painter, 0, 0, 255, rects[i]); 699 Effects fx = { 255 }; 700 (*screenit)->Draw(d->painter, 0, 0, fx, rects[i]); 700 701 } 701 702 } 702 703 } -
libs/libmythui/mythpainter_qimage.cpp
143 143 } 144 144 145 145 void MythQImagePainter::DrawImage(const QRect &r, MythImage *im, 146 const QRect &src, int alpha)146 const QRect &src, const Effects &fx) 147 147 { 148 148 if (!painter) 149 149 { 150 150 VERBOSE(VB_IMPORTANT, "FATAL ERROR: DrawImage called with no painter"); 151 151 return; 152 152 } 153 154 (void)alpha;155 153 154 (void)fx.alpha; 155 156 156 CheckPaintMode(QRect(r.topLeft(), src.size())); 157 painter->setOpacity(static_cast<float>( alpha) / 255.0);157 painter->setOpacity(static_cast<float>(fx.alpha) / 255.0); 158 158 painter->drawImage(r.topLeft(), (QImage)(*im), src); 159 159 painter->setOpacity(1.0); 160 160 } 161 161 162 162 void MythQImagePainter::DrawText(const QRect &r, const QString &msg, 163 163 int flags, const MythFontProperties &font, 164 int alpha, const QRect &boundRect)164 const Effects &fx, const QRect &boundRect) 165 165 { 166 166 MythImage *im = GetImageFromString(msg, flags, r, font); 167 167 if (!im) … … 202 202 srcRect.setRect(x,y,width,height); 203 203 } 204 204 205 DrawImage(destRect, im, srcRect, alpha);205 DrawImage(destRect, im, srcRect, fx); 206 206 } 207 207 208 208 void MythQImagePainter::DrawRect(const QRect &area, bool drawFill, … … 237 237 { 238 238 MythImage *im = GetImageFromRect(area.size(), radius, drawFill, fillColor, 239 239 drawLine, lineWidth, lineColor); 240 Effects fx = { 255 }; 240 241 if (im) 241 DrawImage(area, im, QRect(0, 0, area.width(), area.height()), 255);242 DrawImage(area, im, QRect(0, 0, area.width(), area.height()), fx); 242 243 } 243 244 244 245 MythImage* MythQImagePainter::GetImageFromRect(const QSize &size, int radius, -
libs/libmythui/mythuishape.cpp
77 77 * \copydoc MythUIType::DrawSelf() 78 78 */ 79 79 void MythUIShape::DrawSelf(MythPainter *p, int xoffset, int yoffset, 80 int alphaMod, QRect clipRect)80 Effects fx, QRect clipRect) 81 81 { 82 82 QRect area = GetArea(); 83 83 area.translate(xoffset, yoffset); … … 101 101 srcRect = m_cropRect.toQRect(); 102 102 else 103 103 srcRect = m_image->rect(); 104 p->DrawImage(dest, m_image, srcRect, CalcAlpha(alphaMod));104 p->DrawImage(dest, m_image, srcRect, fx); 105 105 } 106 106 } 107 107 -
libs/libmythui/mythpainter_yuva.cpp
16 16 } 17 17 18 18 void MythYUVAPainter::DrawImage(const QRect &dest, MythImage *im, 19 const QRect &src, int alpha)19 const QRect &src, const Effects &fx) 20 20 { 21 21 if (im->format() != QImage::Format_ARGB32) 22 22 { … … 25 25 } 26 26 27 27 im->ConvertToYUV(); 28 MythQImagePainter::DrawImage(dest, im, src, alpha);28 MythQImagePainter::DrawImage(dest, im, src, fx); 29 29 } 30 30 31 31 void MythYUVAPainter::DrawText(const QRect &dest, const QString &msg, int flags, 32 const MythFontProperties &font, int alpha,32 const MythFontProperties &font, const Effects &fx, 33 33 const QRect &boundRect) 34 34 { 35 35 MythFontProperties *converted = GetConvertedFont(font); … … 39 39 if (im) 40 40 im->SetToYUV(); 41 41 MythQImagePainter::DrawText(dest, msg, flags, *converted, 42 alpha, boundRect);42 fx, boundRect); 43 43 } 44 44 } 45 45 -
libs/libmythui/mythpainter_ogl.h
28 28 virtual void End(); 29 29 30 30 virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, 31 int alpha);31 const Effects &fx); 32 32 virtual void DrawText(const QRect &dest, const QString &msg, int flags, 33 const MythFontProperties &font, int alpha,33 const MythFontProperties &font, const Effects &fx, 34 34 const QRect &boundRect); 35 35 virtual void DrawRect(const QRect &area, 36 36 bool drawFill, const QColor &fillColor, -
libs/libmythui/mythuibuttonlist.h
172 172 WrapFlowing }; 173 173 174 174 virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, 175 int alphaMod, QRect clipRect);175 Effects fx, QRect clipRect); 176 176 void Const(); 177 177 virtual void Init(); 178 178 -
libs/libmythui/mythuitype.cpp
37 37 m_Area = MythRect(0, 0, 0, 0); 38 38 m_MinArea = MythRect(0, 0, 0, 0); 39 39 m_NeedsRedraw = false; 40 m_ Alpha = 255;40 m_Effects = { 255 }; 41 41 m_AlphaChangeMode = m_AlphaChange = m_AlphaMin = 0; 42 42 m_AlphaMax = 255; 43 43 m_Moving = false; … … 376 376 if (m_AlphaChangeMode == 0) 377 377 return; 378 378 379 m_ Alpha += m_AlphaChange;379 m_Effects.alpha += m_AlphaChange; 380 380 381 if (m_ Alpha > m_AlphaMax)382 m_ Alpha = m_AlphaMax;383 if (m_ Alpha < m_AlphaMin)384 m_ Alpha = m_AlphaMin;381 if (m_Effects.alpha > m_AlphaMax) 382 m_Effects.alpha = m_AlphaMax; 383 if (m_Effects.alpha < m_AlphaMin) 384 m_Effects.alpha = m_AlphaMin; 385 385 386 386 // Reached limits so change direction 387 if (m_ Alpha == m_AlphaMax || m_Alpha == m_AlphaMin)387 if (m_Effects.alpha == m_AlphaMax || m_Effects.alpha == m_AlphaMin) 388 388 { 389 389 if (m_AlphaChangeMode == 2) 390 390 { … … 421 421 422 422 int MythUIType::CalcAlpha(int alphamod) 423 423 { 424 return (int)(m_ Alpha * (alphamod / 255.0));424 return (int)(m_Effects.alpha * (alphamod / 255.0)); 425 425 } 426 426 427 void MythUIType::DrawSelf(MythPainter *, int, int, int, QRect)427 void MythUIType::DrawSelf(MythPainter *, int, int, Effects, QRect) 428 428 { 429 429 } 430 430 431 void MythUIType::Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod,431 void MythUIType::Draw(MythPainter *p, int xoffset, int yoffset, Effects fx, 432 432 QRect clipRect) 433 433 { 434 434 m_DirtyRegion = QRegion(QRect(0,0,0,0)); … … 442 442 if (!realArea.intersects(clipRect)) 443 443 return; 444 444 445 DrawSelf(p, xoffset, yoffset, alphaMod, clipRect);445 DrawSelf(p, xoffset, yoffset, fx, clipRect); 446 446 447 447 QList<MythUIType *>::Iterator it; 448 448 for (it = m_ChildrenList.begin(); it != m_ChildrenList.end(); ++it) 449 449 { 450 450 (*it)->Draw(p, xoffset + m_Area.x(), yoffset + m_Area.y(), 451 CalcAlpha(alphaMod), clipRect);451 fx, clipRect); 452 452 } 453 453 } 454 454 … … 668 668 m_AlphaMin = minalpha; 669 669 m_AlphaMax = maxalpha; 670 670 671 if (m_ Alpha > m_AlphaMax)672 m_ Alpha = m_AlphaMax;673 if (m_ Alpha < m_AlphaMin)674 m_ Alpha = m_AlphaMin;671 if (m_Effects.alpha > m_AlphaMax) 672 m_Effects.alpha = m_AlphaMax; 673 if (m_Effects.alpha < m_AlphaMin) 674 m_Effects.alpha = m_AlphaMin; 675 675 } 676 676 677 677 void MythUIType::SetAlpha(int newalpha) 678 678 { 679 if (m_ Alpha == newalpha)679 if (m_Effects.alpha == newalpha) 680 680 return; 681 m_ Alpha = newalpha;681 m_Effects.alpha = newalpha; 682 682 SetRedraw(); 683 683 } 684 684 685 685 int MythUIType::GetAlpha(void) const 686 686 { 687 return m_ Alpha;687 return m_Effects.alpha; 688 688 } 689 689 690 690 /** \brief Key event handler … … 811 811 SetArea(base->m_Area); 812 812 m_MinArea = base->m_MinArea; 813 813 m_MinSize = base->m_MinSize; 814 m_ Alpha = base->m_Alpha;814 m_Effects = base->m_Effects; 815 815 m_AlphaChangeMode = base->m_AlphaChangeMode; 816 816 m_AlphaChange = base->m_AlphaChange; 817 817 m_AlphaMin = base->m_AlphaMin; … … 863 863 } 864 864 else if (element.tagName() == "alpha") 865 865 { 866 m_ Alpha = getFirstText(element).toInt();866 m_Effects.alpha = getFirstText(element).toInt(); 867 867 m_AlphaChangeMode = 0; 868 868 } 869 869 else if (element.tagName() == "alphapulse") 870 870 { 871 871 m_AlphaChangeMode = 2; 872 872 m_AlphaMin = element.attribute("min", "0").toInt(); 873 m_ Alpha = m_AlphaMax = element.attribute("max", "255").toInt();873 m_Effects.alpha = m_AlphaMax = element.attribute("max", "255").toInt(); 874 874 if (m_AlphaMax > 255) 875 m_ Alpha = m_AlphaMax = 255;875 m_Effects.alpha = m_AlphaMax = 255; 876 876 if (m_AlphaMin < 0) 877 877 m_AlphaMin = 0; 878 878 m_AlphaChange = element.attribute("change", "5").toInt(); -
libs/libmythui/mythuiwebbrowser.h
98 98 void SetBackgroundColor(QColor color); 99 99 100 100 virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, 101 int alphaMod, QRect clipRegion);101 Effects fx, QRect clipRegion); 102 102 103 103 virtual bool ParseElement( 104 104 const QString &filename, QDomElement &element, bool showWarnings); -
libs/libmythui/mythrender_opengl.h
17 17 #endif 18 18 19 19 #include "mythverbose.h" 20 #include "mythpainter.h" 20 21 #include "mythrender_base.h" 21 22 #include "mythrender_opengl_defs.h" 22 23 … … 114 115 void EnableShaderObject(uint obj); 115 116 116 117 void DrawBitmap(uint tex, uint target, const QRect *src, const QRect *dst, 117 uint prog, int alpha = 255, int red = 255, int green = 255,118 uint prog, const Effects *fx, int red = 255, int green = 255, 118 119 int blue = 255); 119 120 void DrawBitmap(uint *textures, uint texture_count, uint target, 120 121 const QRectF *src, const QRectF *dst, uint prog, -
libs/libmythui/mythuibuttonlist.cpp
2380 2380 /** 2381 2381 * \copydoc MythUIType::DrawSelf() 2382 2382 */ 2383 void MythUIButtonList::DrawSelf(MythPainter *, int, int, int, QRect)2383 void MythUIButtonList::DrawSelf(MythPainter *, int, int, Effects, QRect) 2384 2384 { 2385 2385 if (m_needsUpdate) 2386 2386 SetPositionArrowStates(); -
libs/libmythui/mythuitext.h
53 53 54 54 protected: 55 55 virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, 56 int alphaMod, QRect clipRect);56 Effects fx, QRect clipRect); 57 57 58 58 virtual bool ParseElement( 59 59 const QString &filename, QDomElement &element, bool showWarnings); -
libs/libmythui/mythrender_vdpau.h
119 119 bool UploadMythImage(uint id, MythImage *image); 120 120 bool UploadYUVFrame(uint id, void* const planes[3], uint32_t pitches[3]); 121 121 bool DrawBitmap(uint id, uint target, const QRect *src, 122 const QRect *dst, int alpha = 0, int red = 0,122 const QRect *dst, const Effects *fx, int red = 0, 123 123 int blue = 0, int green = 0, bool blend = false); 124 124 125 125 QSize GetBitmapSize(uint id); -
libs/libmythui/mythpainter_vdpau.h
28 28 virtual void End(); 29 29 30 30 virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, 31 int alpha);31 const Effects &fx); 32 32 virtual void DrawText(const QRect &dest, const QString &msg, int flags, 33 const MythFontProperties &font, int alpha,33 const MythFontProperties &font, const Effects &fx, 34 34 const QRect &boundRect); 35 35 virtual void DrawRect(const QRect &area, 36 36 bool drawFill, const QColor &fillColor, -
libs/libmythui/mythpainter.h
13 13 // #include "mythfontproperties.h" 14 14 15 15 #include "compat.h" 16 16 #include "mythuitype.h" 17 17 #include "mythexp.h" 18 18 19 19 class MythFontProperties; … … 40 40 QPaintDevice *GetParent(void) { return m_Parent; } 41 41 42 42 virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, 43 int alpha) = 0;43 const Effects &fx) = 0; 44 44 45 void DrawImage(int x, int y, MythImage *im, int alpha);46 void DrawImage(const QPoint &topLeft, MythImage *im, int alph);45 void DrawImage(int x, int y, MythImage *im, Effects fx); 46 void DrawImage(const QPoint &topLeft, MythImage *im, Effects fx); 47 47 48 48 virtual void DrawText(const QRect &dest, const QString &msg, int flags, 49 const MythFontProperties &font, int alpha,49 const MythFontProperties &font, const Effects &fx, 50 50 const QRect &boundRect) = 0; 51 51 52 52 virtual void DrawRect(const QRect &area, -
libs/libmythui/mythpainter_qt.h
27 27 virtual void SetClipRect(const QRect &clipRect); 28 28 29 29 virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, 30 int alpha);30 const Effects &fx); 31 31 virtual void DrawText(const QRect &dest, const QString &msg, int flags, 32 const MythFontProperties &font, int alpha,32 const MythFontProperties &font, const Effects &fx, 33 33 const QRect &boundRect); 34 34 virtual void DrawRect(const QRect &area, 35 35 bool drawFill, const QColor &fillColor, -
libs/libmythui/mythuitype.h
11 11 #include "mythrect.h" 12 12 #include "mythgesture.h" 13 13 14 struct Effects 15 { 16 int alpha; 17 }; 18 14 19 class MythImage; 15 20 class MythPainter; 16 21 class MythGestureEvent; … … 76 81 // Called each draw pulse. Will redraw automatically if dirty afterwards 77 82 virtual void Pulse(void); 78 83 79 void Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod = 255,84 void Draw(MythPainter *p, int xoffset, int yoffset, Effects fx, 80 85 QRect clipRegion = QRect()); 81 86 82 87 virtual void SetPosition(int x, int y); … … 147 152 148 153 protected: 149 154 virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, 150 int alphaMod, QRect clipRegion);155 Effects fx, QRect clipRegion); 151 156 152 157 void AddFocusableChildrenToList(QMap<int, MythUIType *> &focusList); 153 158 void HandleAlphaPulse(); … … 180 185 QRegion m_DirtyRegion; 181 186 bool m_NeedsRedraw; 182 187 183 int m_Alpha; 188 Effects m_Effects; 189 184 190 int m_AlphaChangeMode; // 0 - none, 1 - once, 2 - cycle 185 191 int m_AlphaChange; 186 192 int m_AlphaMin; -
libs/libmythui/mythpainter_vdpau.cpp
97 97 DeleteBitmaps(); 98 98 99 99 if (m_target) 100 m_render->DrawBitmap(0, m_target, NULL, NULL );100 m_render->DrawBitmap(0, m_target, NULL, NULL, NULL); 101 101 else if (m_swap_control) 102 102 m_render->WaitForFlip(); 103 103 … … 139 139 } 140 140 141 141 void MythVDPAUPainter::DrawImage(const QRect &r, MythImage *im, 142 const QRect &src, int alpha)142 const QRect &src, const Effects &fx) 143 143 { 144 144 if (m_render) 145 145 m_render->DrawBitmap(GetTextureFromCache(im), m_target, 146 &src, &r /*dst*/, alpha, 255, 255, 255);146 &src, &r /*dst*/, &fx, 255, 255, 255); 147 147 } 148 148 149 149 void MythVDPAUPainter::DrawText(const QRect &r, const QString &msg, 150 150 int flags, const MythFontProperties &font, 151 int alpha, const QRect &boundRect)151 const Effects &fx, const QRect &boundRect) 152 152 { 153 153 MythImage *im = GetImageFromString(msg, flags, r, font); 154 154 if (!im) … … 189 189 srcRect.setRect(x,y,width,height); 190 190 } 191 191 192 DrawImage(destRect, im, srcRect, alpha);192 DrawImage(destRect, im, srcRect, fx); 193 193 } 194 194 195 195 void MythVDPAUPainter::DrawRect(const QRect &area, bool drawFill, … … 198 198 { 199 199 if (m_render) 200 200 { 201 m_render->DrawBitmap(0, m_target, NULL, &area, fillColor.alpha(), 201 Effects fx; 202 fx.alpha = fillColor.alpha(); 203 204 m_render->DrawBitmap(0, m_target, NULL, &area, &fx, 202 205 fillColor.red(), fillColor.green(), 203 206 fillColor.blue()); 204 207 … … 210 213 QSize(lineWidth, area.height())); 211 214 QRect right(QPoint(area.x() + area.width() - lineWidth, area.y()), 212 215 QSize(lineWidth, area.height())); 213 m_render->DrawBitmap(0, m_target, NULL, &top, lineColor.alpha(),216 m_render->DrawBitmap(0, m_target, NULL, &top, &fx, 214 217 lineColor.red(), lineColor.green(), 215 218 lineColor.blue()); 216 m_render->DrawBitmap(0, m_target, NULL, &bot, lineColor.alpha(),219 m_render->DrawBitmap(0, m_target, NULL, &bot, &fx, 217 220 lineColor.red(), lineColor.green(), 218 221 lineColor.blue()); 219 m_render->DrawBitmap(0, m_target, NULL, &left, lineColor.alpha(),222 m_render->DrawBitmap(0, m_target, NULL, &left, &fx, 220 223 lineColor.red(), lineColor.green(), 221 224 lineColor.blue()); 222 m_render->DrawBitmap(0, m_target, NULL, &right, lineColor.alpha(),225 m_render->DrawBitmap(0, m_target, NULL, &right, &fx, 223 226 lineColor.red(), lineColor.green(), 224 227 lineColor.blue()); 225 228 } … … 235 238 if (!im) 236 239 return; 237 240 238 DrawImage(area, im, QRect(0, 0, area.width(), area.height()), 255); 241 Effects fx; 242 fx.alpha = 255; 243 244 DrawImage(area, im, QRect(0, 0, area.width(), area.height()), fx); 239 245 } 240 246 241 247 MythImage *MythVDPAUPainter::GetFormatImage() -
libs/libmythui/mythuishape.h
26 26 27 27 protected: 28 28 virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, 29 int alphaMod, QRect clipRect);29 Effects fx, QRect clipRect); 30 30 31 31 virtual bool ParseElement( 32 32 const QString &filename, QDomElement &element, bool showWarnings); -
libs/libmythui/mythuiguidegrid.h
22 22 ~MythUIGuideGrid(); 23 23 24 24 virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, 25 int alphaMod, QRect clipRect);25 Effects fx, QRect clipRect); 26 26 27 27 enum FillType { Alpha = 10, Dense, Eco, Solid }; 28 28 -
libs/libmythui/mythpainter_yuva.h
15 15 16 16 QString GetName(void) { return QString("YUVA"); } 17 17 void DrawImage(const QRect &dest, MythImage *im, const QRect &src, 18 int alpha);18 const Effects &fx); 19 19 void DrawText(const QRect &dest, const QString &msg, int flags, 20 const MythFontProperties &font, int alpha,20 const MythFontProperties &font, const Effects &fx, 21 21 const QRect &boundRect); 22 22 void DrawRect(const QRect &area, bool drawFill, const QColor &fillColor, 23 23 bool drawLine, int lineWidth, const QColor &lineColor); -
libs/libmythui/mythuiimage.cpp
1029 1029 * \copydoc MythUIType::DrawSelf() 1030 1030 */ 1031 1031 void MythUIImage::DrawSelf(MythPainter *p, int xoffset, int yoffset, 1032 int alphaMod, QRect clipRect)1032 Effects fx, QRect clipRect) 1033 1033 { 1034 1034 m_ImagesLock.lock(); 1035 1035 if (m_Images.size() > 0) … … 1052 1052 QRect area = GetArea().toQRect(); 1053 1053 area.translate(xoffset, yoffset); 1054 1054 1055 int alpha = CalcAlpha(alphaMod);1055 fx.alpha = CalcAlpha(fx.alpha); 1056 1056 1057 1057 MythImage *currentImage = m_Images[m_CurPos]; 1058 1058 if (currentImage) … … 1088 1088 else 1089 1089 srcRect = currentImageArea; 1090 1090 1091 p->DrawImage(area, currentImage, srcRect, alpha);1091 p->DrawImage(area, currentImage, srcRect, fx); 1092 1092 currentImage->DownRef(); 1093 1093 d->m_UpdateLock.unlock(); 1094 1094 } -
libs/libmythui/mythuitext.cpp
281 281 } 282 282 283 283 void MythUIText::DrawSelf(MythPainter *p, int xoffset, int yoffset, 284 int alphaMod, QRect clipRect)284 Effects fx, QRect clipRect) 285 285 { 286 286 QRect area = GetArea().toQRect(); 287 287 area.translate(xoffset, yoffset); 288 288 QRect drawrect = m_drawRect.toQRect(); 289 289 drawrect.translate(xoffset, yoffset); 290 290 291 int alpha = CalcAlpha(alphaMod);291 fx.alpha = CalcAlpha(fx.alpha); 292 292 293 p->DrawText(drawrect, m_CutMessage, m_Justification, *m_Font, alpha, area);293 p->DrawText(drawrect, m_CutMessage, m_Justification, *m_Font, fx, area); 294 294 } 295 295 296 296 /* -
libs/libmythui/mythuiguidegrid.cpp
291 291 } 292 292 293 293 void MythUIGuideGrid::DrawSelf(MythPainter *p, int xoffset, int yoffset, 294 int alphaMod, QRect clipRect)294 Effects fx, QRect clipRect) 295 295 { 296 int alphaMod = fx.alpha; 296 297 for (int i = 0; i < m_rowCount; i++) 297 298 { 298 299 QList<UIGTCon*>::iterator it = allData[i].begin(); … … 383 384 QRect area = data->drawArea; 384 385 area.translate(m_Area.x(), m_Area.y()); 385 386 area.adjust(breakin, breakin, -breakin, -breakin); 387 Effects fx; 388 fx.alpha = CalcAlpha(alphaMod); 386 389 387 390 // draw arrows 388 391 if (data->arrow != 0) … … 392 395 if (m_verticalLayout) 393 396 { 394 397 p->DrawImage(area.left() + (area.width() / 2) - (m_arrowImages[2]->width() / 2), 395 area.top() , m_arrowImages[2], alphaMod);398 area.top() , m_arrowImages[2], fx); 396 399 } 397 400 else 398 401 { 399 402 p->DrawImage(area.left(), area.top() + (area.height() / 2) - 400 (m_arrowImages[0]->height() / 2), m_arrowImages[0], alphaMod);403 (m_arrowImages[0]->height() / 2), m_arrowImages[0], fx); 401 404 } 402 405 } 403 406 if (data->arrow == 2 || data->arrow == 3) … … 405 408 if (m_verticalLayout) 406 409 { 407 410 p->DrawImage(area.left() + (area.width() / 2) - (m_arrowImages[3]->width() / 2), 408 area.top() + area.height() - m_arrowImages[3]->height(), m_arrowImages[3], alphaMod);411 area.top() + area.height() - m_arrowImages[3]->height(), m_arrowImages[3], fx); 409 412 } 410 413 else 411 414 { 412 415 p->DrawImage(area.right() - m_arrowImages[1]->width(), 413 416 area.top() + (area.height() / 2) - 414 (m_arrowImages[1]->height() / 2), m_arrowImages[1], alphaMod);417 (m_arrowImages[1]->height() / 2), m_arrowImages[1], fx); 415 418 } 416 419 } 417 420 } … … 421 424 { 422 425 p->DrawImage(area.right() - m_recImages[data->recType]->width(), 423 426 area.bottom() - m_recImages[data->recType]->height(), 424 m_recImages[data->recType], alphaMod);427 m_recImages[data->recType], fx); 425 428 } 426 429 } 427 430 … … 521 524 if (m_drawCategoryText && !data->category.isEmpty()) 522 525 msg += QString(" (%1)").arg(data->category); 523 526 527 Effects fx; 528 fx.alpha = CalcAlpha(alphaMod); 529 524 530 QRect area = data->drawArea; 525 531 area.translate(m_Area.x(), m_Area.y()); 526 532 area.adjust(m_textOffset.x(), m_textOffset.y(), … … 544 550 if (area.width() <= 0 || area.height() <= 0) 545 551 return; 546 552 547 p->DrawText(area, msg, m_justification, *m_font, alphaMod, area);553 p->DrawText(area, msg, m_justification, *m_font, fx, area); 548 554 } 549 555 550 556 void MythUIGuideGrid::SetProgramInfo(int row, int col, const QRect &area, -
libs/libmythui/mythpainter_ogl.cpp
182 182 } 183 183 184 184 void MythOpenGLPainter::DrawImage(const QRect &r, MythImage *im, 185 const QRect &src, int alpha)185 const QRect &src, const Effects &fx) 186 186 { 187 187 188 188 if (realRender) 189 189 realRender->DrawBitmap(GetTextureFromCache(im), target, 190 &src, &r, 0, alpha);190 &src, &r, 0, &fx); 191 191 } 192 192 193 193 MythImage *MythOpenGLPainter::GetImageFromString(const QString &msg, … … 307 307 308 308 void MythOpenGLPainter::DrawText(const QRect &r, const QString &msg, 309 309 int flags, const MythFontProperties &font, 310 int alpha, const QRect &boundRect)310 const Effects &fx, const QRect &boundRect) 311 311 { 312 312 if (r.width() <= 0 || r.height() <= 0) 313 313 return; … … 352 352 srcRect.setRect(x,y,width,height); 353 353 } 354 354 355 DrawImage(destRect, im, srcRect, alpha);355 DrawImage(destRect, im, srcRect, fx); 356 356 } 357 357 358 358 void MythOpenGLPainter::DrawRect(const QRect &area, … … 400 400 401 401 MythImage *im = GetFormatImage(); 402 402 im->Assign(image); 403 MythPainter::DrawImage(area.x(), area.y(), im, 255); 403 404 Effects fx = { 255 }; 405 406 MythPainter::DrawImage(area.x(), area.y(), im, fx); 404 407 im->DownRef(); 405 408 } 406 409 -
libs/libmythui/mythrender_vdpau.cpp
617 617 m_outputSurfaces.insert(id, VDPAUOutputSurface(tmp, size, fmt)); 618 618 id_lock.unlock(); 619 619 620 DrawBitmap(0, id, NULL, NULL );620 DrawBitmap(0, id, NULL, NULL, NULL); 621 621 return id; 622 622 } 623 623 … … 1308 1308 1309 1309 bool MythRenderVDPAU::DrawBitmap(uint id, uint target, 1310 1310 const QRect *src, const QRect *dst, 1311 int alpha, int red, int green, int blue,1311 const Effects *fx, int red, int green, int blue, 1312 1312 bool blend) 1313 1313 { 1314 1314 uint bitmap = VDP_INVALID_HANDLE; … … 1357 1357 vsrc.y1 = src->y() + src->height(); 1358 1358 } 1359 1359 1360 int alpha = 255; 1361 if (fx) 1362 { 1363 alpha = fx->alpha; 1364 } 1365 1360 1366 VdpColor color; 1361 1367 bool nullblend = (red == 0 && green == 0 && blue == 0 && alpha == 0); 1362 1368 if (!nullblend) -
libs/libmythui/mythuiwebbrowser.cpp
628 628 * \copydoc MythUIType::DrawSelf() 629 629 */ 630 630 void MythUIWebBrowser::DrawSelf(MythPainter *p, int xoffset, int yoffset, 631 int alphaMod, QRect clipRegion)631 Effects fx, QRect clipRegion) 632 632 { 633 633 if (!m_image || m_image->isNull() || !m_browser || m_browser->hasFocus()) 634 634 return; … … 636 636 QRect area = m_Area; 637 637 area.translate(xoffset, yoffset); 638 638 639 p->DrawImage(area.x(), area.y(), m_image, alphaMod);639 p->DrawImage(area.x(), area.y(), m_image, fx); 640 640 } 641 641 642 642 /** -
libs/libmythui/mythrender_opengl.cpp
894 894 } 895 895 896 896 void MythRenderOpenGL::DrawBitmap(uint tex, uint target, const QRect *src, 897 const QRect *dst, uint prog, int alpha,897 const QRect *dst, uint prog, const Effects *fx, 898 898 int red, int green, int blue) 899 899 { 900 900 if (tex && !m_textures.contains(tex)) … … 931 931 BindFramebuffer(target); 932 932 EnableFragmentProgram(prog); 933 933 SetBlend(true); 934 SetColor(red, green, blue, alpha);934 SetColor(red, green, blue, fx->alpha); 935 935 if (tex) 936 936 { 937 937 EnableTextures(tex); -
libs/libmythui/mythuiimage.h
61 61 62 62 protected: 63 63 virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, 64 int alphaMod, QRect clipRect);64 Effects fx, QRect clipRect); 65 65 66 66 void Init(void); 67 67 void Clear(void); -
libs/libmythui/mythpainter_qimage.h
33 33 virtual void Clear(QPaintDevice *device, const QRegion ®ion); 34 34 35 35 virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, 36 int alpha);36 const Effects &fx); 37 37 virtual void DrawText(const QRect &dest, const QString &msg, int flags, 38 const MythFontProperties &font, int alpha,38 const MythFontProperties &font, const Effects &fx, 39 39 const QRect &boundRect); 40 40 virtual void DrawRect(const QRect &area, 41 41 bool drawFill, const QColor &fillColor,