revert between 56095 -> 55830 in arch
[AROS.git] / rom / graphics / blttemplate.c
blob1565acf7ecc31ab910a027c32ef059dd79f5c7a4
1 /*
2 Copyright © 1995-2013, 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 WORD 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 part of a single-bitplane image into the RastPort in the current
65 colors (foreground and background) and drawing mode.
67 INPUTS
68 source - pointer to the aligned UWORD in which the top-lefthand corner
69 of the template is located.
70 xSrc - bit offset of top-lefthand corner of template from start of
71 UWORD pointed to by 'source' input (0 to 15).
72 srcMod - number of bytes per row in template's bitplane.
73 destRP - destination RastPort.
74 xDest,yDest - upper left corner of destination.
75 xSize,ySize - size of destination.
77 RESULT
78 None.
80 NOTES
81 The size and destination coordinates may be outside the RastPort
82 boundaries, in which case the affected area is safely truncated.
84 EXAMPLE
86 BUGS
88 SEE ALSO
90 INTERNALS
92 *****************************************************************************/
94 AROS_LIBFUNC_INIT
96 struct bt_render_data btrd;
97 struct Rectangle rr;
99 EnterFunc(bug("driver_BltTemplate(%d, %d, %d, %d, %d, %d)\n"
100 , xSrc, srcMod, xDest, yDest, xSize, ySize));
102 FIX_GFXCOORD(xDest);
103 FIX_GFXCOORD(yDest);
105 btrd.template = (UBYTE *)source;
106 btrd.srcx = xSrc;
107 btrd.modulo = srcMod;
108 btrd.inverttemplate = (destRP->DrawMode & INVERSVID) ? TRUE : FALSE;
110 rr.MinX = xDest;
111 rr.MinY = yDest;
112 rr.MaxX = xDest + xSize - 1;
113 rr.MaxY = yDest + ySize - 1;
115 do_render_func(destRP, NULL, &rr, blttemplate_render, &btrd, TRUE, FALSE, GfxBase);
116 ReturnVoid("driver_BltTemplate");
118 AROS_LIBFUNC_EXIT
120 } /* BltTemplate */