- 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;
- 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_windowIface = windowIface;
+ m_scale = scale;
+ m_showFrame = false;
+ 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 = wxDefaultCoord;
+ m_nCurrFrame = 0;
+#endif
+
+ if ( m_bmpW && m_bmpH )
+ {
+ if ( input )
+ {
+ wxInputStream *s = input->GetStream();
+
+ if ( s )
+ {
+#if wxUSE_GIF && wxUSE_TIMER
+ bool readImg = true;
+ if ( m_windowIface &&
+ (input->GetLocation().Matches(wxT("*.gif")) ||
+ input->GetLocation().Matches(wxT("*.GIF"))) )
+ {
+ m_gifDecoder = new wxGIFDecoder();
+ if ( m_gifDecoder->LoadGIF(*s) == wxGIF_OK )
+ {
+ wxImage img;
+ if ( m_gifDecoder->ConvertToImage(0, &img) )
+ SetImage(img);
+
+ readImg = false;
+
+ if ( m_gifDecoder->IsAnimation() )
+ {
+ m_gifTimer = new wxGIFTimer(this);
+ m_gifTimer->Start(m_gifDecoder->GetDelay(0), true);
+ }
+ else
+ {
+ wxDELETE(m_gifDecoder);
+ }
+ }
+ else
+ {
+ wxDELETE(m_gifDecoder);
+ }
+ }
+
+ if ( readImg )
+#endif // wxUSE_GIF && wxUSE_TIMER
+ {
+ wxImage image(*s, wxBITMAP_TYPE_ANY);
+ if ( image.Ok() )
+ SetImage(image);
+ }
+ }
+ }
+ else // input==NULL, use "broken image" bitmap
+ {
+ if ( m_bmpW == wxDefaultCoord && m_bmpH == wxDefaultCoord )
+ {
+ m_bmpW = 29;
+ m_bmpH = 31;
+ }
+ else
+ {
+ m_showFrame = true;
+ if ( m_bmpW == wxDefaultCoord ) m_bmpW = 31;
+ if ( m_bmpH == wxDefaultCoord ) m_bmpH = 33;
+ }
+ m_bitmap =
+ new wxBitmap(wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
+ }