Philipp Lohmann a écrit :
Hi,

Hi Philipp,


You would have a VirtualDevice that spans the area where you currently have "flickering" problems. So when the need to change the contents of that area arises, you can do all painting in that backbuffer and only copy it to window when you're done.

So like this:


1)

#include "vcl/virdev.hxx"

OK, using virdev.hxx

2)
void UpdateAffectedArea()
{


Ok. More precisely, I added UpdateAffectedArea as private method in BackingWindow class, and works perfectly.

3)

    VirtualDevice aDev;

Done

4)
    aDev.SetBackground( Color( < my background color > ) );

Done, using COL_TRANSPARENT (found somewhere in tools)

5)

    aDev.SetOutputSizePixel( < my size in pixel > );

Ok, done.

6)

    maFixedText.Draw( &aDev, <position>, <size>, <flags> );


What does the Draw method ?

I was not sure, so I added a parameter in the signature ( like Point(0,0) per see the compiler cry and propose me correct candidates, and I found the header location <vcl/fixed.hxx> (yes, I'm lazy sometimes :)

So I had a look at the implementation and the Draw method does nothing (see vcl/source/control/fixed.cxx:634).

So I removed the action below and it works the same. At least, is seems to.

7)


    maWindow.DrawOutDev(
<position in window>, <my size in pixel>,
        Point( 0, 0 ), <my size in pixel>,
&aDev );

Works : I can draw/hide text without use Show(), Hide()


... but unfortunaly I still got the flicker. Less, but still flicker (tested on Linux).

What did i wrong ? (below, some important lines, just in case I did something completely wrong). Thanks in advance for any hint.


Kind regards,
Eric




void BackingWindow::UpdateAffectedArea()
{
    long nYPos = maControlRect.Top() + MESSAGE_OFFSET_Y /* value:295 */;
    Size aWindowSize( GetSizePixel() );
    Size aControlSize = maControlRect.GetSize();
maControlRect = Rectangle( Point( (aWindowSize.Width() - aControlSize.Width()) / 2 , (aWindowSize.Height() - aControlSize.Height()) / 2 ),
                                aControlSize );
maMessageText.SetPosSizePixel( Point( (aWindowSize.Width() maMessageSize.Width() + STRING_OFFSET_X) / 2 , nYPos ), Size( maControlRect.GetWidth(), maMessageSize.Height() ) );

    VirtualDevice aDev;
    aDev.SetBackground( Color( COL_TRANSPARENT ) );
    aDev.SetOutputSizePixel( maMessageSize );


    /*
     * DrawOutDev signature, taken from <vcl/outdev.hxx>
     * void DrawOutDev(  const Point& rDestPt, const Size& rDestSize,
     *                   const Point& rSrcPt,  const Size& rSrcSize,
     *                   const OutputDevice& rOutDev );
     */

DrawOutDev(Point( (aWindowSize.Width() - aControlSize.Width()) / 2 , (aWindowSize.Height() - aControlSize.Height()) / 2 ),
        Size( maControlRect.GetWidth(), maMessageSize.Height() ),
Point( 2000,2000) /* draw offscreen ?, else garbage at Point(0,0) */,
        Size(0,0),
         aDev );
}

IMPL_LINK( BackingWindow, DecoToolboxHdl, VclWindowEvent*, pEvent )
{
    if( pEvent && pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT )
    {

        ...
        ...

        (all cases)

    }
    else if( pEvent && pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHTOFF )
    {
        maMessageText.SetText( maEmptyString );
maMessageSize = Size( maMessageText.GetTextWidth( maWriterString ), maMessageText.GetTextHeight() );
    }

    UpdateAffectedArea(); /* made once only*/

    return 0;
}

--
Education Project:
http://wiki.services.openoffice.org/wiki/Education_Project
Projet OOo4Kids : http://wiki.ooo4kids.org/index.php/Main_Page
L'association EducOOo : http://www.educoo.org
Blog : http://eric.bachard.org/news

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@gsl.openoffice.org
For additional commands, e-mail: dev-h...@gsl.openoffice.org

Reply via email to