diff --git a/src/gtk/configfile.cpp b/src/gtk/configfile.cpp index 0338601b..bb973e3a 100644 --- a/src/gtk/configfile.cpp +++ b/src/gtk/configfile.cpp @@ -18,8 +18,6 @@ #include "configfile.h" -#include - #include #include diff --git a/src/gtk/configfile.h b/src/gtk/configfile.h index 15b9dfc9..468a3383 100644 --- a/src/gtk/configfile.h +++ b/src/gtk/configfile.h @@ -21,9 +21,7 @@ #define __VBA_CONFIGFILE_H__ #include -#include #include -#include namespace VBA { diff --git a/src/gtk/main.cpp b/src/gtk/main.cpp index 57213b56..901686f9 100644 --- a/src/gtk/main.cpp +++ b/src/gtk/main.cpp @@ -16,16 +16,13 @@ // along with this program; if not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include -#include - #include #include #include #include #ifdef USE_OPENGL -#include +#include #endif // USE_OPENGL #include "window.h" diff --git a/src/gtk/screenarea-cairo.cpp b/src/gtk/screenarea-cairo.cpp index 23d0add0..10b427d0 100644 --- a/src/gtk/screenarea-cairo.cpp +++ b/src/gtk/screenarea-cairo.cpp @@ -18,8 +18,6 @@ #include "screenarea-cairo.h" -#include - namespace VBA { @@ -82,7 +80,7 @@ void ScreenAreaCairo::vDrawPixels(u8 * _puiData) } bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent) -{ +{ DrawingArea::on_expose_event(_pstEvent); Cairo::RefPtr< Cairo::ImageSurface > poImage; Cairo::RefPtr< Cairo::SurfacePattern > poPattern; @@ -93,8 +91,8 @@ bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent) poContext = get_window()->create_cairo_context(); poContext->set_identity_matrix(); - poContext->scale(m_dScaleFactor, m_dScaleFactor); - + poContext->scale(m_dScaleFactor, m_dScaleFactor); + poImage = Cairo::ImageSurface::create((u8 *)m_puiPixels, Cairo::FORMAT_RGB24, m_iScaledWidth, m_iScaledHeight, iScaledPitch); @@ -104,10 +102,10 @@ bool ScreenAreaCairo::on_expose_event(GdkEventExpose * _pstEvent) poPattern->set_matrix (oMatrix); poContext->set_source_rgb(0.0, 0.0, 0.0); poContext->paint(); - + poContext->set_source(poPattern); - poContext->paint(); - + poContext->paint(); + return true; } @@ -131,10 +129,10 @@ void ScreenAreaCairo::vUpdateSize() { delete[] m_puiDelta; } - + m_iScaledWidth = m_iFilterScale * m_iWidth; m_iScaledHeight = m_iFilterScale * m_iHeight; - + vOnWidgetResize(); m_puiPixels = new u32[(m_iScaledWidth + 1) * m_iScaledHeight]; @@ -157,7 +155,7 @@ void ScreenAreaCairo::vOnWidgetResize() bool ScreenAreaCairo::on_configure_event(GdkEventConfigure * event) { vOnWidgetResize(); - + return true; } diff --git a/src/gtk/screenarea-opengl.cpp b/src/gtk/screenarea-opengl.cpp index 78bb9e2d..c9080e36 100644 --- a/src/gtk/screenarea-opengl.cpp +++ b/src/gtk/screenarea-opengl.cpp @@ -18,8 +18,6 @@ #include "screenarea-opengl.h" -#include - namespace VBA { @@ -127,10 +125,10 @@ void ScreenAreaGl::vUpdateSize() { delete[] m_puiDelta; } - + m_iScaledWidth = m_iFilterScale * m_iWidth; m_iScaledHeight = m_iFilterScale * m_iHeight; - + vOnWidgetResize(); m_puiPixels = new u32[(m_iScaledWidth + 1) * m_iScaledHeight]; @@ -145,7 +143,7 @@ void ScreenAreaGl::vOnWidgetResize() { m_dScaleFactor = min(get_height() / (double)m_iScaledHeight, get_width() / (double)m_iScaledWidth); glViewport(0, 0, get_width(), get_height()); - + m_dAreaTop = 1 - m_dScaleFactor * m_iScaledHeight / (double)get_height(); m_dAreaLeft = 1 - m_dScaleFactor * m_iScaledWidth / (double)get_width(); } @@ -153,7 +151,7 @@ void ScreenAreaGl::vOnWidgetResize() bool ScreenAreaGl::on_configure_event(GdkEventConfigure * event) { vOnWidgetResize(); - + return true; } @@ -173,9 +171,9 @@ bool ScreenAreaGl::on_expose_event(GdkEventExpose * _pstEvent) glDrawPixels(m_iScaledWidth, m_iScaledHeight, GL_RGBA, GL_UNSIGNED_BYTE, m_puiPixels); glwindow->swap_buffers(); - + glwindow->gl_end(); - + return true; } diff --git a/src/gtk/screenarea-opengl.h b/src/gtk/screenarea-opengl.h index 0e96cd92..ab002d6d 100644 --- a/src/gtk/screenarea-opengl.h +++ b/src/gtk/screenarea-opengl.h @@ -21,7 +21,7 @@ #define __VBA_SCREENAREA_OPENGL_H__ #include "screenarea.h" -#include +#include namespace VBA { diff --git a/src/gtk/screenarea-xvideo.cpp b/src/gtk/screenarea-xvideo.cpp index 17c6087c..9502e0ea 100644 --- a/src/gtk/screenarea-xvideo.cpp +++ b/src/gtk/screenarea-xvideo.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include @@ -52,17 +51,17 @@ ScreenAreaXv::ScreenAreaXv(int _iWidth, int _iHeight, int _iScale) : GdkWindow *pWindow = poWindow->gobj(); m_pDisplay = gdk_x11_drawable_get_xdisplay(GDK_DRAWABLE(pWindow)); - + Glib::RefPtr poScreen = get_screen(); Glib::RefPtr poRoot = poScreen->get_root_window(); pRoot = poRoot->gobj(); - + m_iXvPortId = -1; - XvQueryAdaptors(m_pDisplay, - GDK_WINDOW_XWINDOW(pRoot), + XvQueryAdaptors(m_pDisplay, + GDK_WINDOW_XWINDOW(pRoot), &iNumAdaptors, &pAdaptors); - + for (unsigned int i = 0; i < iNumAdaptors; i++) { if (pAdaptors[i].type & XvInputMask && @@ -71,9 +70,9 @@ ScreenAreaXv::ScreenAreaXv(int _iWidth, int _iHeight, int _iScale) : m_iXvPortId = pAdaptors[i].base_id; } } - + XvFreeAdaptorInfo(pAdaptors); - + if (m_iXvPortId < 0) { fprintf (stderr, "Could not open Xv output port.\n"); @@ -90,7 +89,7 @@ ScreenAreaXv::ScreenAreaXv(int _iWidth, int _iHeight, int _iScale) : // Try to find an RGB format pFormats = XvListImageFormats(m_pDisplay, m_iXvPortId, &iNumFormats); - + for (int i = 0; i < iNumFormats; i++) { if (pFormats[i].id == 0x3 || pFormats[i].type == XvRGB) @@ -112,9 +111,9 @@ ScreenAreaXv::ScreenAreaXv(int _iWidth, int _iHeight, int _iScale) : if (!strcmp(pAttr[iAttr].name, "XV_AUTOPAINT_COLORKEY")) { Atom oAtom = XInternAtom(m_pDisplay, "XV_AUTOPAINT_COLORKEY", True); - if (oAtom != None) + if (oAtom != None) XvSetPortAttribute(m_pDisplay, m_iXvPortId, oAtom, 1); - + break; } } @@ -125,7 +124,7 @@ ScreenAreaXv::ScreenAreaXv(int _iWidth, int _iHeight, int _iScale) : ScreenAreaXv::~ScreenAreaXv() { XShmDetach(m_pDisplay, &m_oShm); - + if (m_puiPixels != NULL) { delete[] m_puiPixels; @@ -197,7 +196,7 @@ void ScreenAreaXv::vUpdateSize() { const int iScaledWidth = m_iFilterScale * m_iWidth; const int iScaledHeight = m_iFilterScale * m_iHeight; - + if (m_puiPixels != NULL) { delete[] m_puiPixels; @@ -214,7 +213,7 @@ void ScreenAreaXv::vUpdateSize() } vOnWidgetResize(); - + m_pXvImage = XvShmCreateImage(m_pDisplay, m_iXvPortId, m_iFormat, @@ -222,13 +221,13 @@ void ScreenAreaXv::vUpdateSize() iScaledWidth + 4, iScaledHeight + 4, &m_oShm); - + m_oShm.shmid = shmget(IPC_PRIVATE, m_pXvImage->data_size, IPC_CREAT | 0777); m_oShm.shmaddr = (char *) shmat(m_oShm.shmid, 0, 0); - m_oShm.readOnly = FALSE; - + m_oShm.readOnly = FALSE; + m_pXvImage->data = m_oShm.shmaddr; - + XShmAttach(m_pDisplay, &m_oShm); m_puiPixels = new u32[iScaledWidth * iScaledHeight]; @@ -300,10 +299,10 @@ void ScreenAreaXv::vRGB32toYUY2 (unsigned char* dest_ptr, void ScreenAreaXv::vOnWidgetResize() { double dAspectRatio = m_iWidth / (double)m_iHeight; - + m_iAreaHeight = min(get_height(), get_width() / dAspectRatio); m_iAreaWidth = min(get_width(), get_height() * dAspectRatio); - + m_iAreaTop = (get_height() - m_iAreaHeight) / 2; m_iAreaLeft = (get_width() - m_iAreaWidth) / 2; } @@ -311,7 +310,7 @@ void ScreenAreaXv::vOnWidgetResize() bool ScreenAreaXv::on_configure_event(GdkEventConfigure * event) { vOnWidgetResize(); - + return true; } diff --git a/src/gtk/screenarea.cpp b/src/gtk/screenarea.cpp index 5bde71b4..08f59a5c 100644 --- a/src/gtk/screenarea.cpp +++ b/src/gtk/screenarea.cpp @@ -18,8 +18,6 @@ #include "screenarea.h" -#include - namespace VBA { @@ -88,13 +86,13 @@ void ScreenArea::vSetScale(int _iScale) void ScreenArea::vSetFilter2x(EFilter2x _eFilter2x) { m_vFilter2x = pvGetFilter2x(_eFilter2x, FilterDepth32); - - m_iFilterScale = 1; + + m_iFilterScale = 1; if (m_vFilter2x != NULL) { m_iFilterScale = 2; } - + vUpdateSize(); } diff --git a/src/gtk/system.cpp b/src/gtk/system.cpp index 1636965d..e15384c6 100644 --- a/src/gtk/system.cpp +++ b/src/gtk/system.cpp @@ -16,10 +16,6 @@ // along with this program; if not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include -#include -#include - #include "../agb/GBA.h" #include "../dmg/gb.h" #include "../dmg/gbGlobals.h" diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 01c8f919..a9565a49 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -18,10 +18,11 @@ #include "window.h" -#include +#include +#include +#include -#include -#include +#include #include diff --git a/src/gtk/window.h b/src/gtk/window.h index ada35768..94df7d86 100644 --- a/src/gtk/window.h +++ b/src/gtk/window.h @@ -20,16 +20,13 @@ #ifndef __VBA_WINDOW_H__ #define __VBA_WINDOW_H__ -#include -#include - -#include +#include +#include +#include +#include +#include #include -#include -#include -#include - #include "../System.h" #include "../sdl/inputSDL.h" diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp index c5cea31c..94aadb97 100644 --- a/src/gtk/windowcallbacks.cpp +++ b/src/gtk/windowcallbacks.cpp @@ -18,10 +18,10 @@ #include "window.h" -#include - -#include -#include +#include +#include +#include +#include #include