X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5a7fa9ed3b61f59573c90b632075b064ee27df6c..fd397f9966fcd6521945e2a9f23482a8b8acc0eb:/src/html/m_image.cpp diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index 9b7f7dfb8e..909c32a3fc 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -16,7 +16,7 @@ #include "wx/defs.h" #if wxUSE_HTML && wxUSE_STREAMS -#ifdef __BORDLANDC__ +#ifdef __BORLANDC__ #pragma hdrstop #endif @@ -34,6 +34,7 @@ #include "wx/image.h" #include "wx/gifdecod.h" #include "wx/dynarray.h" +#include "wx/log.h" #include #include @@ -302,6 +303,8 @@ private: double m_scale; wxHtmlImageMapCell *m_imageMap; wxString m_mapName; + + DECLARE_NO_COPY_CLASS(wxHtmlImageCell) }; #if wxUSE_GIF && wxUSE_TIMER @@ -316,6 +319,8 @@ class wxGIFTimer : public wxTimer private: wxHtmlImageCell *m_cell; + + DECLARE_NO_COPY_CLASS(wxGIFTimer) }; #endif @@ -327,13 +332,13 @@ class wxGIFTimer : public wxTimer /* XPM */ static const char * broken_image_xpm[] = { "29 31 7 1", -" c None", -". c #808080", -"+ c #FFFFFF", -"@ c #C0C0C0", -"# c #000000", -"$ c #333366", -"% c #B2B2B2", +" c None", +". c #808080", +"+ c #FFFFFF", +"@ c #C0C0C0", +"# c #000000", +"$ c #333366", +"% c #B2B2B2", "..................... ", ".+++++++++++++++++++.. ", ".+++++++++++++++++++.@. ", @@ -385,65 +390,71 @@ wxHtmlImageCell::wxHtmlImageCell(wxWindow *window, wxFSFile *input, m_physX = m_physY = -1; #endif - if ( input ) + if ( m_bmpW && m_bmpH ) { - wxInputStream *s = input->GetStream(); - - if ( s ) + if ( input ) { - bool readImg = TRUE; + wxInputStream *s = input->GetStream(); -#if wxUSE_GIF && wxUSE_TIMER - if ( (input->GetLocation().Matches(wxT("*.gif")) || - input->GetLocation().Matches(wxT("*.GIF"))) && m_window ) + if ( s ) { - m_gifDecoder = new wxGIFDecoder(s, TRUE); - if ( m_gifDecoder->ReadGIF() == wxGIF_OK ) + bool readImg = TRUE; + +#if wxUSE_GIF && wxUSE_TIMER + if ( (input->GetLocation().Matches(wxT("*.gif")) || + input->GetLocation().Matches(wxT("*.GIF"))) && m_window ) { - wxImage img; - if ( m_gifDecoder->ConvertToImage(&img) ) - SetImage(img); + m_gifDecoder = new wxGIFDecoder(s, TRUE); + if ( m_gifDecoder->ReadGIF() == wxGIF_OK ) + { + wxImage img; + if ( m_gifDecoder->ConvertToImage(&img) ) + SetImage(img); - readImg = FALSE; + readImg = FALSE; - if ( m_gifDecoder->IsAnimation() ) - { - m_gifTimer = new wxGIFTimer(this); - m_gifTimer->Start(m_gifDecoder->GetDelay(), TRUE); + if ( m_gifDecoder->IsAnimation() ) + { + m_gifTimer = new wxGIFTimer(this); + m_gifTimer->Start(m_gifDecoder->GetDelay(), TRUE); + } + else + { + wxDELETE(m_gifDecoder); + } } else { wxDELETE(m_gifDecoder); } } - else - { - wxDELETE(m_gifDecoder); - } - } - if ( readImg ) + if ( readImg ) #endif // wxUSE_GIF && wxUSE_TIMER - { - SetImage(wxImage(*s, wxBITMAP_TYPE_ANY)); + { + wxImage image(*s, wxBITMAP_TYPE_ANY); + if ( image.Ok() ) + SetImage(image); + } } } - } - else // input==NULL, use "broken image" bitmap - { - if ( m_bmpW == -1 && m_bmpH == -1 ) - { - m_bmpW = 29; - m_bmpH = 31; - } - else + else // input==NULL, use "broken image" bitmap { - m_showFrame = TRUE; - if ( m_bmpW == -1 ) m_bmpW = 31; - if ( m_bmpH == -1 ) m_bmpH = 33; + if ( m_bmpW == -1 && m_bmpH == -1 ) + { + m_bmpW = 29; + m_bmpH = 31; + } + else + { + m_showFrame = TRUE; + if ( m_bmpW == -1 ) m_bmpW = 31; + if ( m_bmpH == -1 ) m_bmpH = 33; + } + m_bitmap = new wxBitmap(broken_image_xpm); } - m_bitmap = new wxBitmap(broken_image_xpm); } + //else: ignore the 0-sized images used sometimes on the Web pages m_Width = (int)(scale * (double)m_bmpW); m_Height = (int)(scale * (double)m_bmpH);