aboutsummaryrefslogtreecommitdiff
path: root/backends/PalmOS/Src/i_zodiac.cpp
blob: 20b06aa61f41dc287355da3b4ef443204354aebc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <PalmOS.h>
#include "extend.h"

#ifndef DISABLE_TAPWAVE

#include "tapwave.h"
#include "i_zodiac.h"

// _twBmpV3 = offscreen bitmap, must be set before this call
Err ZodiacInit(void **ptrP, Int32 w, Int32 h) {
	Err e;

	TwGfxSurfaceInfoType surface = {
		sizeof(TwGfxSurfaceInfoType),
		w, h, w * 2,
		twGfxLocationAcceleratorMemory,
		twGfxPixelFormatRGB565_LE
	};

	e = SysSetOrientation(sysOrientationLandscape);
	e = TwGfxOpen((TwGfxType **)&_twGfxLib, NULL);
	e = TwGfxAllocSurface(	(TwGfxType *)_twGfxLib,
							(TwGfxSurfaceType **)&_twSrc,
							&surface);

	e = TwGfxGetPalmDisplaySurface(	(TwGfxType *)_twGfxLib,
									(TwGfxSurfaceType **)&_twDst);

	return e;
}

Err ZodiacRelease(void **ptrP) {
	Err e = errNone;

	TwGfxFreeSurface((TwGfxSurfaceType *)_twSrc);
	TwGfxClose((TwGfxType *)_twGfxLib);

	return e;
}

#endif