Indentation fix, cleanup.
[AROS.git] / rom / graphics / bltbitmaprastport.c
blob5116c1fad39eaabd2c7dc47efbc4476483d2654d
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <proto/oop.h>
11 #include "graphics_intern.h"
12 #include "gfxfuncsupport.h"
13 #include "graphics_driver.h"
15 /****************************************************************************************/
17 struct bitmap_render_data
19 struct render_special_info rsi;
20 ULONG minterm;
21 struct BitMap *srcbm;
22 OOP_Object *srcbm_obj;
25 static ULONG bitmap_render(APTR bitmap_rd, WORD srcx, WORD srcy,
26 OOP_Object *dstbm_obj, OOP_Object *dst_gc,
27 struct Rectangle *rect, struct GfxBase *GfxBase)
29 struct bitmap_render_data *brd = bitmap_rd;
30 OOP_Object *gfxhidd = SelectDriverObject(brd->srcbm, dstbm_obj, GfxBase);
31 WORD width = rect->MaxX - rect->MinX + 1;
32 WORD height = rect->MaxY - rect->MinY + 1;
33 BOOL res;
35 // D(bug("bitmap_render(%p, %d, %d, %p, %p, %d, %d, %d, %d, %p)\n"
36 // , bitmap_rd, srcx, srcy, dstbm_obj, dst_gc, rect->MinX, rect->MinY, rect->MaxX, rect->MaxY, GfxBase));
39 * Get some info on the colormaps. We have to make sure
40 * that we have the appropriate mapping tables set.
42 res = int_bltbitmap(brd->srcbm, brd->srcbm_obj, srcx, srcy,
43 brd->rsi.curbm, dstbm_obj, rect->MinX, rect->MinY,
44 width, height, brd->minterm, gfxhidd, dst_gc, GfxBase);
46 return res ? width * height : 0;
49 /*****************************************************************************
51 NAME */
52 #include <proto/graphics.h>
54 AROS_LH9 (void, BltBitMapRastPort,
56 /* SYNOPSIS */
57 AROS_LHA(struct BitMap *, srcBitMap, A0),
58 AROS_LHA(WORD , xSrc, D0),
59 AROS_LHA(WORD , ySrc, D1),
60 AROS_LHA(struct RastPort *, destRP, A1),
61 AROS_LHA(WORD , xDest, D2),
62 AROS_LHA(WORD , yDest, D3),
63 AROS_LHA(WORD , xSize, D4),
64 AROS_LHA(WORD , ySize, D5),
65 AROS_LHA(ULONG , minterm, D6),
67 /* LOCATION */
68 struct GfxBase *, GfxBase, 101, Graphics)
70 /* FUNCTION
71 Moves part of a bitmap around or into another bitmap.
73 INPUTS
74 srcBitMap - Copy from this bitmap.
75 xSrc, ySrc - This is the upper left corner of the area to copy.
76 destRP - Destination RastPort.
77 xDest, yDest - Upper left corner where to place the copy
78 xSize, ySize - The size of the area to copy
79 minterm - How to copy. See BltBitMap() for an explanation.
81 RESULT
82 TRUE.
84 NOTES
85 If special hardware is available, this function will use it.
87 EXAMPLE
89 BUGS
91 SEE ALSO
92 ClipBlit()
94 INPUTS
96 RESULT
98 NOTES
100 INTERNALS
102 *****************************************************************************/
104 AROS_LIBFUNC_INIT
106 struct bitmap_render_data brd;
107 struct Rectangle rr;
108 OOP_Object *gc;
109 Point src;
111 EnterFunc(bug("BltBitMapRastPort(%d %d %d, %d, %d, %d, %x, %p, %p)\n"
112 , xSrc, ySrc, xDest, yDest, xSize, ySize, minterm, srcBitMap, destRP));
114 FIX_GFXCOORD(xSrc);
115 FIX_GFXCOORD(ySrc);
116 FIX_GFXCOORD(xDest);
117 FIX_GFXCOORD(yDest);
119 brd.srcbm_obj = OBTAIN_HIDD_BM(srcBitMap);
120 if (NULL == brd.srcbm_obj)
122 return;
125 brd.minterm = minterm;
126 brd.srcbm = srcBitMap;
128 /* Get RastPort's GC and set the correct ROP */
129 gc = GetDriverData(destRP, GfxBase);
130 GC_DRMD(gc) = MINTERM_TO_GCDRMD(minterm);
132 rr.MinX = xDest;
133 rr.MinY = yDest;
134 rr.MaxX = xDest + xSize - 1;
135 rr.MaxY = yDest + ySize - 1;
137 src.x = xSrc;
138 src.y = ySrc;
140 do_render_with_gc(destRP, &src, &rr, bitmap_render, &brd, gc, TRUE, TRUE, GfxBase);
142 RELEASE_HIDD_BM(brd.srcbm_obj, srcBitMap);
143 ReturnVoid("BltBitMapRastPort");
145 AROS_LIBFUNC_EXIT
147 } /* BltBitMapRastPort */