Commit 1583a226 authored by Zach Bacon's avatar Zach Bacon
Browse files

*Removal of the cairo renderer, it never performed well to begin with.

parent 1a8f2f98
...@@ -5,11 +5,6 @@ IF(NOT CMAKE_VERSION VERSION_LESS 3.0) ...@@ -5,11 +5,6 @@ IF(NOT CMAKE_VERSION VERSION_LESS 3.0)
cmake_policy(SET CMP0043 NEW) # for wxWidgets cmake_policy(SET CMP0043 NEW) # for wxWidgets
ENDIF() ENDIF()
# not yet implemented
SET(CAIRO_DEFAULT OFF)
option(ENABLE_CAIRO "Enable Cairo rendering for the wxWidgets port" ${CAIRO_DEFAULT})
if( WIN32 ) if( WIN32 )
# not yet implemented # not yet implemented
option( ENABLE_DIRECT3D "Enable Direct3D rendering for the wxWidgets port" ON ) option( ENABLE_DIRECT3D "Enable Direct3D rendering for the wxWidgets port" ON )
...@@ -30,10 +25,6 @@ IF(APPLE) ...@@ -30,10 +25,6 @@ IF(APPLE)
ADD_DEFINITIONS(-DwxMAC_USE_CORE_GRAPHICS) ADD_DEFINITIONS(-DwxMAC_USE_CORE_GRAPHICS)
ENDIF(APPLE) ENDIF(APPLE)
if( NOT ENABLE_CAIRO )
ADD_DEFINITIONS (-DNO_CAIRO)
endif( NOT ENABLE_CAIRO )
if( NOT ENABLE_XAUDIO2 ) if( NOT ENABLE_XAUDIO2 )
ADD_DEFINITIONS (-DNO_XAUDIO2) ADD_DEFINITIONS (-DNO_XAUDIO2)
endif( NOT ENABLE_XAUDIO2 ) endif( NOT ENABLE_XAUDIO2 )
...@@ -130,19 +121,6 @@ FIND_PROGRAM(MSGINIT msginit) ...@@ -130,19 +121,6 @@ FIND_PROGRAM(MSGINIT msginit)
if(ENABLE_NLS AND (NOT XGETTEXT OR NOT MSGINIT)) if(ENABLE_NLS AND (NOT XGETTEXT OR NOT MSGINIT))
message(SEND_ERROR "Cannot find gettext ${XGETTEXT} ${MSGINIT}") message(SEND_ERROR "Cannot find gettext ${XGETTEXT} ${MSGINIT}")
endif(ENABLE_NLS AND (NOT XGETTEXT OR NOT MSGINIT)) endif(ENABLE_NLS AND (NOT XGETTEXT OR NOT MSGINIT))
IF(ENABLE_CAIRO)
FIND_PACKAGE ( PkgConfig REQUIRED )
PKG_CHECK_MODULES(CAIRO REQUIRED cairo)
include_directories(${CAIRO_INCLUDE_DIRS})
IF(WIN32)
# need gdiplus to extract hdc for cairo context
SET(CAIRO_LIBRARIES ${CAIRO_LIBRARIES} -lgdiplus)
ENDIF(WIN32)
# SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${CAIRO_CFLAGS})
ELSE(ENABLE_CAIRO)
ADD_DEFINITIONS (-DNO_CAIRO)
SET(CAIRO_LIBRARIES )
ENDIF(ENABLE_CAIRO)
IF(WIN32 AND ENABLE_DIRECTX) IF(WIN32 AND ENABLE_DIRECTX)
FIND_PACKGE ( DirectX REQUIRED ) FIND_PACKGE ( DirectX REQUIRED )
ENDIF(WIN32 AND ENABLE_DIRECTX) ENDIF(WIN32 AND ENABLE_DIRECTX)
...@@ -407,7 +385,6 @@ TARGET_LINK_LIBRARIES ( ...@@ -407,7 +385,6 @@ TARGET_LINK_LIBRARIES (
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${FFMPEG_LIBRARIES} ${FFMPEG_LIBRARIES}
${DIRECTX_LIBRARIES} ${DIRECTX_LIBRARIES}
${CAIRO_LIBRARIES}
${GTK_LIBRARIES} ${GTK_LIBRARIES}
${OPENAL_LIBRARY} ${OPENAL_LIBRARY}
) )
......
...@@ -57,20 +57,6 @@ protected: ...@@ -57,20 +57,6 @@ protected:
}; };
#endif #endif
#ifndef NO_CAIRO
#include <cairo.h>
class CairoDrawingPanel : public DrawingPanel {
public:
CairoDrawingPanel(wxWindow* parent, int _width, int _height);
~CairoDrawingPanel();
protected:
void DrawArea(wxWindowDC&);
cairo_surface_t* conv_surf;
};
#endif
#if defined(__WXMAC__) #if defined(__WXMAC__)
class Quartz2DDrawingPanel : public BasicDrawingPanel { class Quartz2DDrawingPanel : public BasicDrawingPanel {
public: public:
......
...@@ -3316,10 +3316,6 @@ bool MainFrame::BindControls() ...@@ -3316,10 +3316,6 @@ bool MainFrame::BindControls()
if (wxGetApp().UsingWayland()) { if (wxGetApp().UsingWayland()) {
rb->Hide(); rb->Hide();
} }
#endif
getrbi("OutputCairo", gopts.render_method, RND_CAIRO);
#ifdef NO_CAIRO
rb->Hide();
#endif #endif
getrbi("OutputDirect3D", gopts.render_method, RND_DIRECT3D); getrbi("OutputDirect3D", gopts.render_method, RND_DIRECT3D);
#if !defined(__WXMSW__) || defined(NO_D3D) || 1 // not implemented #if !defined(__WXMSW__) || defined(NO_D3D) || 1 // not implemented
......
...@@ -156,11 +156,11 @@ opt_desc opts[] = { ...@@ -156,11 +156,11 @@ opt_desc opts[] = {
BOOLOPT("Display/KeepOnTop", "KeepOnTop", wxTRANSLATE("Keep window on top"), gopts.keep_on_top), BOOLOPT("Display/KeepOnTop", "KeepOnTop", wxTRANSLATE("Keep window on top"), gopts.keep_on_top),
INTOPT("Display/MaxThreads", "Multithread", wxTRANSLATE("Maximum number of threads to run filters in"), gopts.max_threads, 1, 8), INTOPT("Display/MaxThreads", "Multithread", wxTRANSLATE("Maximum number of threads to run filters in"), gopts.max_threads, 1, 8),
#ifdef __WXMSW__ #ifdef __WXMSW__
ENUMOPT("Display/RenderMethod", "", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl|cairo|direct3d")), ENUMOPT("Display/RenderMethod", "", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl|direct3d")),
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
ENUMOPT("Display/RenderMethod", "", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl|cairo||quartz2d")), ENUMOPT("Display/RenderMethod", "", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl|quartz2d")),
#else #else
ENUMOPT("Display/RenderMethod", "", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl|cairo")), ENUMOPT("Display/RenderMethod", "", wxTRANSLATE("Render method; if unsupported, simple method will be used"), gopts.render_method, wxTRANSLATE("simple|opengl")),
#endif #endif
DOUBLEOPT("Display/Scale", "", wxTRANSLATE("Default scale factor"), gopts.video_scale, 1, 6), DOUBLEOPT("Display/Scale", "", wxTRANSLATE("Default scale factor"), gopts.video_scale, 1, 6),
BOOLOPT("Display/Stretch", "RetainAspect", wxTRANSLATE("Retain aspect ratio when resizing"), gopts.retain_aspect), BOOLOPT("Display/Stretch", "RetainAspect", wxTRANSLATE("Retain aspect ratio when resizing"), gopts.retain_aspect),
......
...@@ -1002,11 +1002,6 @@ void GameArea::OnIdle(wxIdleEvent& event) ...@@ -1002,11 +1002,6 @@ void GameArea::OnIdle(wxIdleEvent& event)
panel = new GLDrawingPanel(this, basic_width, basic_height); panel = new GLDrawingPanel(this, basic_width, basic_height);
break; break;
#endif #endif
#ifndef NO_CAIRO
case RND_CAIRO:
panel = new CairoDrawingPanel(this, basic_width, basic_height);
break;
#endif
#ifdef __WXMSW__ #ifdef __WXMSW__
case RND_DIRECT3D: case RND_DIRECT3D:
panel = new DXDrawingPanel(this, basic_width, basic_height); panel = new DXDrawingPanel(this, basic_width, basic_height);
...@@ -2209,124 +2204,6 @@ void GLDrawingPanel::DrawArea(wxWindowDC& dc) ...@@ -2209,124 +2204,6 @@ void GLDrawingPanel::DrawArea(wxWindowDC& dc)
#endif // GL support #endif // GL support
#ifndef NO_CAIRO
CairoDrawingPanel::CairoDrawingPanel(wxWindow* parent, int _width, int _height)
: DrawingPanel(parent, _width, _height)
{
conv_surf = NULL;
// Intialize color tables in reverse order from default
// probably doesn't help mmx hq3x/hq4x
if (systemColorDepth == 32) {
#if wxBYTE_ORDER == wxLITTLE_ENDIAN
systemBlueShift = 3;
systemRedShift = 19;
#else
systemBlueShift = 27;
systemRedShift = 11;
#endif
}
// FIXME: should be "true" for GBA carts if lcd mode selected
utilUpdateSystemColorMaps(false);
if (!did_init) DrawingPanelInit();
}
CairoDrawingPanel::~CairoDrawingPanel()
{
if (conv_surf)
cairo_surface_destroy(conv_surf);
}
#include <wx/graphics.h>
#ifdef __WXMSW__
#include <cairo-win32.h>
#include <gdiplus.h>
#endif
#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS
#include <cairo-quartz.h>
#endif
void CairoDrawingPanel::DrawArea(wxWindowDC& dc)
{
cairo_t* cr;
wxGraphicsContext* gc = wxGraphicsContext::Create(dc);
#ifdef __WXMSW__
// not sure why this is so slow
// doing this only once in constructor and resize handler doesn't seem
// to help, and may be unsafe
Gdiplus::Graphics* gr = (Gdiplus::Graphics*)gc->GetNativeContext();
cairo_surface_t* s = cairo_win32_surface_create(gr->GetHDC());
cr = cairo_create(s);
cairo_surface_destroy(s);
#else
#ifdef __WXGTK__
cr = cairo_reference((cairo_t*)gc->GetNativeContext());
#else
#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS
CGContextRef c = static_cast<CGContextRef>(gc->GetNativeContext());
cairo_surface_t* s = cairo_quartz_surface_create_for_cg_context(c, width, height);
cr = cairo_create(s);
cairo_surface_destroy(s);
#else
#error Cairo rendering is not supported on this platform
#endif
#endif
#endif
cairo_surface_t* surf;
if (!out_16)
surf = cairo_image_surface_create_for_data(todraw + 4 * width,
CAIRO_FORMAT_RGB24,
width, height,
4 * (width + 1));
else {
if (!conv_surf)
conv_surf = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
std::ceil(width * scale),
std::ceil(height * scale));
if (!conv_surf) {
wxLogError(_("Cannot create conversion buffer"));
wxGetApp().frame->Close(true);
}
surf = cairo_surface_reference(conv_surf);
uint16_t* src = (uint16_t*)todraw + (int)std::ceil((width + 2) * scale); // skip top border
uint32_t* dst = (uint32_t*)cairo_image_surface_get_data(surf);
for (int y = 0; y < std::ceil(height * scale); y++) {
for (int x = 0; x < std::ceil(width * scale); x++, src++) {
*dst++ = (((*src >> systemRedShift) & 0x1f) << 19) | (((*src >> systemGreenShift) & 0x1f) << 11) | (((*src >> systemBlueShift) & 0x1f) << 3);
}
src += 2; // skip rhs border
}
}
cairo_pattern_t* pat = cairo_pattern_create_for_surface(surf);
// GOOD is "similar to" bilinear, and FAST is "similar to" nearest
// could also just use BILINEAR and NEAREST directly, I suppose
cairo_pattern_set_filter(pat, gopts.bilinear ? CAIRO_FILTER_GOOD : CAIRO_FILTER_FAST);
double sx, sy;
int w, h;
GetClientSize(&w, &h);
sx = (double)width / w;
sy = (double)height / h;
cairo_matrix_t mat;
cairo_matrix_init_scale(&mat, sx, sy);
cairo_pattern_set_matrix(pat, &mat);
cairo_set_source(cr, pat);
cairo_paint(cr);
cairo_pattern_destroy(pat);
cairo_surface_destroy(surf);
cairo_destroy(cr);
delete gc;
}
#endif
#if defined(__WXMSW__) && !defined(NO_D3D) #if defined(__WXMSW__) && !defined(NO_D3D)
#define DIRECT3D_VERSION 0x0900 #define DIRECT3D_VERSION 0x0900
#include <d3d9.h> #include <d3d9.h>
......
...@@ -436,7 +436,6 @@ enum ifbfunc { ...@@ -436,7 +436,6 @@ enum ifbfunc {
enum renderer { enum renderer {
RND_SIMPLE, RND_SIMPLE,
RND_OPENGL, RND_OPENGL,
RND_CAIRO,
RND_DIRECT3D, RND_DIRECT3D,
RND_QUARTZ2D, RND_QUARTZ2D,
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment