From 8708a10fa67501ab9fbf8f6160b89c26f1c59cbd Mon Sep 17 00:00:00 2001 From: Guillermo Rodriguez Garcia Date: Wed, 8 Dec 1999 11:59:43 +0000 Subject: [PATCH] Optimized for performance. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/gifdecod.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/gifdecod.cpp b/src/common/gifdecod.cpp index 0a8a6f525b..04f214a7f5 100644 --- a/src/common/gifdecod.cpp +++ b/src/common/gifdecod.cpp @@ -282,10 +282,14 @@ int wxGIFDecoder::getcode(int bits, int ab_fin) code = ab_fin; break; } + + /* prefetch data */ + m_f->Read((void *) m_buffer, m_restbyte); + m_bufp = m_buffer; } /* read next byte and isolate the bits we need */ - m_lastbyte = (unsigned char)m_f->GetC(); + m_lastbyte = (unsigned char) (*m_bufp++); mask = (1 << (bits - m_restbits)) - 1; code = code + ((m_lastbyte & mask) << m_restbits); m_restbyte--; @@ -335,7 +339,7 @@ int wxGIFDecoder::dgif(IMAGEN *img, int interl, int bits) pass = 1; pos = x = y = 0; - /* reset static globals */ + /* reset decoder vars */ m_restbits = 0; m_restbyte = 0; m_lastbyte = 0; -- 2.45.2