clean up wxCairoRenderer initialization mess
Remove unused Unload(), wxCairoCleanUp(), m_loaded and gCairoRenderer, and redundant Load() and EnsureIsLoaded(). Just call wxCairoInit() directly, and for GTK do nothing at all. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73098 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -384,11 +384,6 @@ bool wxCairoInit()
|
|||||||
return wxCairo::Initialize();
|
return wxCairo::Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCairoCleanUp()
|
|
||||||
{
|
|
||||||
wxCairo::CleanUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
|
||||||
bool wxCairoInit();
|
bool wxCairoInit();
|
||||||
void wxCairoCleanUp();
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
@@ -2397,13 +2396,6 @@ public :
|
|||||||
// create a subimage from a native image representation
|
// create a subimage from a native image representation
|
||||||
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
|
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
|
||||||
|
|
||||||
protected :
|
|
||||||
bool EnsureIsLoaded();
|
|
||||||
void Load();
|
|
||||||
void Unload();
|
|
||||||
friend class wxCairoModule;
|
|
||||||
private :
|
|
||||||
int m_loaded;
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer)
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -2414,34 +2406,14 @@ private :
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxCairoRenderer,wxGraphicsRenderer)
|
IMPLEMENT_DYNAMIC_CLASS(wxCairoRenderer,wxGraphicsRenderer)
|
||||||
|
|
||||||
static wxCairoRenderer gs_cairoGraphicsRenderer;
|
static wxCairoRenderer gs_cairoGraphicsRenderer;
|
||||||
// temporary hack to allow creating a cairo context on any platform
|
|
||||||
extern wxGraphicsRenderer* gCairoRenderer;
|
|
||||||
wxGraphicsRenderer* gCairoRenderer = &gs_cairoGraphicsRenderer;
|
|
||||||
|
|
||||||
bool wxCairoRenderer::EnsureIsLoaded()
|
#ifdef __WXGTK__
|
||||||
{
|
#define ENSURE_LOADED_OR_RETURN(returnOnFail)
|
||||||
#ifndef __WXGTK__
|
|
||||||
Load();
|
|
||||||
return wxCairoInit();
|
|
||||||
#else
|
#else
|
||||||
return true;
|
#define ENSURE_LOADED_OR_RETURN(returnOnFail) \
|
||||||
|
if (!wxCairoInit()) \
|
||||||
|
return returnOnFail
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
void wxCairoRenderer::Load()
|
|
||||||
{
|
|
||||||
wxCairoInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxCairoRenderer::Unload()
|
|
||||||
{
|
|
||||||
wxCairoCleanUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
// call EnsureIsLoaded() and return returnOnFail value if it fails
|
|
||||||
#define ENSURE_LOADED_OR_RETURN(returnOnFail) \
|
|
||||||
if ( !EnsureIsLoaded() ) \
|
|
||||||
return (returnOnFail)
|
|
||||||
|
|
||||||
wxGraphicsContext * wxCairoRenderer::CreateContext( const wxWindowDC& dc)
|
wxGraphicsContext * wxCairoRenderer::CreateContext( const wxWindowDC& dc)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user