]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/graphics.cpp
Disable some wxWebView tests that fail on the buildbot but not locally.
[wxWidgets.git] / src / msw / graphics.cpp
index 91dad07c353ba87ebc706d2dc8c20219f7fe92bd..e5161c5d5bca3ca33d22dbc1e465b6d5a74e987d 100644 (file)
@@ -296,6 +296,11 @@ public:
     wxGDIPlusFontData( wxGraphicsRenderer* renderer,
                        const wxFont &font,
                        const wxColour& col );
+    wxGDIPlusFontData(wxGraphicsRenderer* renderer,
+                      const wxString& name,
+                      REAL sizeInPixels,
+                      int style,
+                      const wxColour& col);
     ~wxGDIPlusFontData();
 
     virtual Brush* GetGDIPlusBrush() { return m_textBrush; }
@@ -307,7 +312,8 @@ private :
     void Init(const wxString& name,
               REAL size,
               int style,
-              const wxColour& col);
+              const wxColour& col,
+              Unit fontUnit);
 
     Brush* m_textBrush;
     Font* m_font;
@@ -535,11 +541,17 @@ public :
     virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap );
 #if wxUSE_IMAGE
     virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image);
+    virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp);
 #endif // wxUSE_IMAGE
 
     virtual wxGraphicsFont CreateFont( const wxFont& font,
                                        const wxColour& col);
 
+    virtual wxGraphicsFont CreateFont(double size,
+                                      const wxString& facename,
+                                      int flags = wxFONTFLAG_DEFAULT,
+                                      const wxColour& col = *wxBLACK);
+
     // create a graphics bitmap from a native bitmap
     virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap );
 
@@ -884,9 +896,10 @@ void
 wxGDIPlusFontData::Init(const wxString& name,
                         REAL size,
                         int style,
-                        const wxColour& col)
+                        const wxColour& col,
+                        Unit fontUnit)
 {
-    m_font = new Font(name, size, style, UnitPoint);
+    m_font = new Font(name.wc_str(), size, style, fontUnit);
 
     m_textBrush = new SolidBrush(wxColourToColor(col));
 }
@@ -904,7 +917,17 @@ wxGDIPlusFontData::wxGDIPlusFontData( wxGraphicsRenderer* renderer,
     if ( font.GetWeight() == wxFONTWEIGHT_BOLD )
         style |= FontStyleBold;
 
-    Init(font.GetFaceName(), font.GetPointSize(), style, col);
+    Init(font.GetFaceName(), font.GetPointSize(), style, col, UnitPoint);
+}
+
+wxGDIPlusFontData::wxGDIPlusFontData(wxGraphicsRenderer* renderer,
+                                     const wxString& name,
+                                     REAL sizeInPixels,
+                                     int style,
+                                     const wxColour& col) :
+    wxGraphicsObjectRefData(renderer)
+{
+    Init(name, sizeInPixels, style, col, UnitPixel);
 }
 
 wxGDIPlusFontData::~wxGDIPlusFontData()
@@ -1056,22 +1079,6 @@ wxGDIPlusBitmapData::~wxGDIPlusBitmapData()
     delete m_helper;
 }
 
-// ----------------------------------------------------------------------------
-// wxGraphicsBitmap implementation
-// ----------------------------------------------------------------------------
-
-#if wxUSE_IMAGE
-
-wxImage wxGraphicsBitmap::ConvertToImage() const
-{
-    const wxGDIPlusBitmapData* const
-        data = static_cast<wxGDIPlusBitmapData*>(GetGraphicsData());
-
-    return data ? data->ConvertToImage() : wxNullImage;
-}
-
-#endif // wxUSE_IMAGE
-
 //-----------------------------------------------------------------------------
 // wxGDIPlusPath implementation
 //-----------------------------------------------------------------------------
@@ -2113,6 +2120,31 @@ wxGDIPlusRenderer::CreateFont( const wxFont &font,
         return wxNullGraphicsFont;
 }
 
+wxGraphicsFont
+wxGDIPlusRenderer::CreateFont(double size,
+                              const wxString& facename,
+                              int flags,
+                              const wxColour& col)
+{
+    ENSURE_LOADED_OR_RETURN(wxNullGraphicsFont);
+
+    // Convert wxFont flags to GDI+ style:
+    int style = FontStyleRegular;
+    if ( flags & wxFONTFLAG_ITALIC )
+        style |= FontStyleItalic;
+    if ( flags & wxFONTFLAG_UNDERLINED )
+        style |= FontStyleUnderline;
+    if ( flags & wxFONTFLAG_BOLD )
+        style |= FontStyleBold;
+    if ( flags & wxFONTFLAG_STRIKETHROUGH )
+        style |= FontStyleStrikeout;
+
+
+    wxGraphicsFont f;
+    f.SetRefData(new wxGDIPlusFontData(this, facename, size, style, col));
+    return f;
+}
+
 wxGraphicsBitmap wxGDIPlusRenderer::CreateBitmap( const wxBitmap &bitmap )
 {
     ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap);
@@ -2147,8 +2179,19 @@ wxGraphicsBitmap wxGDIPlusRenderer::CreateBitmapFromImage(const wxImage& image)
         return wxNullGraphicsBitmap;
 }
 
+
+wxImage wxGDIPlusRenderer::CreateImageFromBitmap(const wxGraphicsBitmap& bmp)
+{
+    ENSURE_LOADED_OR_RETURN(wxNullImage);
+    const wxGDIPlusBitmapData* const
+        data = static_cast<wxGDIPlusBitmapData*>(bmp.GetGraphicsData());
+
+    return data ? data->ConvertToImage() : wxNullImage;
+}
+
 #endif // wxUSE_IMAGE
 
+
 wxGraphicsBitmap wxGDIPlusRenderer::CreateBitmapFromNativeBitmap( void *bitmap )
 {
     ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap);