2 Copyright © 2011-2017, The AROS Development Team. All rights reserved.
6 #include <graphics/rastport.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 /*****************************************************************************
20 AROS_LH9(void, BltPipeResourceRastPort
,
23 AROS_LHA(PipeHandle_t
, pipe
, A0
),
24 AROS_LHA(struct pipe_resource
*, srcPipeResource
, A1
),
25 AROS_LHA(LONG
, xSrc
, D0
),
26 AROS_LHA(LONG
, ySrc
, D1
),
27 AROS_LHA(struct RastPort
* , destRP
, A2
),
28 AROS_LHA(LONG
, xDest
, D2
),
29 AROS_LHA(LONG
, yDest
, D3
),
30 AROS_LHA(LONG
, xSize
, D4
),
31 AROS_LHA(LONG
, ySize
, D5
),
34 struct Library
*, GalliumBase
, 9, Gallium
)
37 Copies part of pipe resource onto rast port. Clips output by using layers of
41 srcPipeResource - Copy from this pipe resource.
42 xSrc, ySrc - This is the upper left corner of the area to copy.
43 destRP - Destination RastPort.
44 xDest, yDest - Upper left corner where to place the copy
45 xSize, ySize - The size of the area to copy
55 *****************************************************************************/
59 struct Layer
*L
= destRP
->Layer
;
61 struct Rectangle renderableLayerRect
;
64 if (!IsLayerVisible(L
))
69 renderableLayerRect
.MinX
= L
->bounds
.MinX
+ xDest
;
70 renderableLayerRect
.MaxX
= L
->bounds
.MinX
+ xDest
+ xSize
- 1;
71 renderableLayerRect
.MinY
= L
->bounds
.MinY
+ yDest
;
72 renderableLayerRect
.MaxY
= L
->bounds
.MinY
+ yDest
+ ySize
- 1;
73 if (renderableLayerRect
.MinX
< L
->bounds
.MinX
)
74 renderableLayerRect
.MinX
= L
->bounds
.MinX
;
75 if (renderableLayerRect
.MaxX
> L
->bounds
.MaxX
)
76 renderableLayerRect
.MaxX
= L
->bounds
.MaxX
;
77 if (renderableLayerRect
.MinY
< L
->bounds
.MinY
)
78 renderableLayerRect
.MinY
= L
->bounds
.MinY
;
79 if (renderableLayerRect
.MaxY
> L
->bounds
.MaxY
)
80 renderableLayerRect
.MaxY
= L
->bounds
.MaxY
;
83 /* Do not clip renderableLayerRect to screen rast port. CRs are already clipped and unclipped
84 layer coords are needed. */
88 for (;NULL
!= CR
; CR
= CR
->Next
)
90 D(bug("Cliprect (%d, %d, %d, %d), lobs=%p\n",
91 CR
->bounds
.MinX
, CR
->bounds
.MinY
, CR
->bounds
.MaxX
, CR
->bounds
.MaxY
,
94 /* I assume this means the cliprect is visible */
97 struct Rectangle result
;
99 if (AndRectRect(&renderableLayerRect
, &CR
->bounds
, &result
))
101 /* This clip rect intersects renderable layer rect */
102 struct pHidd_Gallium_DisplayResource drmsg
= {
103 mID
: ((struct GalliumBase
*)GalliumBase
)->galliumMId_DisplayResource
,
104 resource
: srcPipeResource
,
105 srcx
: xSrc
+ result
.MinX
- L
->bounds
.MinX
- xDest
, /* x in the source buffer */
106 srcy
: ySrc
+ result
.MinY
- L
->bounds
.MinY
- yDest
, /* y in the source buffer */
107 bitmap
: destRP
->BitMap
,
108 dstx
: result
.MinX
, /* Absolute (on bitmap) X of dest blit */
109 dsty
: result
.MinY
, /* Absolute (on bitmap) Y of dest blit */
110 width
: result
.MaxX
- result
.MinX
+ 1, /* width of the rect in source buffer */
111 height
: result
.MaxY
- result
.MinY
+ 1, /* height of the rect in source buffer */
113 OOP_DoMethod(pipe
, (OOP_Msg
)&drmsg
);
120 /* Notify the bitmap about blitting */
123 struct pHidd_BitMap_UpdateRect urmsg
= {
124 mID
: ((struct GalliumBase
*)GalliumBase
)->galliumMId_UpdateRect
,
125 x
: renderableLayerRect
.MinX
,
126 y
: renderableLayerRect
.MinY
,
127 width
: renderableLayerRect
.MaxX
- renderableLayerRect
.MinX
+ 1,
128 height
: renderableLayerRect
.MaxY
- renderableLayerRect
.MinY
+ 1
131 OOP_Object
* bm
= HIDD_BM_OBJ(destRP
->BitMap
);
132 OOP_DoMethod(bm
, (OOP_Msg
)&urmsg
);