- wxImage *img;
- int ww, hh;
- wxInputStream *s = input -> GetStream();
-
- img = new wxImage(*s, wxBITMAP_TYPE_ANY);
-
- m_Image = NULL;
- if (img && (img -> Ok())) {
- ww = img -> GetWidth();
- hh = img -> GetHeight();
- if (w != -1) m_Width = w; else m_Width = ww;
- if (h != -1) m_Height = h; else m_Height = hh;
-
- m_Width = (int)(scale * (double)m_Width);
- m_Height = (int)(scale * (double)m_Height);
-
- if ((m_Width != ww) || (m_Height != hh)) {
- wxImage img2 = img -> Scale(m_Width, m_Height);
- m_Image = new wxBitmap(img2.ConvertToBitmap());
- } else
- m_Image = new wxBitmap(img -> ConvertToBitmap());
- delete img;
+ m_window = wxStaticCast(window, wxScrolledWindow);
+ m_scale = scale;
+ m_bitmap = NULL;
+ m_bmpW = w;
+ m_bmpH = h;
+ m_imageMap = NULL;
+ m_mapName = mapname;
+ SetCanLiveOnPagebreak(FALSE);
+#if wxUSE_GIF && wxUSE_TIMER
+ m_gifDecoder = NULL;
+ m_gifTimer = NULL;
+ m_physX = m_physY = -1;
+#endif
+
+ wxInputStream *s = input->GetStream();
+
+ if ( s )
+ {
+ bool readImg = TRUE;
+
+#if wxUSE_GIF && wxUSE_TIMER
+ if ( (input->GetLocation().Matches(wxT("*.gif")) ||
+ input->GetLocation().Matches(wxT("*.GIF"))) && m_window )
+ {
+ m_gifDecoder = new wxGIFDecoder(s, TRUE);
+ if ( m_gifDecoder->ReadGIF() == wxGIF_OK )
+ {
+ wxImage img;
+ if ( m_gifDecoder->ConvertToImage(&img) )
+ SetImage(img);
+
+ readImg = FALSE;
+
+ if ( m_gifDecoder->IsAnimation() )
+ {
+ m_gifTimer = new wxGIFTimer(this);
+ m_gifTimer->Start(m_gifDecoder->GetDelay(), TRUE);
+ }
+ else
+ {
+ wxDELETE(m_gifDecoder);
+ }
+ }
+ else
+ {
+ wxDELETE(m_gifDecoder);
+ }
+ }
+
+ if ( readImg )
+#endif
+ {
+ SetImage(wxImage(*s, wxBITMAP_TYPE_ANY));
+ }