+void wxHtmlImageCell::SetImage(const wxImage& img)
+{
+ if ( img.Ok() )
+ {
+ delete m_bitmap;
+
+ int ww, hh;
+ ww = img.GetWidth();
+ hh = img.GetHeight();
+
+ if ( m_bmpW == -1 )
+ m_bmpW = ww;
+ if ( m_bmpH == -1 )
+ m_bmpH = hh;
+
+ if ((m_bmpW != ww) || (m_bmpH != hh))
+ {
+ wxImage img2 = img.Scale(m_bmpW, m_bmpH);
+ m_bitmap = new wxBitmap(img2);
+ }
+ else
+ m_bitmap = new wxBitmap(img);
+ }
+}
+
+#if wxUSE_GIF && wxUSE_TIMER
+void wxHtmlImageCell::AdvanceAnimation(wxTimer *timer)
+{
+ wxImage img;
+
+ m_gifDecoder->GoNextFrame(TRUE);
+
+ if ( m_physX == -1 )
+ {
+ m_physX = m_physY = 0;
+ for (wxHtmlCell *cell = this; cell; cell = cell->GetParent())
+ {
+ m_physX += cell->GetPosX();
+ m_physY += cell->GetPosY();
+ }
+ }
+
+ int x, y;
+ m_window->CalcScrolledPosition(m_physX, m_physY, &x, &y);
+ wxRect rect(x, y, m_Width, m_Height);
+
+ if ( m_window->GetClientRect().Intersects(rect) &&
+ m_gifDecoder->ConvertToImage(&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(),
+ TRUE /* use mask */);
+ }
+ else
+ SetImage(img);
+ m_window->Refresh(img.HasMask(), &rect);
+ }
+
+ timer->Start(m_gifDecoder->GetDelay(), TRUE);
+}
+
+void wxHtmlImageCell::Layout(int w)
+{
+ wxHtmlCell::Layout(w);
+ m_physX = m_physY = -1;