Qt 4.8
Classes | Macros | Functions
qmnghandler.cpp File Reference
#include "qmnghandler_p.h"
#include "qimage.h"
#include "qvariant.h"
#include "qcolor.h"
#include <libmng.h>

Go to the source code of this file.

Classes

class  QMngHandlerPrivate
 

Macros

#define MNG_USE_SO
 

Functions

static mng_ptr myalloc (mng_size_t iSize)
 
static mng_bool myclosestream (mng_handle hMNG)
 
static mng_bool myerror (mng_handle, mng_int32 iErrorcode, mng_int8, mng_chunkid iChunkname, mng_uint32, mng_int32 iExtra1, mng_int32 iExtra2, mng_pchar zErrortext)
 
static void myfree (mng_ptr pPtr, mng_size_t)
 
static mng_ptr mygetcanvasline (mng_handle hMNG, mng_uint32 iLinenr)
 
static mng_uint32 mygettickcount (mng_handle hMNG)
 
static mng_bool myopenstream (mng_handle)
 
static mng_bool myprocessheader (mng_handle hMNG, mng_uint32 iWidth, mng_uint32 iHeight)
 
static mng_bool myprocessterm (mng_handle hMNG, mng_uint8 iTermaction, mng_uint8, mng_uint32, mng_uint32 iItermax)
 
static mng_bool myreaddata (mng_handle hMNG, mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pRead)
 
static mng_bool myrefresh (mng_handle, mng_uint32, mng_uint32, mng_uint32, mng_uint32)
 
static mng_bool mysettimer (mng_handle hMNG, mng_uint32 iMsecs)
 
static mng_bool mytrace (mng_handle, mng_int32 iFuncnr, mng_int32 iFuncseq, mng_pchar zFuncname)
 
static mng_bool mywritedata (mng_handle hMNG, mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pWritten)
 

Macro Definition Documentation

◆ MNG_USE_SO

#define MNG_USE_SO

Definition at line 48 of file qmnghandler.cpp.

Function Documentation

◆ myalloc()

static mng_ptr myalloc ( mng_size_t  iSize)
static

Definition at line 104 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

105 {
106 #if defined(Q_OS_WINCE)
107  mng_ptr ptr = malloc(iSize);
108  memset(ptr, 0, iSize);
109  return ptr;
110 #else
111  return (mng_ptr)calloc(1, iSize);
112 #endif
113 }
#define calloc(a, b)
const T * ptr(const T &t)

◆ myclosestream()

static mng_bool myclosestream ( mng_handle  hMNG)
static

Definition at line 125 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

126 {
127  QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
128  pMydata->haveReadAll = true;
129  return MNG_TRUE;
130 }

◆ myerror()

static mng_bool myerror ( mng_handle  ,
mng_int32  iErrorcode,
mng_int8  ,
mng_chunkid  iChunkname,
mng_uint32  ,
mng_int32  iExtra1,
mng_int32  iExtra2,
mng_pchar  zErrortext 
)
static

Definition at line 85 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

93 {
94  qWarning("MNG error %d: %s; chunk %c%c%c%c; subcode %d:%d",
95  iErrorcode,zErrortext,
96  (iChunkname>>24)&0xff,
97  (iChunkname>>16)&0xff,
98  (iChunkname>>8)&0xff,
99  (iChunkname>>0)&0xff,
100  iExtra1,iExtra2);
101  return TRUE;
102 }
Q_CORE_EXPORT void qWarning(const char *,...)
#define TRUE
Synonym for true.
Definition: qglobal.h:1018

◆ myfree()

static void myfree ( mng_ptr  pPtr,
mng_size_t   
)
static

Definition at line 115 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

116 {
117  free(pPtr);
118 }

◆ mygetcanvasline()

static mng_ptr mygetcanvasline ( mng_handle  hMNG,
mng_uint32  iLinenr 
)
static

Definition at line 158 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate(), and QMngHandlerPrivate::writeImage().

160 {
161  QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
162  return (mng_ptr)pMydata->image.scanLine(iLinenr);
163 }
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886

◆ mygettickcount()

static mng_uint32 mygettickcount ( mng_handle  hMNG)
static

Definition at line 174 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

175 {
176  QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
177  return pMydata->elapsed++;
178 }

◆ myopenstream()

static mng_bool myopenstream ( mng_handle  )
static

Definition at line 120 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

121 {
122  return MNG_TRUE;
123 }

◆ myprocessheader()

static mng_bool myprocessheader ( mng_handle  hMNG,
mng_uint32  iWidth,
mng_uint32  iHeight 
)
static

Definition at line 150 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

153 {
154  QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
155  return pMydata->processHeader(iWidth, iHeight);
156 }
mng_bool processHeader(mng_uint32 iWidth, mng_uint32 iHeight)

◆ myprocessterm()

static mng_bool myprocessterm ( mng_handle  hMNG,
mng_uint8  iTermaction,
mng_uint8  ,
mng_uint32  ,
mng_uint32  iItermax 
)
static

Definition at line 189 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

194 {
195  QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
196  if (iTermaction == 3)
197  pMydata->iterCount = iItermax;
198  return MNG_TRUE;
199 }

◆ myreaddata()

static mng_bool myreaddata ( mng_handle  hMNG,
mng_ptr  pBuf,
mng_uint32  iSize,
mng_uint32p  pRead 
)
static

Definition at line 132 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

136 {
137  QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
138  return pMydata->readData(pBuf, iSize, pRead);
139 }
mng_bool readData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pRead)

◆ myrefresh()

static mng_bool myrefresh ( mng_handle  ,
mng_uint32  ,
mng_uint32  ,
mng_uint32  ,
mng_uint32   
)
static

Definition at line 165 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

170 {
171  return MNG_TRUE;
172 }

◆ mysettimer()

static mng_bool mysettimer ( mng_handle  hMNG,
mng_uint32  iMsecs 
)
static

Definition at line 180 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

182 {
183  QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
184  pMydata->elapsed += iMsecs;
185  pMydata->nextDelay = iMsecs;
186  return MNG_TRUE;
187 }

◆ mytrace()

static mng_bool mytrace ( mng_handle  ,
mng_int32  iFuncnr,
mng_int32  iFuncseq,
mng_pchar  zFuncname 
)
static

Definition at line 201 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

205 {
206  qDebug("mng trace: iFuncnr: %d iFuncseq: %d zFuncname: %s", iFuncnr, iFuncseq, zFuncname);
207  return MNG_TRUE;
208 }
Q_CORE_EXPORT void qDebug(const char *,...)

◆ mywritedata()

static mng_bool mywritedata ( mng_handle  hMNG,
mng_ptr  pBuf,
mng_uint32  iSize,
mng_uint32p  pWritten 
)
static

Definition at line 141 of file qmnghandler.cpp.

Referenced by QMngHandlerPrivate::QMngHandlerPrivate().

145 {
146  QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
147  return pMydata->writeData(pBuf, iSize, pWritten);
148 }
mng_bool writeData(mng_ptr pBuf, mng_uint32 iSize, mng_uint32p pWritten)