[wx 2.8.0, XP, MSVC6] Bug in wxBufferedPaintDC with wxBUFFER_VIRTUAL_AREA style ?

Sébastien Gallou sebastien.gallou at gmail.com
Mon Mar 5 00:26:38 PST 2007


Yes, it works (I have only tested it in the wxScrolledWindow context).
Thank you !
S=E9bastien


2007/3/4, Vadim Zeitlin <vadim at wxwindows.org>:
>
> On Thu, 1 Mar 2007 08:32:18 +0100 S=E9bastien Gallou <
> sebastien.gallou at gmail.com> wrote:
>
> SG> I have found everything that seems strange to me.
> SG> When using wxBufferedPaintDC with wxScrolledWindow, I must set the
> SG> wxBUFFER_VIRTUAL_AREA style, which make prepare the DC by the
> constructor of
> SG> wxBufferedPaintDC, and set the size for this dc. Here is the problem :
> the
> SG> size come from the window client size, by a call to GetClientSize()
> SG> independently if wxBUFFER_VIRTUAL_AREA style is used or not. I think
> in the
> SG> case where wxBUFFER_VIRTUAL_AREA style is used, the size whould come
> from
> SG> GetVirtualSize, isn't it ?
>
> Yes, I think you're right. Could you please check if the following patch
> fixes the problem:
>
> Index: include/wx/dcbuffer.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /pack/cvsroots/wxwidgets/wxWindows/include/wx/dcbuffer.h,v
> retrieving revision 1.34
> diff -u -2 -r1.34 dcbuffer.h
> --- include/wx/dcbuffer.h       2006/11/01 02:07:36     1.34
> +++ include/wx/dcbuffer.h       2007/03/04 21:08:09
> @@ -174,5 +174,5 @@
>              Init(&m_paintdc, buffer, style);
>          else
> -            Init(&m_paintdc, window->GetClientSize(), style);
> +            Init(&m_paintdc, GetBufferedSize(window, style), style);
>      }
>
> @@ -185,5 +185,5 @@
>              window->PrepareDC( m_paintdc );
>
> -        Init(&m_paintdc, window->GetClientSize(), style);
> +        Init(&m_paintdc, GetBufferedSize(window, style), style);
>      }
>
> @@ -195,4 +195,13 @@
>          // does it, the PaintDC will have already been destroyed.
>          UnMask();
> +    }
> +
> +protected:
> +    // return the size needed by the buffer: this depends on whether
> we're
> +    // buffering just the currently shown part or the total (scrolled)
> window
> +    static wxSize GetBufferedSize(wxWindow *window, int style)
> +    {
> +        return style & wxBUFFER_VIRTUAL_AREA ? window->GetVirtualSize()
> +                                             : window->GetClientSize();
>      }
>
> ?
>
> Thanks,
> VZ
>
> --
> TT-Solutions: wxWidgets consultancy and technical support
>                http://www.tt-solutions.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20070305/209=
060c5/attachment.htm


More information about the wx-users mailing list