2 Copyright © 2011-2019, 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 "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 *****************************************************************************/
61 if (!pipe
|| !(L
= destRP
->Layer
))
64 if (!IsLayerVisible(L
))
67 struct Rectangle renderableLayerRect
;
68 struct pHidd_Gallium_DisplayResource drmsg
= {
69 mID
: ((struct GalliumBase
*)GalliumBase
)->galliumMId_DisplayResource
,
70 resource
: srcPipeResource
,
71 bitmap
: destRP
->BitMap
,
73 struct Rectangle result
;
79 renderableLayerRect
.MinX
= L
->bounds
.MinX
+ xDest
;
80 renderableLayerRect
.MaxX
= L
->bounds
.MinX
+ xDest
+ xSize
- 1;
81 renderableLayerRect
.MinY
= L
->bounds
.MinY
+ yDest
;
82 renderableLayerRect
.MaxY
= L
->bounds
.MinY
+ yDest
+ ySize
- 1;
83 if (renderableLayerRect
.MinX
< L
->bounds
.MinX
)
84 renderableLayerRect
.MinX
= L
->bounds
.MinX
;
85 if (renderableLayerRect
.MaxX
> L
->bounds
.MaxX
)
86 renderableLayerRect
.MaxX
= L
->bounds
.MaxX
;
87 if (renderableLayerRect
.MinY
< L
->bounds
.MinY
)
88 renderableLayerRect
.MinY
= L
->bounds
.MinY
;
89 if (renderableLayerRect
.MaxY
> L
->bounds
.MaxY
)
90 renderableLayerRect
.MaxY
= L
->bounds
.MaxY
;
92 /* Do not clip renderableLayerRect to screen rast port. CRs are already clipped and unclipped
93 layer coords are needed. */
97 for (;NULL
!= CR
; CR
= CR
->Next
)
99 D(bug("Cliprect (%d, %d, %d, %d), lobs=%p\n",
100 CR
->bounds
.MinX
, CR
->bounds
.MinY
, CR
->bounds
.MaxX
, CR
->bounds
.MaxY
,
103 /* I assume this means the cliprect is visible */
104 if (NULL
== CR
->lobs
)
106 if (AndRectRect(&renderableLayerRect
, &CR
->bounds
, &result
))
108 /* This clip rect intersects renderable layer rect */
109 drmsg
.srcx
= xSrc
+ result
.MinX
- L
->bounds
.MinX
- xDest
; /* x in the source buffer */
110 drmsg
.srcy
= ySrc
+ result
.MinY
- L
->bounds
.MinY
- yDest
; /* y in the source buffer */
111 drmsg
.dstx
= result
.MinX
; /* Absolute (on bitmap) X of dest blit */
112 drmsg
.dsty
= result
.MinY
; /* Absolute (on bitmap) Y of dest blit */
113 drmsg
.width
= result
.MaxX
- result
.MinX
+ 1; /* width of the rect in source buffer */
114 drmsg
.height
= result
.MaxY
- result
.MinY
+ 1; /* height of the rect in source buffer */
116 OOP_DoMethod((OOP_Object
*)pipe
, (OOP_Msg
)&drmsg
);
123 /* Notify the bitmap about blitting */
126 struct pHidd_BitMap_UpdateRect urmsg
= {
127 mID
: ((struct GalliumBase
*)GalliumBase
)->galliumMId_UpdateRect
,
128 x
: renderableLayerRect
.MinX
,
129 y
: renderableLayerRect
.MinY
,
130 width
: renderableLayerRect
.MaxX
- renderableLayerRect
.MinX
+ 1,
131 height
: renderableLayerRect
.MaxY
- renderableLayerRect
.MinY
+ 1
134 OOP_Object
* bm
= HIDD_BM_OBJ(destRP
->BitMap
);
135 OOP_DoMethod(bm
, (OOP_Msg
)&urmsg
);