X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2fb0cabbf9e924c25d51b13bf7aa1ba8aa24e75e..ee92941afca091bf72d17e96ac8388545700d1fc:/src/x11/dcclient.cpp diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 887f6562e3..849911fa69 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: x11/dcclient.cpp +// Name: src/x11/dcclient.cpp // Purpose: wxClientDC class // Author: Julian Smart, Robert Roebling // Modified by: @@ -9,18 +9,24 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/dcclient.h" -#include "wx/dcmemory.h" -#include "wx/window.h" -#include "wx/app.h" -#include "wx/image.h" -#include "wx/module.h" + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/window.h" + #include "wx/dcmemory.h" + #include "wx/math.h" + #include "wx/image.h" + #include "wx/module.h" +#endif + #include "wx/fontutil.h" #include "wx/x11/private.h" -#include "wx/math.h" - #if wxUSE_UNICODE #include "glib.h" #include "pango/pangox.h" @@ -1185,22 +1191,15 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, int xscreen = DefaultScreen( xdisplay ); Window xroot = RootWindow( xdisplay, xscreen ); - new_pixmap = XCreatePixmap( xdisplay, xroot, w, h, 1 ); + new_pixmap = XCreatePixmap( xdisplay, xroot, ww, hh, 1 ); GC gc = XCreateGC( xdisplay, new_pixmap, 0, NULL ); - int bpp = wxTheApp->GetVisualInfo(m_display)->m_visualDepth; - if (bpp == 8) - XSetForeground( xdisplay, gc, WhitePixel(xdisplay,xscreen) ); - else - XSetForeground( xdisplay, gc, BlackPixel(xdisplay,xscreen) ); - + XSetForeground( xdisplay, gc, BlackPixel(xdisplay,xscreen) ); + XSetFillStyle( xdisplay, gc, FillSolid ); - XFillRectangle( xdisplay, new_pixmap, gc, 0, 0, w, h ); + XFillRectangle( xdisplay, new_pixmap, gc, 0, 0, ww, hh ); - if (bpp == 8) - XSetForeground( xdisplay, gc, BlackPixel(xdisplay,xscreen) ); - else - XSetForeground( xdisplay, gc, WhitePixel(xdisplay,xscreen) ); + XSetForeground( xdisplay, gc, WhitePixel(xdisplay,xscreen) ); if (useMask && mask) { @@ -1242,10 +1241,10 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, // drawing a mono-bitmap (XBitmap) we use the current text GC if (is_mono) XCopyPlane( (Display*) m_display, (Pixmap) use_bitmap.GetBitmap(), (Window) m_window, - (GC) m_textGC, 0, 0, w, h, xx, yy, 1 ); + (GC) m_textGC, 0, 0, ww, hh, xx, yy, 1 ); else XCopyArea( (Display*) m_display, (Pixmap) use_bitmap.GetPixmap(), (Window) m_window, - (GC) m_penGC, 0, 0, w, h, xx, yy ); + (GC) m_penGC, 0, 0, ww, hh, xx, yy ); // remove mask again if any if (setClipMask) @@ -1594,7 +1593,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) #endif { XDrawString( (Display*) m_display, (Window) m_window, - (GC) m_textGC, x, y + XFontStructGetAscent(xfont), text.c_str(), text.Len() ); + (GC) m_textGC, x, y + XFontStructGetAscent(xfont), text.c_str(), text.length() ); } #if 0 @@ -1670,7 +1669,7 @@ void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoor int direction, ascent, descent2; XCharStruct overall; - XTextExtents( xfont, (char*) string.c_str(), string.Len(), &direction, + XTextExtents( xfont, (char*) string.c_str(), string.length(), &direction, &ascent, &descent2, &overall); if (width) @@ -1692,10 +1691,10 @@ wxCoord wxWindowDC::GetCharWidth() const PangoLayout *layout = pango_layout_new( m_context ); if (m_fontdesc) - pango_layout_set_font_description(layout, m_fontdesc); + pango_layout_set_font_description(layout, m_fontdesc); else - pango_layout_set_font_description(layout, this->GetFont().GetNativeFontInfo()->description); - + pango_layout_set_font_description(layout, this->GetFont().GetNativeFontInfo()->description); + pango_layout_set_text(layout, "H", 1 ); int w,h; pango_layout_get_pixel_size(layout, &w, &h); @@ -1726,10 +1725,10 @@ wxCoord wxWindowDC::GetCharHeight() const PangoLayout *layout = pango_layout_new( m_context ); if (m_fontdesc) - pango_layout_set_font_description(layout, m_fontdesc); + pango_layout_set_font_description(layout, m_fontdesc); else - pango_layout_set_font_description(layout, this->GetFont().GetNativeFontInfo()->description); - + pango_layout_set_font_description(layout, this->GetFont().GetNativeFontInfo()->description); + pango_layout_set_text(layout, "H", 1 ); int w,h; pango_layout_get_pixel_size(layout, &w, &h); @@ -1787,9 +1786,9 @@ void wxWindowDC::SetFont( const wxFont &font ) wxCHECK_RET( Ok(), wxT("invalid dc") ); m_font = font; - + return; - + #if wxUSE_UNICODE m_fontdesc = font.GetNativeFontInfo()->description; #endif