Skip to content
Browse files

jpeg: more fixups

  • Loading branch information...
1 parent dd0b2ad commit 5e1ab07892cb40f815c2cb4220b6b7999e7818b4 theuni committed Sep 21, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −4 xbmc/guilib/JpegIO.cpp
  2. +0 −2 xbmc/guilib/JpegIO.h
View
10 xbmc/guilib/JpegIO.cpp
@@ -209,7 +209,6 @@ bool CJpegIO::Open(const CStdString& texturePath, unsigned int minx, unsigned i
jpeg_calc_output_dimensions (&m_cinfo);
m_width = m_cinfo.output_width;
m_height = m_cinfo.output_height;
- m_pitch = (((m_cinfo.output_width + 1)* 3 / 4) * 4); //align to 4-bytes
GetExif();
return true;
@@ -243,21 +242,24 @@ bool CJpegIO::GetExif()
bool CJpegIO::Decode(const unsigned char *pixels, unsigned int format)
{
unsigned char *dst = (unsigned char *) pixels;
+ unsigned int pitch;
try
{
jpeg_start_decompress( &m_cinfo );
if (format == XB_FMT_RGB8)
{
+ pitch = ((m_width + 1)* 3 / 4) * 4; //align to 4-bytes
while( m_cinfo.output_scanline < m_height )
{
- jpeg_read_scanlines( &m_cinfo, &dst, 1 );
- dst+=m_pitch;
+ jpeg_read_scanlines( &m_cinfo, &dst, 1 );
+ dst+=pitch;
}
}
else if (format == XB_FMT_A8R8G8B8)
{
unsigned char* row = new unsigned char[m_width * 3];
+ pitch = m_width*4;
while( m_cinfo.output_scanline < m_height)
{
jpeg_read_scanlines( &m_cinfo, &row, 1 );
@@ -269,7 +271,7 @@ bool CJpegIO::Decode(const unsigned char *pixels, unsigned int format)
*dst2++ = row[(x*3)+0];
*dst2++ = 0xff;
}
- dst += m_width * 4;
+ dst += pitch;
}
}
else
View
2 xbmc/guilib/JpegIO.h
@@ -43,7 +43,6 @@ class CJpegIO
unsigned int FileSize() { return m_imgsize; }
unsigned int Width() { return m_width; }
unsigned int Height() { return m_height; }
- unsigned int Pitch() { return m_pitch; }
unsigned int Orientation() { return m_orientation; }
protected:
@@ -59,7 +58,6 @@ class CJpegIO
unsigned int m_imgsize;
unsigned int m_width;
unsigned int m_height;
- unsigned int m_pitch;
unsigned int m_orientation;
};

0 comments on commit 5e1ab07

Please sign in to comment.
Something went wrong with that request. Please try again.