Minor fixes to comments.
[AROS.git] / rom / graphics / blttemplate.c
blob41cada31cd827bb9fa9a246638368e80648a8015
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <proto/graphics.h>
11 #include <proto/oop.h>
13 #include "graphics_intern.h"
14 #include "gfxfuncsupport.h"
16 /****************************************************************************************/
18 struct bt_render_data
20 UBYTE *template;
21 ULONG modulo;
22 WORD srcx;
23 UBYTE inverttemplate;
26 static ULONG blttemplate_render(APTR btr_data, WORD srcx, WORD srcy,
27 OOP_Object *dstbm_obj, OOP_Object *dst_gc,
28 struct Rectangle *rect, struct GfxBase *GfxBase)
30 struct bt_render_data *btrd = btr_data;
31 WORD width = rect->MaxX - rect->MinX + 1;
32 WORD height = rect->MaxY - rect->MinY + 1;
33 UBYTE x = srcx + btrd->srcx;
34 UBYTE *template = btrd->template + btrd->modulo * srcy;
36 HIDD_BM_PutTemplate(dstbm_obj, dst_gc, template, btrd->modulo,
37 x, rect->MinX, rect->MinY, width, height, btrd->inverttemplate);
39 return width * height;
42 /*****************************************************************************
44 NAME */
45 #include <clib/graphics_protos.h>
47 AROS_LH8(void, BltTemplate,
49 /* SYNOPSIS */
51 AROS_LHA(PLANEPTR , source , A0),
52 AROS_LHA(WORD , xSrc , D0),
53 AROS_LHA(WORD , srcMod , D1),
54 AROS_LHA(struct RastPort * , destRP , A1),
55 AROS_LHA(WORD , xDest , D2),
56 AROS_LHA(WORD , yDest , D3),
57 AROS_LHA(WORD , xSize , D4),
58 AROS_LHA(WORD , ySize , D5),
60 /* LOCATION */
61 struct GfxBase *, GfxBase, 6, Graphics)
63 /* FUNCTION
64 Draws the image in the template into the
65 RastPort in the current color and drawing mode.
67 INPUTS
68 source - template bitplane. Should be Word aligned.
69 xSrc - x offset in source plane (0...15).
70 srcMod - BytesPerRow in template mask.
71 destRP - destination RastPort.
72 xDest,yDest - upper left corner of destination.
73 xSize,ySize - size of destination.
75 RESULT
77 NOTES
79 EXAMPLE
81 BUGS
83 SEE ALSO
85 INTERNALS
87 HISTORY
88 27-11-96 digulla automatically created from
89 graphics_lib.fd and clib/graphics_protos.h
91 *****************************************************************************/
93 AROS_LIBFUNC_INIT
95 struct bt_render_data btrd;
96 struct Rectangle rr;
98 EnterFunc(bug("driver_BltTemplate(%d, %d, %d, %d, %d, %d)\n"
99 , xSrc, srcMod, xDest, yDest, xSize, ySize));
101 FIX_GFXCOORD(xDest);
102 FIX_GFXCOORD(yDest);
104 btrd.template = (UBYTE *)source;
105 btrd.srcx = xSrc;
106 btrd.modulo = srcMod;
107 btrd.inverttemplate = (destRP->DrawMode & INVERSVID) ? TRUE : FALSE;
109 rr.MinX = xDest;
110 rr.MinY = yDest;
111 rr.MaxX = xDest + xSize - 1;
112 rr.MaxY = yDest + ySize - 1;
114 do_render_func(destRP, NULL, &rr, blttemplate_render, &btrd, TRUE, FALSE, GfxBase);
115 ReturnVoid("driver_BltTemplate");
117 AROS_LIBFUNC_EXIT
119 } /* BltTemplate */