Ticket #12489: mythui.diff

File mythui.diff, 3.4 KB (added by lomion@…, 10 years ago)

Fixed copy constructor

  • mythtv/libs/libmythui/mythuiimage.cpp

    diff --git a/mythtv/libs/libmythui/mythuiimage.cpp b/mythtv/libs/libmythui/mythuiimage.cpp
    index 5674bf1..9647bad 100644
    a b void ImageProperties::Copy(const ImageProperties &other) 
    8585    preserveAspect = other.preserveAspect;
    8686    isGreyscale = other.isGreyscale;
    8787    isReflected = other.isReflected;
    88     isMasked = other.isMasked;
    8988
    9089    reflectAxis = other.reflectAxis;
    9190    reflectScale = other.reflectScale;
    void ImageProperties::Copy(const ImageProperties &other) 
    9493    reflectSpacing = other.reflectSpacing;
    9594
    9695    SetMaskImage(other.maskImage);
     96        isMasked = other.isMasked;
     97        maskImageFilename = other.maskImageFilename;
     98    maskImageFilename.detach();
    9799}
    98100
    99101void ImageProperties::SetMaskImage(MythImage *image)
    class ImageLoader 
    306308
    307309            if (imProps.isMasked)
    308310            {
     311                                MythImage *newMaskImage = painter->GetFormatImage();
     312                                if (newMaskImage->Load(imProps.GetMaskImageFilename()))
     313                                        imProps.SetMaskImage(newMaskImage);
     314                                else
     315                                        imProps.SetMaskImage(NULL);
     316                                newMaskImage->DecrRef();
     317               
     318                if (imProps.isMasked)
     319                                {
    309320                QRect imageArea = image->rect();
    310321                QRect maskArea = imProps.GetMaskImageRect();
    311322
    class ImageLoader 
    325336                QImage mask = imProps.GetMaskImageSubset(imageArea);
    326337                image->setAlphaChannel(mask.alphaChannel());
    327338            }
     339            }
    328340
    329341            if (imProps.isReflected)
    330342                image->Reflect(imProps.reflectAxis, imProps.reflectShear,
    bool MythUIImage::ParseElement( 
    13631375    }
    13641376    else if (element.tagName() == "mask")
    13651377    {
    1366         QString maskfile = getFirstText(element);
    1367 
    1368         MythImage *newMaskImage = GetPainter()->GetFormatImage();
    1369         if (newMaskImage->Load(maskfile))
    1370             m_imageProperties.SetMaskImage(newMaskImage);
    1371         else
    1372             m_imageProperties.SetMaskImage(NULL);
    1373         newMaskImage->DecrRef();
     1378        m_imageProperties.SetMaskImageFilename(getFirstText(element));
     1379                m_imageProperties.isMasked = true;
    13741380    }
    13751381    else if (element.tagName() == "grayscale" ||
    13761382             element.tagName() == "greyscale")
  • mythtv/libs/libmythui/mythuiimage.h

    diff --git a/mythtv/libs/libmythui/mythuiimage.h b/mythtv/libs/libmythui/mythuiimage.h
    index a90ee3f..85abb65 100644
    a b class ImageProperties 
    3030    ImageProperties &operator=(const ImageProperties &other);
    3131
    3232    void SetMaskImage(MythImage *image);
     33        void SetMaskImageFilename(const QString &filename)
     34        {
     35                maskImageFilename=filename;
     36        }
     37        QString GetMaskImageFilename()
     38        {
     39                return maskImageFilename;
     40        }
    3341    QRect GetMaskImageRect(void)
    3442    {
    3543        QRect rect;
    class ImageProperties 
    6876    void Copy(const ImageProperties &other);
    6977
    7078    MythImage *maskImage;
     79        QString maskImageFilename;
    7180};
    7281
    7382typedef QPair<MythImage *, int> AnimationFrame;
  • mythtv/libs/libmythui/mythuitext.cpp

    diff --git a/mythtv/libs/libmythui/mythuitext.cpp b/mythtv/libs/libmythui/mythuitext.cpp
    index 60fa71f..76fbce4 100644
    a b void MythUIText::Pulse(void) 
    11761176        }
    11771177    }
    11781178
     1179//    if (m_scrolling && !GetMythUI()->GetScreenIsAsleep())
    11791180    if (m_scrolling)
    11801181    {
    11811182        int whole;