New attempt to get the svn revision into the AboutAROS requester.
[cake.git] / rom / graphics / bltbitmaprastport.c
blobfca53975533ae766d50b02d65ce6609a59dd2eba
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/oop.h>
10 #include "graphics_intern.h"
11 #include "gfxfuncsupport.h"
13 struct bitmap_render_data
15 struct render_special_info rsi;
16 ULONG minterm;
17 struct BitMap *srcbm;
18 OOP_Object *srcbm_obj;
22 static ULONG bitmap_render(APTR bitmap_rd, LONG srcx, LONG srcy,
23 OOP_Object *dstbm_obj, OOP_Object *dst_gc,
24 LONG x1, LONG y1, LONG x2, LONG y2, struct GfxBase *GfxBase);
26 /*****************************************************************************
28 NAME */
29 #include <proto/graphics.h>
31 AROS_LH9 (void, BltBitMapRastPort,
33 /* SYNOPSIS */
34 AROS_LHA(struct BitMap *, srcBitMap, A0),
35 AROS_LHA(LONG , xSrc, D0),
36 AROS_LHA(LONG , ySrc, D1),
37 AROS_LHA(struct RastPort *, destRP, A1),
38 AROS_LHA(LONG , xDest, D2),
39 AROS_LHA(LONG , yDest, D3),
40 AROS_LHA(LONG , xSize, D4),
41 AROS_LHA(LONG , ySize, D5),
42 AROS_LHA(ULONG , minterm, D6),
44 /* LOCATION */
45 struct GfxBase *, GfxBase, 101, Graphics)
47 /* FUNCTION
48 Moves a part of a bitmap around or into another bitmaps.
50 INPUTS
51 srcBitMap - Copy from this bitmap.
52 xSrc, ySrc - This is the upper left corner of the area to copy.
53 destRP - Destination RastPort.
54 xDest, yDest - Upper left corner where to place the copy
55 xSize, ySize - The size of the area to copy
56 minterm - How to copy. See BltBitMap() for an explanation.
58 RESULT
59 TRUE.
61 NOTES
62 If a special hardware is available, this function will use it.
64 EXAMPLE
66 BUGS
68 SEE ALSO
69 ClipBlit()
71 INPUTS
73 RESULT
75 NOTES
77 INTERNALS
79 HISTORY
80 27-11-96 digulla automatically created from
81 graphics_lib.fd and clib/graphics_protos.h
83 *****************************************************************************/
85 AROS_LIBFUNC_INIT
87 struct bitmap_render_data brd;
88 struct Rectangle rr;
89 HIDDT_DrawMode old_drmd;
90 OOP_Object *gc;
91 Point src;
93 struct TagItem gc_tags[] =
95 { aHidd_GC_DrawMode , 0UL },
96 { TAG_DONE }
99 EnterFunc(bug("BltBitMapRastPort(%d %d %d, %d, %d, %d)\n"
100 , xSrc, ySrc, xDest, yDest, xSize, ySize));
102 if (!OBTAIN_DRIVERDATA(destRP, GfxBase))
103 return;
105 FIX_GFXCOORD(xSrc);
106 FIX_GFXCOORD(ySrc);
107 FIX_GFXCOORD(xDest);
108 FIX_GFXCOORD(yDest);
110 brd.minterm = minterm;
111 brd.srcbm_obj = OBTAIN_HIDD_BM(srcBitMap);
112 if (NULL == brd.srcbm_obj)
114 RELEASE_DRIVERDATA(destRP, GfxBase);
115 return;
118 brd.srcbm = srcBitMap;
120 gc = GetDriverData(destRP)->dd_GC;
121 OOP_GetAttr(gc, aHidd_GC_DrawMode, &old_drmd);
123 gc_tags[0].ti_Data = MINTERM_TO_GCDRMD(minterm);
124 OOP_SetAttrs(gc, gc_tags);
126 rr.MinX = xDest;
127 rr.MinY = yDest;
128 rr.MaxX = xDest + xSize - 1;
129 rr.MaxY = yDest + ySize - 1;
131 src.x = xSrc;
132 src.y = ySrc;
134 do_render_func(destRP, &src, &rr, bitmap_render, &brd, TRUE, GfxBase);
136 RELEASE_HIDD_BM(brd.srcbm_obj, srcBitMap);
138 gc_tags[0].ti_Data = old_drmd;
139 OOP_SetAttrs(gc, gc_tags);
141 RELEASE_DRIVERDATA(destRP, GfxBase);
143 ReturnVoid("BltBitMapRastPort");
145 AROS_LIBFUNC_EXIT
147 } /* BltBitMapRastPort */
149 /****************************************************************************************/
151 static ULONG bitmap_render(APTR bitmap_rd, LONG srcx, LONG srcy,
152 OOP_Object *dstbm_obj, OOP_Object *dst_gc,
153 LONG x1, LONG y1, LONG x2, LONG y2, struct GfxBase *GfxBase)
155 struct bitmap_render_data *brd;
156 ULONG width, height;
158 width = x2 - x1 + 1;
159 height = y2 - y1 + 1;
161 brd = (struct bitmap_render_data *)bitmap_rd;
163 // D(bug("bitmap_render(%p, %d, %d, %p, %p, %d, %d, %d, %d, %p)\n"
164 // , bitmap_rd, srcx, srcy, dstbm_obj, dst_gc, x1, y1, x2, y2, GfxBase));
167 /* Get some info on the colormaps. We have to make sure
168 that we have the apropriate mapping tables set.
171 if (!int_bltbitmap(brd->srcbm
172 , brd->srcbm_obj
173 , srcx, srcy
174 , brd->rsi.curbm
175 , dstbm_obj
176 , x1, y1
177 , x2 - x1 + 1, y2 - y1 + 1
178 , brd->minterm
179 , dst_gc
180 , GfxBase
182 return 0;
184 return width * height;
187 /****************************************************************************************/