]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/m_image.cpp
disable long filenames under DJGPP
[wxWidgets.git] / src / html / m_image.cpp
index 396edda93d32d60bbae637c8a447024d0eded04c..4ab735e28ae4b6cf57a84c36e506b5bfdece81dc 100644 (file)
@@ -24,6 +24,7 @@
     #include "wx/dc.h"
     #include "wx/scrolwin.h"
     #include "wx/timer.h"
+    #include "wx/dcmemory.h"
 #endif
 
 #include "wx/html/forcelnk.h"
@@ -325,7 +326,7 @@ wxHtmlImageCell::wxHtmlImageCell(wxWindow *window, wxFSFile *input,
                                  int w, int h, double scale, int align, 
                                  const wxString& mapname) : wxHtmlCell()
 {
-    m_window = wxStaticCast(window, wxScrolledWindow);
+    m_window = window ? wxStaticCast(window, wxScrolledWindow) : NULL;
     m_scale = scale;
     m_bitmap = NULL;
     m_bmpW = w;
@@ -448,7 +449,17 @@ void wxHtmlImageCell::AdvanceAnimation(wxTimer *timer)
     if ( m_window->GetClientRect().Intersects(rect) && 
          m_gifDecoder->ConvertToImage(&img) )
     {
-        SetImage(img);
+        if ( (int)m_gifDecoder->GetWidth() != m_Width ||
+             (int)m_gifDecoder->GetHeight() != m_Height ||
+             m_gifDecoder->GetLeft() != 0 || m_gifDecoder->GetTop() != 0 )
+        {
+            wxBitmap bmp(img);
+            wxMemoryDC dc;
+            dc.SelectObject(*m_bitmap);
+            dc.DrawBitmap(bmp, m_gifDecoder->GetLeft(), m_gifDecoder->GetTop());
+        }
+        else
+            SetImage(img);
         m_window->Refresh(img.HasMask(), &rect);
     }