Added wxMemoryDC::SelectObjectAsSource() and make SelectObject() unshare
the bitmap to ensure that no other bitmaps are modified; also remove some code duplication by introducing wxMemoryDCBase (patch 1580745) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -62,7 +62,7 @@ buffering on the systems which already do it automatically.
|
|||||||
|
|
||||||
\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
||||||
|
|
||||||
\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
\func{}{wxBufferedDC}{\param{wxDC *}{dc}, \param{wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
||||||
|
|
||||||
If you use the first, default, constructor, you must call one of the
|
If you use the first, default, constructor, you must call one of the
|
||||||
\helpref{Init}{wxbuffereddcinit} methods later in order to use the object.
|
\helpref{Init}{wxbuffereddcinit} methods later in order to use the object.
|
||||||
@@ -93,7 +93,7 @@ device context).}
|
|||||||
|
|
||||||
\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxSize\& }{area}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
||||||
|
|
||||||
\func{void}{Init}{\param{wxDC *}{dc}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
\func{void}{Init}{\param{wxDC *}{dc}, \param{wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
||||||
|
|
||||||
These functions initialize the object created using the default constructor.
|
These functions initialize the object created using the default constructor.
|
||||||
Please see \helpref{constructors documentation}{wxbuffereddcctor} for details.
|
Please see \helpref{constructors documentation}{wxbuffereddcctor} for details.
|
||||||
@@ -143,7 +143,7 @@ already does this internally for the real underlying wxPaintDC.
|
|||||||
|
|
||||||
\membersection{wxBufferedPaintDC::wxBufferedPaintDC}\label{wxbufferedpaintdcctor}
|
\membersection{wxBufferedPaintDC::wxBufferedPaintDC}\label{wxbufferedpaintdcctor}
|
||||||
|
|
||||||
\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{const wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{wxBitmap\& }{buffer}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
||||||
|
|
||||||
\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
\func{}{wxBufferedPaintDC}{\param{wxWindow *}{window}, \param{int }{style = wxBUFFER\_CLIENT\_AREA}}
|
||||||
|
|
||||||
|
@@ -41,26 +41,55 @@ can be reselected into another memory DC.
|
|||||||
|
|
||||||
\membersection{wxMemoryDC::wxMemoryDC}\label{wxmemorydcctor}
|
\membersection{wxMemoryDC::wxMemoryDC}\label{wxmemorydcctor}
|
||||||
|
|
||||||
\func{}{wxMemoryDC}{\param{const wxBitmap\& }{bitmap = wxNullBitmap}}
|
\func{}{wxMemoryDC}{\void}
|
||||||
|
|
||||||
Constructs a new memory device context.
|
Constructs a new memory device context.
|
||||||
|
|
||||||
Use the {\it Ok} member to test whether the constructor was successful
|
Use the \helpref{IsOk}{wxdcisok} member to test whether the constructor was successful
|
||||||
in creating a usable device context. If you don't pass a valid bitmap
|
in creating a usable device context.
|
||||||
to the constructor, don't forget to select a bitmap into the DC before
|
Don't forget to select a bitmap into the DC before drawing on it.
|
||||||
drawing on it.
|
|
||||||
|
\func{}{wxMemoryDC}{\param{wxBitmap\& }{bitmap}}
|
||||||
|
|
||||||
|
Constructs a new memory device context and calls \helpref{SelectObject}{wxmemorydcselectobject}
|
||||||
|
with the given bitmap.
|
||||||
|
Use the \helpref{IsOk}{wxdcisok} member to test whether the constructor was successful
|
||||||
|
in creating a usable device context.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxMemoryDC::SelectObject}\label{wxmemorydcselectobject}
|
\membersection{wxMemoryDC::SelectObject}\label{wxmemorydcselectobject}
|
||||||
|
|
||||||
\func{void}{SelectObject}{\param{const wxBitmap\& }{bitmap}}
|
\func{void}{SelectObject}{\param{wxBitmap\& }{bitmap}}
|
||||||
|
|
||||||
|
Works exactly like \helpref{SelectObjectAsSource}{wxmemorydcselectobjectassource} but
|
||||||
|
this is the function you should use when you select a bitmap because you want to modify
|
||||||
|
it, e.g. drawing on this DC.
|
||||||
|
|
||||||
|
Be careful to use this function and not \helpref{SelectObjectAsSource}{wxmemorydcselectobjectassource}
|
||||||
|
when you want to modify the bitmap you are selecting otherwise you may incurr in some
|
||||||
|
problems related to wxBitmap being a reference counted object
|
||||||
|
(see \helpref{reference counting overview}{trefcount}).
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{wxDC::DrawBitmap}{wxdcdrawbitmap}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxMemoryDC::SelectObjectAsSource}\label{wxmemorydcselectobjectassource}
|
||||||
|
|
||||||
|
\func{void}{SelectObjectAsSource}{\param{const wxBitmap\& }{bitmap}}
|
||||||
|
|
||||||
Selects the given bitmap into the device context, to use as the memory
|
Selects the given bitmap into the device context, to use as the memory
|
||||||
bitmap. Selecting the bitmap into a memory DC allows you to draw into
|
bitmap. Selecting the bitmap into a memory DC allows you to draw into
|
||||||
the DC (and therefore the bitmap) and also to use {\bf Blit} to copy
|
the DC (and therefore the bitmap) and also to use \helpref{wxDC::Blit}{wxdcblit} to copy
|
||||||
the bitmap to a window. For this purpose, you may find \helpref{wxDC::DrawIcon}{wxdcdrawicon}\rtfsp
|
the bitmap to a window. For this purpose, you may find \helpref{wxDC::DrawIcon}{wxdcdrawicon}\rtfsp
|
||||||
easier to use instead.
|
easier to use instead.
|
||||||
|
|
||||||
If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is selected out of the device
|
If the argument is wxNullBitmap (or some other uninitialised wxBitmap) the current bitmap is
|
||||||
context, and the original bitmap restored, allowing the current bitmap to
|
selected out of the device context, and the original bitmap restored, allowing the current bitmap to
|
||||||
be destroyed safely.
|
be destroyed safely.
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{wxMemoryDC::SelectObject}{wxmemorydcselectobject}
|
||||||
|
@@ -14,15 +14,19 @@
|
|||||||
|
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxMemoryDC: public wxDC
|
class WXDLLEXPORT wxMemoryDC: public wxDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
||||||
virtual ~wxMemoryDC(void);
|
virtual ~wxMemoryDC(void);
|
||||||
virtual void SelectObject(const wxBitmap& bitmap);
|
|
||||||
virtual void DoGetSize(int *width, int *height) const;
|
virtual void DoGetSize(int *width, int *height) const;
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxBitmap m_selectedBitmap;
|
wxBitmap m_selectedBitmap;
|
||||||
WX_NSImage m_cocoaNSImage;
|
WX_NSImage m_cocoaNSImage;
|
||||||
@@ -34,6 +38,9 @@ protected:
|
|||||||
virtual bool CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest,
|
virtual bool CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest,
|
||||||
wxCoord width, wxCoord height, wxCoord xsrc, wxCoord ysrc,
|
wxCoord width, wxCoord height, wxCoord xsrc, wxCoord ysrc,
|
||||||
int logicalFunc, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask);
|
int logicalFunc, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Init();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -14,6 +14,39 @@
|
|||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
// NOTE: different native implementations of wxMemoryDC will derive from
|
||||||
|
// different wxDC classes (wxPaintDC, wxWindowDC, etc), so that
|
||||||
|
// we cannot derive wxMemoryDCBase from wxDC and then use it as the
|
||||||
|
// only base class for native impl of wxMemoryDC...
|
||||||
|
class wxMemoryDCBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxMemoryDCBase() { }
|
||||||
|
|
||||||
|
// avoid warnings about having virtual functions but non virtual dtor
|
||||||
|
virtual ~wxMemoryDCBase() { }
|
||||||
|
|
||||||
|
// select the given bitmap to draw on it
|
||||||
|
void SelectObject(wxBitmap& bmp)
|
||||||
|
{
|
||||||
|
// make sure that the given wxBitmap is not sharing its data with other
|
||||||
|
// wxBitmap instances as its contents will be modified by any drawing
|
||||||
|
// operation done on this DC
|
||||||
|
if (bmp.IsOk())
|
||||||
|
bmp.UnShare();
|
||||||
|
|
||||||
|
DoSelect(bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// select the given bitmap for read-only
|
||||||
|
virtual void SelectObjectAsSource(const wxBitmap& bmp)
|
||||||
|
{
|
||||||
|
DoSelect(bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void DoSelect(const wxBitmap& bmp) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
#if defined(__WXPALMOS__)
|
#if defined(__WXPALMOS__)
|
||||||
#include "wx/palmos/dcmemory.h"
|
#include "wx/palmos/dcmemory.h"
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
|
@@ -14,19 +14,23 @@
|
|||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMemoryDC : public wxDC
|
class WXDLLIMPEXP_CORE wxMemoryDC : public wxDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC(wxDC *dc); // create compatible DC
|
wxMemoryDC(wxDC *dc); // create compatible DC
|
||||||
|
|
||||||
virtual void SelectObject(const wxBitmap& bitmap);
|
|
||||||
|
|
||||||
// implementation from now on:
|
// implementation from now on:
|
||||||
|
|
||||||
wxBitmap GetSelectedObject() const { return m_bmp; }
|
wxBitmap GetSelectedObject() const { return m_bmp; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Init();
|
||||||
|
|
||||||
wxBitmap m_bmp;
|
wxBitmap m_bmp;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
||||||
|
@@ -23,13 +23,13 @@ class WXDLLIMPEXP_CORE wxMemoryDC;
|
|||||||
// wxMemoryDC
|
// wxMemoryDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC
|
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() : wxWindowDC() { Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) : wxWindowDC() { Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
||||||
virtual ~wxMemoryDC();
|
virtual ~wxMemoryDC();
|
||||||
virtual void SelectObject( const wxBitmap& bitmap );
|
|
||||||
|
|
||||||
// these get reimplemented for mono-bitmaps to behave
|
// these get reimplemented for mono-bitmaps to behave
|
||||||
// more like their Win32 couterparts. They now interpret
|
// more like their Win32 couterparts. They now interpret
|
||||||
@@ -47,6 +47,10 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DoGetSize( int *width, int *height ) const;
|
void DoGetSize( int *width, int *height ) const;
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Init();
|
||||||
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const
|
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const
|
||||||
{ return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); }
|
{ return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); }
|
||||||
|
|
||||||
|
@@ -23,13 +23,13 @@ class WXDLLIMPEXP_CORE wxMemoryDC;
|
|||||||
// wxMemoryDC
|
// wxMemoryDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC
|
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
||||||
virtual ~wxMemoryDC();
|
virtual ~wxMemoryDC();
|
||||||
virtual void SelectObject( const wxBitmap& bitmap );
|
|
||||||
void DoGetSize( int *width, int *height ) const;
|
void DoGetSize( int *width, int *height ) const;
|
||||||
|
|
||||||
// these get reimplemented for mono-bitmaps to behave
|
// these get reimplemented for mono-bitmaps to behave
|
||||||
@@ -45,7 +45,12 @@ public:
|
|||||||
// implementation
|
// implementation
|
||||||
wxBitmap m_selected;
|
wxBitmap m_selected;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Init();
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -14,15 +14,16 @@
|
|||||||
|
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxMemoryDC: public wxPaintDC
|
class WXDLLEXPORT wxMemoryDC: public wxPaintDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
||||||
virtual ~wxMemoryDC(void);
|
virtual ~wxMemoryDC(void);
|
||||||
virtual void SelectObject( const wxBitmap& bitmap );
|
|
||||||
const wxBitmap& GetSelectedBitmap() const { return m_selected; }
|
const wxBitmap& GetSelectedBitmap() const { return m_selected; }
|
||||||
wxBitmap GetSelectedBitmap() { return m_selected; }
|
wxBitmap GetSelectedBitmap() { return m_selected; }
|
||||||
|
|
||||||
@@ -32,8 +33,11 @@ protected:
|
|||||||
virtual void DoGetSize( int *width, int *height ) const;
|
virtual void DoGetSize( int *width, int *height ) const;
|
||||||
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const
|
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const
|
||||||
{ return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); }
|
{ return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); }
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Init();
|
||||||
|
|
||||||
private:
|
|
||||||
wxBitmap m_selected;
|
wxBitmap m_selected;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -23,13 +23,13 @@ class WXDLLEXPORT wxMemoryDC;
|
|||||||
// wxMemoryDC
|
// wxMemoryDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxMemoryDC : public wxDC
|
class WXDLLEXPORT wxMemoryDC : public wxDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC(wxDC *dc); // Create compatible DC
|
wxMemoryDC(wxDC *dc); // Create compatible DC
|
||||||
virtual ~wxMemoryDC();
|
virtual ~wxMemoryDC();
|
||||||
virtual void SelectObject(const wxBitmap& bitmap);
|
|
||||||
|
|
||||||
// these get reimplemented for mono-bitmaps to behave
|
// these get reimplemented for mono-bitmaps to behave
|
||||||
// more like their Win32 couterparts. They now interpret
|
// more like their Win32 couterparts. They now interpret
|
||||||
@@ -45,7 +45,12 @@ public:
|
|||||||
|
|
||||||
wxBitmap GetSelectedObject() const { return m_selected; }
|
wxBitmap GetSelectedObject() const { return m_selected; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Init();
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -14,24 +14,28 @@
|
|||||||
|
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC
|
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
||||||
virtual ~wxMemoryDC();
|
virtual ~wxMemoryDC();
|
||||||
|
|
||||||
virtual void SelectObject( const wxBitmap& bitmap );
|
|
||||||
|
|
||||||
void DoGetSize( int *width, int *height ) const;
|
void DoGetSize( int *width, int *height ) const;
|
||||||
|
|
||||||
wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
|
wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class wxPaintDC;
|
friend class wxPaintDC;
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
|
||||||
wxBitmap m_bitmap;
|
wxBitmap m_bitmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -14,18 +14,19 @@
|
|||||||
|
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxMemoryDC : public wxDC
|
class WXDLLEXPORT wxMemoryDC : public wxDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { CreateCompatible(NULL); Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC(wxDC *dc); // Create compatible DC
|
wxMemoryDC(wxDC *dc); // Create compatible DC
|
||||||
|
|
||||||
virtual void SelectObject(const wxBitmap& bitmap);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// override some base class virtuals
|
// override some base class virtuals
|
||||||
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||||
virtual void DoGetSize(int* width, int* height) const;
|
virtual void DoGetSize(int* width, int* height) const;
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
// create DC compatible with the given one or screen if dc == NULL
|
// create DC compatible with the given one or screen if dc == NULL
|
||||||
bool CreateCompatible(wxDC *dc);
|
bool CreateCompatible(wxDC *dc);
|
||||||
|
@@ -14,18 +14,20 @@
|
|||||||
|
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxMemoryDC: public wxDC
|
class WXDLLEXPORT wxMemoryDC: public wxDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { CreateCompatible(NULL); Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC(wxDC* pDC); // Create compatible DC
|
wxMemoryDC(wxDC* pDC); // Create compatible DC
|
||||||
|
|
||||||
virtual void SelectObject(const wxBitmap& rBitmap);
|
|
||||||
protected:
|
protected:
|
||||||
// override some base class virtuals
|
// override some base class virtuals
|
||||||
virtual void DoGetSize( int* pWidth
|
virtual void DoGetSize( int* pWidth
|
||||||
,int* pHeight
|
,int* pHeight
|
||||||
) const;
|
) const;
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
// create DC compatible with the given one or screen if dc == NULL
|
// create DC compatible with the given one or screen if dc == NULL
|
||||||
bool CreateCompatible(wxDC* pDC);
|
bool CreateCompatible(wxDC* pDC);
|
||||||
|
|
||||||
|
@@ -14,18 +14,18 @@
|
|||||||
|
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxMemoryDC : public wxDC
|
class WXDLLEXPORT wxMemoryDC : public wxDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC(wxDC *dc); // Create compatible DC
|
wxMemoryDC(wxDC *dc); // Create compatible DC
|
||||||
|
|
||||||
virtual void SelectObject(const wxBitmap& bitmap);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// override some base class virtuals
|
// override some base class virtuals
|
||||||
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||||
virtual void DoGetSize(int* width, int* height) const;
|
virtual void DoGetSize(int* width, int* height) const;
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
// create DC compatible with the given one or screen if dc == NULL
|
// create DC compatible with the given one or screen if dc == NULL
|
||||||
bool CreateCompatible(wxDC *dc);
|
bool CreateCompatible(wxDC *dc);
|
||||||
|
@@ -14,19 +14,23 @@
|
|||||||
|
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC
|
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMemoryDC( const wxBitmap& bitmap = wxNullBitmap );
|
wxMemoryDC() { Init(); }
|
||||||
|
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
|
||||||
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
||||||
virtual ~wxMemoryDC();
|
virtual ~wxMemoryDC();
|
||||||
virtual void SelectObject( const wxBitmap& bitmap );
|
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
wxBitmap m_selected;
|
wxBitmap m_selected;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DoGetSize( int *width, int *height ) const;
|
virtual void DoGetSize( int *width, int *height ) const;
|
||||||
|
virtual void DoSelect(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Init();
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
||||||
};
|
};
|
||||||
|
@@ -102,7 +102,7 @@ bool wxEffects::TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap)
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_PALETTE
|
#endif // wxUSE_PALETTE
|
||||||
|
|
||||||
dcMem.SelectObject(bitmap);
|
dcMem.SelectObjectAsSource(bitmap);
|
||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
for (i = rect.x; i < rect.x + rect.width; i += w)
|
for (i = rect.x; i < rect.x + rect.width; i += w)
|
||||||
|
@@ -39,17 +39,15 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
void wxMemoryDC::Init()
|
||||||
{
|
{
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC(wxDC *WXUNUSED(dc))
|
wxMemoryDC::wxMemoryDC(wxDC *WXUNUSED(dc))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject(const wxBitmap& bitmap)
|
void wxMemoryDC::DoSelect(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
m_bmp = bitmap;
|
m_bmp = bitmap;
|
||||||
|
|
||||||
|
@@ -149,7 +149,7 @@ static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x)
|
|||||||
}
|
}
|
||||||
#endif // USE_PALETTE_IN_SPLASH
|
#endif // USE_PALETTE_IN_SPLASH
|
||||||
|
|
||||||
dcMem.SelectObject(bitmap);
|
dcMem.SelectObjectAsSource(bitmap);
|
||||||
dc.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), & dcMem, 0, 0);
|
dc.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), & dcMem, 0, 0);
|
||||||
dcMem.SelectObject(wxNullBitmap);
|
dcMem.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
|
@@ -21,8 +21,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
void wxMemoryDC::Init()
|
||||||
: wxWindowDC()
|
|
||||||
{
|
{
|
||||||
m_ok = false;
|
m_ok = false;
|
||||||
|
|
||||||
@@ -34,22 +33,12 @@ wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
|||||||
pango_context_set_language( m_context, gtk_get_default_language() );
|
pango_context_set_language( m_context, gtk_get_default_language() );
|
||||||
m_layout = pango_layout_new( m_context );
|
m_layout = pango_layout_new( m_context );
|
||||||
m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) );
|
m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) );
|
||||||
|
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
||||||
: wxWindowDC()
|
: wxWindowDC()
|
||||||
{
|
{
|
||||||
m_ok = false;
|
Init();
|
||||||
|
|
||||||
m_cmap = gtk_widget_get_default_colormap();
|
|
||||||
|
|
||||||
m_context = gdk_pango_context_get();
|
|
||||||
pango_context_set_language( m_context, gtk_get_default_language() );
|
|
||||||
m_layout = pango_layout_new( m_context );
|
|
||||||
m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::~wxMemoryDC()
|
wxMemoryDC::~wxMemoryDC()
|
||||||
@@ -57,9 +46,10 @@ wxMemoryDC::~wxMemoryDC()
|
|||||||
g_object_unref(m_context);
|
g_object_unref(m_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
|
|
||||||
m_selected = bitmap;
|
m_selected = bitmap;
|
||||||
if (m_selected.Ok())
|
if (m_selected.Ok())
|
||||||
{
|
{
|
||||||
|
@@ -21,33 +21,27 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
void wxMemoryDC::Init()
|
||||||
: wxWindowDC()
|
|
||||||
{
|
{
|
||||||
m_ok = false;
|
m_ok = false;
|
||||||
|
|
||||||
m_cmap = gtk_widget_get_default_colormap();
|
m_cmap = gtk_widget_get_default_colormap();
|
||||||
|
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
||||||
: wxWindowDC()
|
: wxWindowDC()
|
||||||
{
|
{
|
||||||
m_ok = false;
|
Init();
|
||||||
|
|
||||||
m_cmap = gtk_widget_get_default_colormap();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::~wxMemoryDC()
|
wxMemoryDC::~wxMemoryDC()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
|
|
||||||
m_selected = bitmap;
|
m_selected = bitmap;
|
||||||
if (m_selected.Ok())
|
if (m_selected.Ok())
|
||||||
{
|
{
|
||||||
|
@@ -22,8 +22,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
void wxMemoryDC::Init()
|
||||||
: m_selected()
|
|
||||||
{
|
{
|
||||||
m_ok = true;
|
m_ok = true;
|
||||||
SetBackground(*wxWHITE_BRUSH);
|
SetBackground(*wxWHITE_BRUSH);
|
||||||
@@ -31,20 +30,12 @@ wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
|||||||
SetPen(*wxBLACK_PEN);
|
SetPen(*wxBLACK_PEN);
|
||||||
SetFont(*wxNORMAL_FONT);
|
SetFont(*wxNORMAL_FONT);
|
||||||
m_ok = false;
|
m_ok = false;
|
||||||
|
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
||||||
: m_selected()
|
: m_selected()
|
||||||
{
|
{
|
||||||
m_ok = true;
|
Init();
|
||||||
SetBackground(*wxWHITE_BRUSH);
|
|
||||||
SetBrush(*wxWHITE_BRUSH);
|
|
||||||
SetPen(*wxBLACK_PEN);
|
|
||||||
SetFont(*wxNORMAL_FONT);
|
|
||||||
m_ok = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::~wxMemoryDC()
|
wxMemoryDC::~wxMemoryDC()
|
||||||
@@ -63,7 +54,7 @@ wxMemoryDC::~wxMemoryDC()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
if ( m_selected.Ok() )
|
if ( m_selected.Ok() )
|
||||||
{
|
{
|
||||||
|
@@ -24,25 +24,21 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
void wxMemoryDC::Init()
|
||||||
: wxDC()
|
|
||||||
{
|
{
|
||||||
m_isMemDC = true;
|
m_isMemDC = true;
|
||||||
|
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC(wxDC *WXUNUSED(dc)) : wxDC()
|
wxMemoryDC::wxMemoryDC(wxDC *WXUNUSED(dc)) : wxDC()
|
||||||
{
|
{
|
||||||
m_isMemDC = true;
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::~wxMemoryDC()
|
wxMemoryDC::~wxMemoryDC()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject(const wxBitmap& bitmap)
|
void wxMemoryDC::DoSelect(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
if ( bitmap.Ok() )
|
if ( bitmap.Ok() )
|
||||||
{
|
{
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxWindowDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxWindowDC)
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
void wxMemoryDC::Init()
|
||||||
{
|
{
|
||||||
m_ok = true;
|
m_ok = true;
|
||||||
m_display = wxGetDisplay();
|
m_display = wxGetDisplay();
|
||||||
@@ -57,9 +57,6 @@ wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
|||||||
SetBrush (* wxWHITE_BRUSH);
|
SetBrush (* wxWHITE_BRUSH);
|
||||||
SetPen (* wxBLACK_PEN);
|
SetPen (* wxBLACK_PEN);
|
||||||
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
||||||
|
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( wxDC* dc )
|
wxMemoryDC::wxMemoryDC( wxDC* dc )
|
||||||
@@ -92,7 +89,7 @@ wxMemoryDC::~wxMemoryDC(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
m_bitmap = bitmap;
|
m_bitmap = bitmap;
|
||||||
|
|
||||||
|
@@ -930,7 +930,7 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|||||||
// transparent pen) one pixel smaller in both directions and we want them
|
// transparent pen) one pixel smaller in both directions and we want them
|
||||||
// to have the same size regardless of which pen is used - adjust
|
// to have the same size regardless of which pen is used - adjust
|
||||||
|
|
||||||
// I wonder if this shouldn<EFBFBD>t be done after the LOG2DEV() conversions. RR.
|
// I wonder if this shouldnt be done after the LOG2DEV() conversions. RR.
|
||||||
if ( m_pen.GetStyle() == wxTRANSPARENT )
|
if ( m_pen.GetStyle() == wxTRANSPARENT )
|
||||||
{
|
{
|
||||||
// Apparently not needed for WinCE (see e.g. Life! demo)
|
// Apparently not needed for WinCE (see e.g. Life! demo)
|
||||||
@@ -1245,7 +1245,8 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
|
|||||||
// Rather than reproduce wxDC::Blit, let's do it at the wxWin API
|
// Rather than reproduce wxDC::Blit, let's do it at the wxWin API
|
||||||
// level
|
// level
|
||||||
wxMemoryDC memDC;
|
wxMemoryDC memDC;
|
||||||
memDC.SelectObject(bmp);
|
|
||||||
|
memDC.SelectObjectAsSource(bmp);
|
||||||
|
|
||||||
Blit(x, y, width, height, &memDC, 0, 0, wxCOPY, useMask);
|
Blit(x, y, width, height, &memDC, 0, 0, wxCOPY, useMask);
|
||||||
|
|
||||||
|
@@ -47,16 +47,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
|
|||||||
// wxMemoryDC
|
// wxMemoryDC
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
|
||||||
{
|
|
||||||
CreateCompatible(NULL);
|
|
||||||
|
|
||||||
Init();
|
|
||||||
|
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC(wxDC *dc)
|
wxMemoryDC::wxMemoryDC(wxDC *dc)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( dc, _T("NULL dc in wxMemoryDC ctor") );
|
wxCHECK_RET( dc, _T("NULL dc in wxMemoryDC ctor") );
|
||||||
@@ -91,7 +81,7 @@ bool wxMemoryDC::CreateCompatible(wxDC *dc)
|
|||||||
return m_ok;
|
return m_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject(const wxBitmap& bitmap)
|
void wxMemoryDC::DoSelect( const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
// select old bitmap out of the device context
|
// select old bitmap out of the device context
|
||||||
if ( m_oldBitmap )
|
if ( m_oldBitmap )
|
||||||
|
@@ -399,7 +399,8 @@ void wxPrinterDC::DoDrawBitmap(const wxBitmap& bmp,
|
|||||||
{
|
{
|
||||||
// no support for StretchDIBits() or an error occurred if we got here
|
// no support for StretchDIBits() or an error occurred if we got here
|
||||||
wxMemoryDC memDC;
|
wxMemoryDC memDC;
|
||||||
memDC.SelectObject(bmp);
|
|
||||||
|
memDC.SelectObjectAsSource(bmp);
|
||||||
|
|
||||||
Blit(x, y, width, height, &memDC, 0, 0, wxCOPY, useMask);
|
Blit(x, y, width, height, &memDC, 0, 0, wxCOPY, useMask);
|
||||||
|
|
||||||
|
@@ -28,15 +28,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
|
|||||||
// Memory DC
|
// Memory DC
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
|
||||||
{
|
|
||||||
CreateCompatible(NULL);
|
|
||||||
Init();
|
|
||||||
|
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
} // end of wxMemoryDC::wxMemoryDC
|
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC(
|
wxMemoryDC::wxMemoryDC(
|
||||||
wxDC* pOldDC
|
wxDC* pOldDC
|
||||||
)
|
)
|
||||||
@@ -121,7 +112,7 @@ bool wxMemoryDC::CreateCompatible( wxDC* WXUNUSED(pDC) )
|
|||||||
return m_ok;
|
return m_ok;
|
||||||
} // end of wxMemoryDC::CreateCompatible
|
} // end of wxMemoryDC::CreateCompatible
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject(
|
void wxMemoryDC::DoSelect(
|
||||||
const wxBitmap& rBitmap
|
const wxBitmap& rBitmap
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -168,6 +159,7 @@ void wxMemoryDC::SelectObject(
|
|||||||
);
|
);
|
||||||
m_vSelectedBitmap.SetSelectedInto(NULL);
|
m_vSelectedBitmap.SetSelectedInto(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_vSelectedBitmap = rBitmap;
|
m_vSelectedBitmap = rBitmap;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -45,12 +45,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
|
|||||||
// wxMemoryDC
|
// wxMemoryDC
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
|
||||||
{
|
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC(wxDC *dc)
|
wxMemoryDC::wxMemoryDC(wxDC *dc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -64,7 +58,7 @@ bool wxMemoryDC::CreateCompatible(wxDC *dc)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject(const wxBitmap& bitmap)
|
void wxMemoryDC::DoSelect(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,8 +23,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
void wxMemoryDC::Init()
|
||||||
: wxWindowDC()
|
|
||||||
{
|
{
|
||||||
m_ok = false;
|
m_ok = false;
|
||||||
|
|
||||||
@@ -32,27 +31,19 @@ wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
|
|||||||
|
|
||||||
int screen = DefaultScreen( wxGlobalDisplay() );
|
int screen = DefaultScreen( wxGlobalDisplay() );
|
||||||
m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
|
m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
|
||||||
|
|
||||||
if ( bitmap.IsOk() )
|
|
||||||
SelectObject(bitmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
||||||
: wxWindowDC()
|
: wxWindowDC()
|
||||||
{
|
{
|
||||||
m_ok = false;
|
Init();
|
||||||
|
|
||||||
m_display = (WXDisplay *) wxGlobalDisplay();
|
|
||||||
|
|
||||||
int screen = DefaultScreen( wxGlobalDisplay() );
|
|
||||||
m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMemoryDC::~wxMemoryDC()
|
wxMemoryDC::~wxMemoryDC()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user