Index: libs/libmythui/mythpainter.cpp =================================================================== --- libs/libmythui/mythpainter.cpp (revision 21131) +++ libs/libmythui/mythpainter.cpp (working copy) @@ -9,16 +9,16 @@ { } -void MythPainter::DrawImage(int x, int y, MythImage *im, int alpha) +void MythPainter::DrawImage(int x, int y, MythImage *im, int alpha, Effects fx) { assert(im); QRect dest = QRect(x, y, im->width(), im->height()); QRect src = im->rect(); - DrawImage(dest, im, src, alpha); + DrawImage(dest, im, src, alpha, fx); } -void MythPainter::DrawImage(const QPoint &topLeft, MythImage *im, int alpha) +void MythPainter::DrawImage(const QPoint &topLeft, MythImage *im, int alpha, Effects fx) { - DrawImage(topLeft.x(), topLeft.y(), im, alpha); + DrawImage(topLeft.x(), topLeft.y(), im, alpha, fx); } Index: libs/libmythui/mythpainter_qt.cpp =================================================================== --- libs/libmythui/mythpainter_qt.cpp (revision 21131) +++ libs/libmythui/mythpainter_qt.cpp (working copy) @@ -72,7 +72,7 @@ } void MythQtPainter::DrawImage(const QRect &r, MythImage *im, - const QRect &src, int alpha) + const QRect &src, int alpha, Effects fx) { assert(painter); (void)alpha; Index: libs/libmythui/mythuishape.cpp =================================================================== --- libs/libmythui/mythuishape.cpp (revision 21131) +++ libs/libmythui/mythuishape.cpp (working copy) @@ -58,8 +58,9 @@ DrawRoundRect(area, m_cornerRadius, m_drawFill, m_fillColor, m_drawLine, m_lineWidth, m_lineColor); } - - p->DrawImage(area.x(), area.y(), m_image, alphaMod); +MythPainter::Effects effex; + effex.rotate = 0; + p->DrawImage(area.x(), area.y(), m_image, alphaMod, effex); } void MythUIShape::DrawRect(const QRect &area, Index: libs/libmythui/mythpainter.h =================================================================== --- libs/libmythui/mythpainter.h (revision 21131) +++ libs/libmythui/mythpainter.h (working copy) @@ -20,6 +20,11 @@ public: MythPainter() : m_Parent(0) { } virtual ~MythPainter() { } + struct Effects +{ + int rotate; + int reflectionAxis; +}; virtual QString GetName(void) = 0; virtual bool SupportsAnimation(void) = 0; @@ -34,10 +39,10 @@ QWidget *GetParent(void) { return m_Parent; } virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, - int alpha) = 0; + int alpha, Effects) = 0; - void DrawImage(int x, int y, MythImage *im, int alpha); - void DrawImage(const QPoint &topLeft, MythImage *im, int alph); + void DrawImage(int x, int y, MythImage *im, int alpha, Effects effect); + void DrawImage(const QPoint &topLeft, MythImage *im, int alph, Effects); virtual void DrawText(const QRect &dest, const QString &msg, int flags, const MythFontProperties &font, int alpha, Index: libs/libmythui/mythpainter_qt.h =================================================================== --- libs/libmythui/mythpainter_qt.h (revision 21131) +++ libs/libmythui/mythpainter_qt.h (working copy) @@ -25,7 +25,7 @@ virtual void SetClipRect(const QRect &clipRect); virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, - int alpha); + int alpha, Effects fx); virtual void DrawText(const QRect &dest, const QString &msg, int flags, const MythFontProperties &font, int alpha, const QRect &boundRect); Index: libs/libmythui/mythpainter_ogl.h =================================================================== --- libs/libmythui/mythpainter_ogl.h (revision 21131) +++ libs/libmythui/mythpainter_ogl.h (working copy) @@ -21,7 +21,7 @@ virtual void End(); virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, - int alpha); + int alpha, Effects fx); virtual void DrawText(const QRect &dest, const QString &msg, int flags, const MythFontProperties &font, int alpha, const QRect &boundRect); Index: libs/libmythui/mythuiimage.cpp =================================================================== --- libs/libmythui/mythuiimage.cpp (revision 21131) +++ libs/libmythui/mythuiimage.cpp (working copy) @@ -101,7 +101,7 @@ m_reflectScale = m_reflectLength = 100; m_reflectAxis = ReflectVertical; m_reflectSpacing = 0; - +m_rotate = 0; m_gradient = false; m_gradientStart = QColor("#505050"); m_gradientEnd = QColor("#000000"); @@ -564,8 +564,10 @@ srcRect = m_cropRect.toQRect(); else srcRect = currentImageArea; - - p->DrawImage(area, currentImage, srcRect, alpha); + MythPainter::Effects fx; + fx.rotate = m_rotate; + p->DrawImage(area, currentImage, srcRect, alpha, fx); + fx.rotate = 0; } } @@ -685,6 +687,10 @@ { m_isGreyscale = parseBool(element); } + else if (element.tagName() == "rotate") + { + m_rotate = getFirstText(element).toInt(); + } else return MythUIType::ParseElement(element); @@ -710,7 +716,7 @@ m_Filename = im->m_Filename; m_OrigFilename = im->m_OrigFilename; - +m_rotate = im->m_rotate; m_cropRect = im->m_cropRect; m_ForceSize = im->m_ForceSize; Index: libs/libmythui/mythuiguidegrid.cpp =================================================================== --- libs/libmythui/mythuiguidegrid.cpp (revision 21131) +++ libs/libmythui/mythuiguidegrid.cpp (working copy) @@ -345,16 +345,20 @@ arrowImg = &m_arrowImages[2]; MythImage *im = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage(); im->Assign(*arrowImg); + MythPainter::Effects effex; + effex.rotate = 0; p->DrawImage(area.left() + (area.width() / 2) - (arrowImg->height() / 2), - area.top() , im, alphaMod); + area.top() , im, alphaMod, effex); } else { arrowImg = &m_arrowImages[0]; MythImage *im = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage(); im->Assign(*arrowImg); + MythPainter::Effects effex; + effex.rotate = 0; p->DrawImage(area.left(), area.top() + (area.height() / 2) - - (arrowImg->height() / 2), im, alphaMod); + (arrowImg->height() / 2), im, alphaMod, effex); } } if (data->arrow == 2 || data->arrow == 3) @@ -365,8 +369,10 @@ MythImage *im = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage(); im->Assign(*arrowImg); recTypeOffset = arrowImg->width(); + MythPainter::Effects effex; + effex.rotate = 0; p->DrawImage(area.left() + (area.width() / 2) - (arrowImg->height() / 2), - area.top() + area.height() - arrowImg->height(), im, alphaMod); + area.top() + area.height() - arrowImg->height(), im, alphaMod, effex); } else { @@ -374,9 +380,11 @@ MythImage *im = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage(); im->Assign(*arrowImg); recTypeOffset = arrowImg->width(); + MythPainter::Effects effex; + effex.rotate = 0; p->DrawImage(area.right() - arrowImg->width(), area.top() + (area.height() / 2) - - (arrowImg->height() / 2), im, alphaMod); + (arrowImg->height() / 2), im, alphaMod, effex); } } } @@ -387,8 +395,10 @@ QPixmap *recImg = &m_recImages[data->recType]; MythImage *im = GetMythMainWindow()->GetCurrentPainter()->GetFormatImage(); im->Assign(*recImg); + MythPainter::Effects effex; + effex.rotate = 0; p->DrawImage(area.right() - recImg->width(), - area.bottom() - recImg->height(), im, alphaMod); + area.bottom() - recImg->height(), im, alphaMod, effex); } } Index: libs/libmythui/mythpainter_ogl.cpp =================================================================== --- libs/libmythui/mythpainter_ogl.cpp (revision 21131) +++ libs/libmythui/mythpainter_ogl.cpp (working copy) @@ -224,6 +224,8 @@ glGenTextures(1, &tx_id); glBindTexture(q_gl_texture, tx_id); glTexParameteri(q_gl_texture, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +glTexParameteri(q_gl_texture, GL_TEXTURE_WRAP_S, GL_CLAMP); +glTexParameteri(q_gl_texture, GL_TEXTURE_WRAP_T, GL_CLAMP); if (generate_mipmaps) { @@ -249,25 +251,25 @@ } void MythOpenGLPainter::DrawImage(const QRect &r, MythImage *im, - const QRect &src, int alpha) + const QRect &src, int alpha, Effects fx) { double x1, y1, x2, y2; + int angle = fx.rotate; glClearDepth(1.0f); - - // see if we have this pixmap cached as a texture - if not cache it + // see if we have this pixmap cached as a texture - if not cache it BindTextureFromCache(im); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glPushAttrib(GL_CURRENT_BIT); - glColor4f(1.0, 1.0, 1.0, alpha / 255.0); + glPushMatrix(); glEnable(q_gl_texture); glEnable(GL_BLEND); - + + glRotatef(angle, 0.0, 0.0, 1.0); // do rotate op glBegin(GL_QUADS); { + if (!texture_rects) { x1 = src.x() / (double)im->width(); @@ -290,11 +292,13 @@ glTexCoord2f(x2, y2); glVertex2f(r.x() + width, r.y()); glTexCoord2f(x2, y1); glVertex2f(r.x() + width, r.y() + height); glTexCoord2f(x1, y1); glVertex2f(r.x(), r.y()+height); + } glEnd(); - + glPopMatrix(); glDisable(GL_BLEND); - glDisable(q_gl_texture); + glDisable(q_gl_texture); + //VERBOSE(VB_GENERAL, QString("Rotation Angle: %1. %2, %3 : %4, %5").arg(angle).arg(x1).arg(y1).arg(x2).arg(y2)); glPopAttrib(); } @@ -498,8 +502,9 @@ srcRect.setRect(x,y,width,height); } - - DrawImage(destRect, im, srcRect, alpha); + MythPainter::Effects effex; + effex.rotate = 0; + DrawImage(destRect, im, srcRect, alpha, effex); } void MythOpenGLPainter::DrawRect(const QRect &area, @@ -586,7 +591,9 @@ MythImage *im = GetFormatImage(); im->Assign(image); - MythPainter::DrawImage(area.x(), area.y(), im, 255); + MythPainter::Effects effex; + effex.rotate = 0; + MythPainter::DrawImage(area.x(), area.y(), im, 255, effex); im->DownRef(); } Index: libs/libmythui/mythuiwebbrowser.cpp =================================================================== --- libs/libmythui/mythuiwebbrowser.cpp (revision 21131) +++ libs/libmythui/mythuiwebbrowser.cpp (working copy) @@ -549,8 +549,9 @@ QRect area = m_Area; area.translate(xoffset, yoffset); - - p->DrawImage(area.x(), area.y(), m_image, alphaMod); +MythPainter::Effects effex; + effex.rotate = 0; + p->DrawImage(area.x(), area.y(), m_image, alphaMod, effex); } /** \brief Key event handler Index: libs/libmythui/mythuiimage.h =================================================================== --- libs/libmythui/mythuiimage.h (revision 21131) +++ libs/libmythui/mythuiimage.h (working copy) @@ -24,7 +24,7 @@ /** Must be followed by a call to Load() to load the image. */ void SetFilename(const QString &filename); - + /** Must be followed by a call to Load() to load the image. */ void SetFilepattern(const QString &filepattern, int low, int high); @@ -96,7 +96,7 @@ int m_reflectScale; int m_reflectLength; int m_reflectSpacing; - + int m_rotate; MythImage *m_maskImage; bool m_isMasked; The above code changes result in http://imagebin.ca/view/faSdWB.html The top image has been set to rotate 15 degrees, which seems to work fine - it's on its own. BUT the buttonlist items - the icon images have seemingly all been rotated in one clump.