NetSurf
rtg.c
Go to the documentation of this file.
1/*
2 * Copyright 2015 Chris Young <chris@unsatisfactorysoftware.co.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/** \file
20 * Abstract RTG functions for newer/older/non-P96 systems
21 */
22
23#include "amiga/rtg.h"
24
25struct BitMap *ami_rtg_allocbitmap(ULONG width, ULONG height, ULONG depth,
26 ULONG flags, struct BitMap *friend, RGBFTYPE format)
27{
28 if(P96Base == NULL) {
29 return AllocBitMap(width, height, depth, flags, friend);
30 } else {
31 return p96AllocBitMap(width, height, depth, flags, friend, format);
32 }
33}
34
35void ami_rtg_freebitmap(struct BitMap *bm)
36{
37 if(P96Base == NULL) {
38 return FreeBitMap(bm);
39 } else {
40 return p96FreeBitMap(bm);
41 }
42}
43
44void ami_rtg_writepixelarray(UBYTE *pixdata, struct BitMap *bm,
45 ULONG width, ULONG height, ULONG bpr, ULONG format)
46{
47 struct RastPort trp;
48
49 InitRastPort(&trp);
50 trp.BitMap = bm;
51
52 /* This requires P96 or gfx.lib v54 currently */
53 if(P96Base == NULL) {
54#ifdef __amigaos4__
55 if(GfxBase->LibNode.lib_Version >= 54) {
56 WritePixelArray(pixdata, 0, 0, bpr, PIXF_R8G8B8A8, &trp, 0, 0, width, height);
57 }
58#endif
59 } else {
60 struct RenderInfo ri;
61
62 ri.Memory = pixdata;
63 ri.BytesPerRow = bpr;
64 ri.RGBFormat = format;
65
66 p96WritePixelArray((struct RenderInfo *)&ri, 0, 0, &trp, 0, 0, width, height);
67 }
68}
69
int width
Definition: gui.c:160
int height
Definition: gui.c:161
void ami_rtg_writepixelarray(UBYTE *pixdata, struct BitMap *bm, ULONG width, ULONG height, ULONG bpr, ULONG format)
Definition: rtg.c:44
void ami_rtg_freebitmap(struct BitMap *bm)
Definition: rtg.c:35
struct BitMap * ami_rtg_allocbitmap(ULONG width, ULONG height, ULONG depth, ULONG flags, struct BitMap *friend, RGBFTYPE format)
Definition: rtg.c:25
Abstract RTG functions for newer/older/non-P96 systems.