2 Copyright 2011, The AROS Development Team. All rights reserved.
6 #include <graphics/rastport.h>
7 #include <hidd/graphics.h>
8 #include <proto/alib.h>
9 #include <proto/layers.h>
10 #include <proto/graphics.h>
11 #include <gallium/pipe/p_state.h>
12 #include <aros/debug.h>
14 #include "gallium_intern.h"
16 #define HIDD_BM_OBJ(bitmap) (*(OOP_Object **)&((bitmap)->Planes[0]))
18 /*****************************************************************************
22 AROS_LH8(void, BltPipeResourceRastPort
,
25 AROS_LHA(struct pipe_resource
*, srcPipeResource
, A0
),
26 AROS_LHA(LONG
, xSrc
, D0
),
27 AROS_LHA(LONG
, ySrc
, D1
),
28 AROS_LHA(struct RastPort
* , destRP
, A1
),
29 AROS_LHA(LONG
, xDest
, D2
),
30 AROS_LHA(LONG
, yDest
, D3
),
31 AROS_LHA(LONG
, xSize
, D4
),
32 AROS_LHA(LONG
, ySize
, D5
),
35 struct Library
*, GalliumBase
, 8, Gallium
)
40 Copies part of pipe resource onto rast port. Clips output by using layers of
44 srcPipeResource - Copy from this pipe resource.
45 xSrc, ySrc - This is the upper left corner of the area to copy.
46 destRP - Destination RastPort.
47 xDest, yDest - Upper left corner where to place the copy
48 xSize, ySize - The size of the area to copy
58 *****************************************************************************/
62 struct Layer
*L
= destRP
->Layer
;
64 struct Rectangle renderableLayerRect
;
67 struct HIDDT_WinSys
* ws
= (struct HIDDT_WinSys
*)srcPipeResource
->screen
->winsys
;
71 if (!IsLayerVisible(L
))
76 renderableLayerRect
.MinX
= L
->bounds
.MinX
+ xDest
;
77 renderableLayerRect
.MaxX
= L
->bounds
.MinX
+ xDest
+ xSize
- 1;
78 renderableLayerRect
.MinY
= L
->bounds
.MinY
+ yDest
;
79 renderableLayerRect
.MaxY
= L
->bounds
.MinY
+ yDest
+ ySize
- 1;
80 if (renderableLayerRect
.MinX
< L
->bounds
.MinX
)
81 renderableLayerRect
.MinX
= L
->bounds
.MinX
;
82 if (renderableLayerRect
.MaxX
> L
->bounds
.MaxX
)
83 renderableLayerRect
.MaxX
= L
->bounds
.MaxX
;
84 if (renderableLayerRect
.MinY
< L
->bounds
.MinY
)
85 renderableLayerRect
.MinY
= L
->bounds
.MinY
;
86 if (renderableLayerRect
.MaxY
> L
->bounds
.MaxY
)
87 renderableLayerRect
.MaxY
= L
->bounds
.MaxY
;
90 /* Do not clip renderableLayerRect to screen rast port. CRs are already clipped and unclipped
91 layer coords are needed. */
95 for (;NULL
!= CR
; CR
= CR
->Next
)
97 D(bug("Cliprect (%d, %d, %d, %d), lobs=%p\n",
98 CR
->bounds
.MinX
, CR
->bounds
.MinY
, CR
->bounds
.MaxX
, CR
->bounds
.MaxY
,
101 /* I assume this means the cliprect is visible */
102 if (NULL
== CR
->lobs
)
104 struct Rectangle result
;
106 if (AndRectRect(&renderableLayerRect
, &CR
->bounds
, &result
))
108 /* This clip rect intersects renderable layer rect */
109 struct pHidd_Gallium_DisplayResource drmsg
= {
110 mID
: OOP_GetMethodID(IID_Hidd_Gallium
, moHidd_Gallium_DisplayResource
),
111 resource
: srcPipeResource
,
112 srcx
: xSrc
+ result
.MinX
- L
->bounds
.MinX
- xDest
, /* x in the source buffer */
113 srcy
: ySrc
+ result
.MinY
- L
->bounds
.MinY
- yDest
, /* y in the source buffer */
114 bitmap
: destRP
->BitMap
,
115 dstx
: result
.MinX
, /* Absolute (on bitmap) X of dest blit */
116 dsty
: result
.MinY
, /* Absolute (on bitmap) Y of dest blit */
117 width
: result
.MaxX
- result
.MinX
+ 1, /* width of the rect in source buffer */
118 height
: result
.MaxY
- result
.MinY
+ 1, /* height of the rect in source buffer */
120 OOP_DoMethod(ws
->driver
, (OOP_Msg
)&drmsg
);
127 /* Notify the bitmap about blitting */
130 struct pHidd_BitMap_UpdateRect urmsg
= {
131 mID
: OOP_GetMethodID(IID_Hidd_BitMap
, moHidd_BitMap_UpdateRect
),
132 x
: renderableLayerRect
.MinX
,
133 y
: renderableLayerRect
.MinY
,
134 width
: renderableLayerRect
.MaxX
- renderableLayerRect
.MinX
+ 1,
135 height
: renderableLayerRect
.MaxY
- renderableLayerRect
.MinY
+ 1
138 OOP_Object
* bm
= HIDD_BM_OBJ(destRP
->BitMap
);
139 OOP_DoMethod(bm
, (OOP_Msg
)&urmsg
);