summaryrefslogtreecommitdiffstats
path: root/kmahjongg/Tileset.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /kmahjongg/Tileset.cpp
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmahjongg/Tileset.cpp')
-rw-r--r--kmahjongg/Tileset.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/kmahjongg/Tileset.cpp b/kmahjongg/Tileset.cpp
index b7e04f4e..fb4b1d05 100644
--- a/kmahjongg/Tileset.cpp
+++ b/kmahjongg/Tileset.cpp
@@ -16,9 +16,9 @@ static unsigned char mini_bits[] = {
0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x07, 0xff, 0xff, 0x03,
};
-#define mask_width 40
-#define mask_height 56
-static unsigned char mask_bits[] = {
+#define tqmask_width 40
+#define tqmask_height 56
+static unsigned char tqmask_bits[] = {
0xf0, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff,
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@@ -48,8 +48,8 @@ static unsigned char mask_bits[] = {
// ---------------------------------------------------------
Tileset::Tileset(bool scale):
- maskBits(mask_width, mask_height, mask_bits, true),
- maskBitsMini(mini_width, mini_height, mini_bits, true)
+ tqmaskBits(tqmask_width, tqmask_height, tqmask_bits, true),
+ tqmaskBitsMini(mini_width, mini_height, mini_bits, true)
{
isScaled = scale;
divisor = (isScaled) ? 2 : 1;
@@ -62,12 +62,12 @@ Tileset::Tileset(bool scale):
s = w*h; // RGBA's required per tile
// Allocate memory for the 9*5 tile arrays
- tiles = new QRgb [9*5*s];
- selectedTiles = new QRgb [9*5*s];
+ tiles = new TQRgb [9*5*s];
+ selectedTiles = new TQRgb [9*5*s];
// allocate memory for single tile storage
- selectedFace = new QRgb [s];
- unselectedFace = new QRgb [s];
+ selectedFace = new TQRgb [s];
+ unselectedFace = new TQRgb [s];
// quarter widths are used as an offset when
// overlaying tiles in 3 dimensions.
@@ -94,14 +94,14 @@ Tileset::~Tileset() {
// method returns the address of the byte after the copied image
// and can be used to fill a larger array of tiles.
-QRgb *Tileset::copyTileImage(short tileX, short tileY, QRgb *to, TQImage &from) {
- QRgb *dest = to;
- QRgb *src;
+TQRgb *Tileset::copyTileImage(short tileX, short tileY, TQRgb *to, TQImage &from) {
+ TQRgb *dest = to;
+ TQRgb *src;
- src = (QRgb *) from.scanLine(tileY * h)
+ src = (TQRgb *) from.scanLine(tileY * h)
+(tileX * w);
for (short pos=0; pos < h; pos++) {
- memcpy(dest, src, w*sizeof(QRgb));
+ memcpy(dest, src, w*sizeof(TQRgb));
dest+=w;
src += from.width();
}
@@ -117,16 +117,16 @@ QRgb *Tileset::copyTileImage(short tileX, short tileY, QRgb *to, TQImage &from)
// color).
-QRgb *Tileset::createTile(short x, short y,
- QRgb *det, TQImage &allTiles , QRgb *face) {
- QRgb *image ;
- QRgb *to = det;
+TQRgb *Tileset::createTile(short x, short y,
+ TQRgb *det, TQImage &allTiles , TQRgb *face) {
+ TQRgb *image ;
+ TQRgb *to = det;
// Alloc the space
- image = new QRgb[s];
+ image = new TQRgb[s];
// copy in the background
- memcpy(to, face, s*sizeof(QRgb));
+ memcpy(to, face, s*sizeof(TQRgb));
// get the tile gylph
copyTileImage(x, y , image, allTiles);
@@ -135,7 +135,7 @@ QRgb *Tileset::createTile(short x, short y,
// top left colour as the transparency. We step over
// the shadow and the boarder
- QRgb* src = image+ // image
+ TQRgb* src = image+ // image
ss+ // past the left shadow
bs+ // then the tile border
(bs * w); // then step past the top border
@@ -144,7 +144,7 @@ QRgb *Tileset::createTile(short x, short y,
to += (((ss+bs))+(bs*w));
- QRgb trans = *src;
+ TQRgb trans = *src;
// start after the top border rows and go through all rows
for( short YP=0; YP < h-ss - (2*bs); YP++) {
@@ -173,17 +173,17 @@ QRgb *Tileset::createTile(short x, short y,
// version, which can be used for mini tile requirements.
// this gives us a small tile for previews and showing
// removed tiles.
-void Tileset::createPixmap(QRgb *src, TQPixmap &dest, bool scale, bool shadow)
+void Tileset::createPixmap(TQRgb *src, TQPixmap &dest, bool scale, bool shadow)
{
TQImage buff;
- QRgb *line;
+ TQRgb *line;
buff.create(w, h, 32);
for (int y=0; y<h; y++) {
- line = (QRgb *) buff.scanLine(y);
- memcpy( line, src, w*sizeof(QRgb));
+ line = (TQRgb *) buff.scanLine(y);
+ memcpy( line, src, w*sizeof(TQRgb));
if (shadow) {
for (int spos=0; spos <w; spos++) {
@@ -195,13 +195,13 @@ void Tileset::createPixmap(QRgb *src, TQPixmap &dest, bool scale, bool shadow)
}
- // create the pixmap and initialise the drawing mask
+ // create the pixmap and initialise the drawing tqmask
if (!scale) {
dest.convertFromImage(buff);
- dest.setMask(maskBits);
+ dest.setMask(tqmaskBits);
} else {
dest.convertFromImage(buff.smoothScale(w/2, h/2));
- dest.setMask(maskBitsMini);
+ dest.setMask(tqmaskBitsMini);
}
}
@@ -212,10 +212,10 @@ bool Tileset::loadTileset( const TQString& tilesetPath, const bool isPreview)
{
TQImage qiTiles;
- QRgb *unsel;
- QRgb *sel;
- QRgb *nextSel=0;
- QRgb *nextUnsel=0;
+ TQRgb *unsel;
+ TQRgb *sel;
+ TQRgb *nextSel=0;
+ TQRgb *nextUnsel=0;
if (filename == tilesetPath) {
return true;