1 /*
2
3 Copyright (C) 2015-2018 Night Dive Studios, LLC.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 */
19 /*
20 * $Source: n:/project/lib/src/2d/RCS/fl8hfl8.c $
21 * $Revision: 1.3 $
22 * $Author: kaboom $
23 * $Date: 1993/10/19 09:50:33 $
24 *
25 * flat 8 bitmap horizontal flip routine.
26 *
27 * This file is part of the 2d library.
28 *
29 * $Log: fl8hfl8.c $
30 * Revision 1.3 1993/10/19 09:50:33 kaboom
31 * Replaced #include <grd.h" with new headers split from grd.h.
32 *
33 * Revision 1.2 1993/10/08 01:15:16 kaboom
34 * Changed quotes in #include lines to angle brackets for Watcom.
35 *
36 * Revision 1.1 1993/06/06 15:09:08 kaboom
37 * Initial revision
38 */
39
40 #include "cnvdat.h"
41
42 /* draw an unclipped, horizontally flipped flat 8 bitmap to a flat 8
43 canvas. */
flat8_hflip_flat8_ubitmap(grs_bitmap * bm,short x,short y)44 void flat8_hflip_flat8_ubitmap(grs_bitmap *bm, short x, short y) {
45 short w; /* bitmap width */
46 short h; /* height */
47 uchar *src; /* pointer into source bitmap */
48 uchar *dst; /* pointer into canvas memory */
49 ushort brow = bm->row;
50 ushort grow = grd_bm.row;
51 short bw = bm->w;
52
53 h = bm->h;
54 src = bm->bits;
55 dst = grd_bm.bits + y * grow + x + bw - 1;
56 while (h--) {
57 w = bw;
58 while (w--)
59 *dst-- = *src++;
60 src += brow - bw;
61 dst += grow + bw;
62 }
63 }
64