Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / blttemplate.c
blobdcee54b13a9e1cf227af313be02fd81d847e89da
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <proto/graphics.h>
10 #include <proto/oop.h>
11 #include "graphics_intern.h"
12 #include "gfxfuncsupport.h"
14 static ULONG blttemplate_render(APTR btr_data, LONG srcx, LONG srcy,
15 OOP_Object *dstbm_obj, OOP_Object *dst_gc,
16 LONG x1, LONG y1, LONG x2, LONG y2,
17 struct GfxBase *GfxBase);
19 struct bt_render_data
21 UBYTE *template;
22 ULONG modulo;
23 WORD srcx;
24 UBYTE inverttemplate;
27 /*****************************************************************************
29 NAME */
30 #include <clib/graphics_protos.h>
32 AROS_LH8(void, BltTemplate,
34 /* SYNOPSIS */
36 AROS_LHA(PLANEPTR , source , A0),
37 AROS_LHA(LONG , xSrc , D0),
38 AROS_LHA(LONG , srcMod , D1),
39 AROS_LHA(struct RastPort * , destRP , A1),
40 AROS_LHA(LONG , xDest , D2),
41 AROS_LHA(LONG , yDest , D3),
42 AROS_LHA(LONG , xSize , D4),
43 AROS_LHA(LONG , ySize , D5),
45 /* LOCATION */
46 struct GfxBase *, GfxBase, 6, Graphics)
48 /* FUNCTION
49 Draws the image in the template into the
50 RastPort in the current color and drawing mode.
52 INPUTS
53 source - template bitplane. Should be Word aligned.
54 xSrc - x offset in source plane (0...15).
55 srcMod - BytesPerRow in template mask.
56 destRP - destination RastPort.
57 xDest,yDest - upper left corner of destination.
58 xSize,ySize - size of destination.
60 RESULT
62 NOTES
64 EXAMPLE
66 BUGS
68 SEE ALSO
70 INTERNALS
72 HISTORY
73 27-11-96 digulla automatically created from
74 graphics_lib.fd and clib/graphics_protos.h
76 *****************************************************************************/
78 AROS_LIBFUNC_INIT
80 struct bt_render_data btrd;
81 struct Rectangle rr;
83 EnterFunc(bug("driver_BltTemplate(%d, %d, %d, %d, %d, %d)\n"
84 , xSrc, srcMod, xDest, yDest, xSize, ySize));
86 FIX_GFXCOORD(xDest);
87 FIX_GFXCOORD(yDest);
89 if (!OBTAIN_DRIVERDATA(destRP, GfxBase))
90 ReturnVoid("driver_BltTemplate");
92 btrd.template = (UBYTE *)source;
93 btrd.srcx = xSrc;
94 btrd.modulo = srcMod;
95 btrd.inverttemplate = (destRP->DrawMode & INVERSVID) ? TRUE : FALSE;
97 rr.MinX = xDest;
98 rr.MinY = yDest;
99 rr.MaxX = xDest + xSize - 1;
100 rr.MaxY = yDest + ySize - 1;
102 do_render_func(destRP, NULL, &rr, blttemplate_render, &btrd, TRUE, FALSE, GfxBase);
104 RELEASE_DRIVERDATA(destRP, GfxBase);
106 ReturnVoid("driver_BltTemplate");
108 AROS_LIBFUNC_EXIT
110 } /* BltTemplate */
112 /****************************************************************************************/
114 static ULONG blttemplate_render(APTR btr_data, LONG srcx, LONG srcy,
115 OOP_Object *dstbm_obj, OOP_Object *dst_gc,
116 LONG x1, LONG y1, LONG x2, LONG y2,
117 struct GfxBase *GfxBase)
119 struct bt_render_data *btrd;
120 ULONG width, height;
121 WORD x;
122 UBYTE *template;
124 width = x2 - x1 + 1;
125 height = y2 - y1 + 1;
127 btrd = (struct bt_render_data *)btr_data;
128 x = srcx + btrd->srcx;
130 template = btrd->template + btrd->modulo * srcy;
132 HIDD_BM_PutTemplate(dstbm_obj, dst_gc, template, btrd->modulo,
133 x, x1, y1, width, height, btrd->inverttemplate);
135 return width * height;