Add wxGraphicsRenderer::GetName() and GetVersion() methods.
Allow the code to determine which underlying technology is used for implementing wxGraphics API. This is needed by the unit tests to account for the known differences between platforms and may be useful in other cases. Closes #16154. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2398,6 +2398,9 @@ public :
|
||||
// create a subimage from a native image representation
|
||||
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
|
||||
|
||||
virtual wxString GetName() const wxOVERRIDE;
|
||||
virtual void GetVersion(int *major, int *minor, int *micro) const wxOVERRIDE;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer)
|
||||
} ;
|
||||
|
||||
@@ -2651,6 +2654,20 @@ wxCairoRenderer::CreateSubBitmap(const wxGraphicsBitmap& WXUNUSED(bitmap),
|
||||
return p;
|
||||
}
|
||||
|
||||
wxString wxCairoRenderer::GetName() const
|
||||
{
|
||||
return "cairo";
|
||||
}
|
||||
|
||||
void wxCairoRenderer::GetVersion(int *major, int *minor, int *micro) const
|
||||
{
|
||||
int dummy;
|
||||
sscanf(cairo_version_string(), "%d.%d.%d",
|
||||
major ? major : &dummy,
|
||||
minor ? minor : &dummy,
|
||||
micro ? micro : &dummy);
|
||||
}
|
||||
|
||||
wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer()
|
||||
{
|
||||
return &gs_cairoGraphicsRenderer;
|
||||
|
||||
@@ -587,6 +587,9 @@ public :
|
||||
// create a subimage from a native image representation
|
||||
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
|
||||
|
||||
virtual wxString GetName() const wxOVERRIDE;
|
||||
virtual void GetVersion(int *major, int *minor, int *micro) const wxOVERRIDE;
|
||||
|
||||
protected :
|
||||
bool EnsureIsLoaded();
|
||||
void Load();
|
||||
@@ -2295,6 +2298,21 @@ wxGraphicsBitmap wxGDIPlusRenderer::CreateSubBitmap( const wxGraphicsBitmap &bit
|
||||
return wxNullGraphicsBitmap;
|
||||
}
|
||||
|
||||
wxString wxGDIPlusRenderer::GetName() const
|
||||
{
|
||||
return "gdiplus";
|
||||
}
|
||||
|
||||
void wxGDIPlusRenderer::GetVersion(int *major, int *minor, int *micro) const
|
||||
{
|
||||
if ( major )
|
||||
*major = wxPlatformInfo::Get().GetOSMajorVersion();
|
||||
if ( minor )
|
||||
*minor = wxPlatformInfo::Get().GetOSMinorVersion();
|
||||
if ( micro )
|
||||
*micro = 0;
|
||||
}
|
||||
|
||||
// Shutdown GDI+ at app exit, before possible dll unload
|
||||
class wxGDIPlusRendererModule : public wxModule
|
||||
{
|
||||
|
||||
@@ -2654,6 +2654,10 @@ public :
|
||||
|
||||
// create a native bitmap representation
|
||||
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE ;
|
||||
|
||||
virtual wxString GetName() const wxOVERRIDE;
|
||||
virtual void GetVersion(int *major, int *minor, int *micro) const wxOVERRIDE;
|
||||
|
||||
private :
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacCoreGraphicsRenderer)
|
||||
} ;
|
||||
@@ -2875,6 +2879,21 @@ wxGraphicsBitmap wxMacCoreGraphicsRenderer::CreateSubBitmap( const wxGraphicsBit
|
||||
return wxNullGraphicsBitmap;
|
||||
}
|
||||
|
||||
wxString wxMacCoreGraphicsRenderer::GetName() const
|
||||
{
|
||||
return "cg";
|
||||
}
|
||||
|
||||
void wxMacCoreGraphicsRenderer::GetVersion(int *major, int *minor, int *micro) const
|
||||
{
|
||||
if ( major )
|
||||
*major = wxPlatformInfo::Get().GetOSMajorVersion();
|
||||
if ( minor )
|
||||
*minor = wxPlatformInfo::Get().GetOSMinorVersion();
|
||||
if ( micro )
|
||||
*micro = 0;
|
||||
}
|
||||
|
||||
wxGraphicsBrush
|
||||
wxMacCoreGraphicsRenderer::CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
|
||||
wxDouble x2, wxDouble y2,
|
||||
|
||||
Reference in New Issue
Block a user