Rev 2292 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2292 | Rev 2307 | ||
---|---|---|---|
Line 831... | Line 831... | ||
831 | 831 | ||
832 | static void |
832 | static void |
833 | copy_vp_to_pixmap(viewport_t *vport, pixmap_t *pmap) |
833 | copy_vp_to_pixmap(viewport_t *vport, pixmap_t *pmap) |
834 | { |
834 | { |
835 | int y; |
835 | int y; |
836 | int rowsize; |
836 | int tmp, srcrowsize; |
837 | int tmp; |
837 | int realwidth, realheight, realrowsize; |
838 | int width = vport->width; |
838 | int width = vport->width; |
839 | int height = vport->height; |
839 | int height = vport->height; |
840 | 840 | ||
841 | if (width + vport->x > screen.xres) |
841 | if (width + vport->x > screen.xres) |
842 | width = screen.xres - vport->x; |
842 | width = screen.xres - vport->x; |
843 | if (height + vport->y > screen.yres) |
843 | if (height + vport->y > screen.yres) |
844 | height = screen.yres - vport->y; |
844 | height = screen.yres - vport->y; |
- | 845 | ||
- | 846 | realwidth = pmap->width <= width ? pmap->width : width; |
|
- | 847 | realheight = pmap->height <= height ? pmap->height : height; |
|
845 | 848 | ||
- | 849 | srcrowsize = vport->width * screen.pixelbytes; |
|
846 | rowsize = width * screen.pixelbytes; |
850 | realrowsize = realwidth * screen.pixelbytes; |
847 | 851 | ||
848 | for (y = 0; y < height; y++) { |
852 | for (y = 0; y < realheight; y++) { |
849 | tmp = (vport->y + y) * screen.scanline + |
853 | tmp = (vport->y + y) * screen.scanline + |
850 | vport->x * screen.pixelbytes; |
854 | vport->x * screen.pixelbytes; |
851 | memcpy(pmap->data + rowsize * y, screen.fbaddress + tmp, |
855 | memcpy(pmap->data + srcrowsize * y, screen.fbaddress + tmp, |
852 | rowsize); |
856 | realrowsize); |
853 | } |
857 | } |
854 | } |
858 | } |
855 | 859 | ||
856 | /** Save viewport to pixmap */ |
860 | /** Save viewport to pixmap */ |
857 | static int |
861 | static int |