Sync patches with upstream.
This commit is contained in:
parent
dc1028494a
commit
39c88f1e60
@ -1,9 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 2016/09/01 00:25:40 bentley Exp $
|
||||
# $OpenBSD: Makefile,v 1.2 2016/09/08 03:52:24 bentley Exp $
|
||||
|
||||
COMMENT = framebuffer abstraction library for netsurf
|
||||
|
||||
NETSURF_PROJECT = libnsfb
|
||||
NETSURF_VERSION = 0.1.4
|
||||
REVISION = 0
|
||||
|
||||
CATEGORIES = graphics
|
||||
SHARED_LIBS = nsfb 0.0 #0.1.4
|
||||
|
@ -1,32 +1,86 @@
|
||||
$OpenBSD: patch-src_plot_24bpp_c,v 1.1.1.1 2016/09/01 00:25:40 bentley Exp $
|
||||
--- src/plot/24bpp.c.orig Tue Aug 30 02:39:18 2016
|
||||
+++ src/plot/24bpp.c Tue Aug 30 02:39:44 2016
|
||||
@@ -12,8 +12,8 @@
|
||||
#ifndef _WIN32
|
||||
#include <endian.h>
|
||||
#else
|
||||
$OpenBSD: patch-src_plot_24bpp_c,v 1.2 2016/09/08 03:52:24 bentley Exp $
|
||||
--- src/plot/24bpp.c.orig Sun Jan 3 04:52:16 2016
|
||||
+++ src/plot/24bpp.c Wed Sep 7 20:12:50 2016
|
||||
@@ -9,13 +9,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
-#ifndef _WIN32
|
||||
-#include <endian.h>
|
||||
-#else
|
||||
-#define __BYTE_ORDER __BYTE_ORDER__
|
||||
-#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||
+#define BYTE_ORDER __BYTE_ORDER__
|
||||
+#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||
#endif
|
||||
|
||||
-#endif
|
||||
-
|
||||
#include "libnsfb.h"
|
||||
@@ -29,7 +29,7 @@ get_xy_loc(nsfb_t *nsfb, int x, int y)
|
||||
#include "libnsfb_plot.h"
|
||||
#include "libnsfb_plot_util.h"
|
||||
@@ -23,24 +16,43 @@
|
||||
#include "nsfb.h"
|
||||
#include "plot.h"
|
||||
|
||||
-static inline uint8_t *
|
||||
-get_xy_loc(nsfb_t *nsfb, int x, int y)
|
||||
+/**
|
||||
+ * Get the address of a logical location on the framebuffer
|
||||
+ */
|
||||
+static inline uint8_t *get_xy_loc(nsfb_t *nsfb, int x, int y)
|
||||
{
|
||||
return (uint8_t *)(nsfb->ptr + (y * nsfb->linelen) + (x * 3));
|
||||
}
|
||||
|
||||
-#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+#if BYTE_ORDER == BIG_ENDIAN
|
||||
static inline nsfb_colour_t pixel_to_colour(uint8_t pixel)
|
||||
-static inline nsfb_colour_t pixel_to_colour(uint8_t pixel)
|
||||
+#ifdef NSFB_BE_BYTE_ORDER
|
||||
+
|
||||
+/**
|
||||
+ * convert a 24bpp big endian pixel value to netsurf colour
|
||||
+ */
|
||||
+static inline nsfb_colour_t pixel_to_colour(uint32_t pixel)
|
||||
{
|
||||
return (pixel >> 8) & ~0xFF000000U;
|
||||
@@ -40,7 +40,7 @@ static inline uint32_t colour_to_pixel(nsfb_colour_t c
|
||||
}
|
||||
|
||||
-/* convert a colour value to a 32bpp pixel value ready for screen output */
|
||||
+/**
|
||||
+ * convert a colour value to a big endian 24bpp pixel value
|
||||
+ *
|
||||
+ * The resulting value is ready for screen output
|
||||
+ */
|
||||
static inline uint32_t colour_to_pixel(nsfb_colour_t c)
|
||||
{
|
||||
return (c << 8);
|
||||
}
|
||||
-#else /* __BYTE_ORDER == __BIG_ENDIAN */
|
||||
+#else /* BYTE_ORDER == BIG_ENDIAN */
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+/**
|
||||
+ * convert a 24bpp little endian pixel value to netsurf colour
|
||||
+ *
|
||||
+ * \param nsfb The framebuffer
|
||||
+ * \param pixel The pixel values
|
||||
+ * \return The netsurf colour value.
|
||||
+ */
|
||||
static inline nsfb_colour_t pixel_to_colour(uint32_t pixel)
|
||||
{
|
||||
return ((pixel & 0xFF) << 16) |
|
||||
@@ -48,11 +60,17 @@ static inline nsfb_colour_t pixel_to_colour(uint32_t p
|
||||
((pixel & 0xFF0000) >> 16);
|
||||
}
|
||||
|
||||
-/* convert a colour value to a 32bpp pixel value ready for screen output */
|
||||
+/**
|
||||
+ * convert a colour value to a little endian 24bpp pixel value
|
||||
+ *
|
||||
+ * \param c The netsurf colour
|
||||
+ * \return A pixel value ready for screen output.
|
||||
+ */
|
||||
static inline uint32_t colour_to_pixel(nsfb_colour_t c)
|
||||
{
|
||||
return ((c & 0xff0000) >> 16) | (c & 0xff00) | ((c & 0xff) << 16);
|
||||
}
|
||||
+
|
||||
#endif
|
||||
|
||||
#define SIGN(x) ((x<0) ? -1 : ((x>0) ? 1 : 0))
|
||||
|
@ -1,32 +1,97 @@
|
||||
$OpenBSD: patch-src_plot_32bpp-xbgr8888_c,v 1.1.1.1 2016/09/01 00:25:40 bentley Exp $
|
||||
--- src/plot/32bpp-xbgr8888.c.orig Tue Aug 30 02:40:08 2016
|
||||
+++ src/plot/32bpp-xbgr8888.c Tue Aug 30 02:40:17 2016
|
||||
@@ -13,8 +13,8 @@
|
||||
#ifndef _WIN32
|
||||
#include <endian.h>
|
||||
#else
|
||||
$OpenBSD: patch-src_plot_32bpp-xbgr8888_c,v 1.2 2016/09/08 03:52:24 bentley Exp $
|
||||
--- src/plot/32bpp-xbgr8888.c.orig Sun Jan 3 04:52:16 2016
|
||||
+++ src/plot/32bpp-xbgr8888.c Wed Sep 7 20:12:50 2016
|
||||
@@ -10,13 +10,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
-#ifndef _WIN32
|
||||
-#include <endian.h>
|
||||
-#else
|
||||
-#define __BYTE_ORDER __BYTE_ORDER__
|
||||
-#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||
+#define BYTE_ORDER __BYTE_ORDER__
|
||||
+#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||
#endif
|
||||
|
||||
-#endif
|
||||
-
|
||||
#include "libnsfb.h"
|
||||
@@ -32,7 +32,7 @@ static inline uint32_t *get_xy_loc(nsfb_t *nsfb, int x
|
||||
#include "libnsfb_plot.h"
|
||||
#include "libnsfb_plot_util.h"
|
||||
@@ -24,38 +17,71 @@
|
||||
#include "nsfb.h"
|
||||
#include "plot.h"
|
||||
|
||||
+#define UNUSED __attribute__((unused))
|
||||
|
||||
-#define UNUSED __attribute__((unused))
|
||||
|
||||
+/**
|
||||
+ * Get the address of a logical location on the framebuffer
|
||||
+ */
|
||||
static inline uint32_t *get_xy_loc(nsfb_t *nsfb, int x, int y)
|
||||
{
|
||||
return (void *)(nsfb->ptr + (y * nsfb->linelen) + (x << 2));
|
||||
}
|
||||
|
||||
-#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+#if BYTE_ORDER == BIG_ENDIAN
|
||||
+#ifdef NSFB_BE_BYTE_ORDER
|
||||
+
|
||||
+/**
|
||||
+ * convert a 32bpp big endian pixel value to netsurf colour
|
||||
+ *
|
||||
+ * \param nsfb The framebuffer
|
||||
+ * \param pixel The pixel value
|
||||
+ * \return The netsurf colour value.
|
||||
+ */
|
||||
static inline nsfb_colour_t pixel_to_colour(UNUSED nsfb_t *nsfb, uint32_t pixel)
|
||||
{
|
||||
/* TODO: FIX */
|
||||
@@ -45,7 +45,7 @@ static inline uint32_t colour_to_pixel(UNUSED nsfb_t *
|
||||
/* TODO: FIX */
|
||||
return (c << 8);
|
||||
- /* TODO: FIX */
|
||||
+ /** \todo fix this conversion as it is probably wrong */
|
||||
return (pixel >> 8) & ~0xFF000000U;
|
||||
}
|
||||
|
||||
-/* convert a colour value to a 32bpp pixel value ready for screen output */
|
||||
+/**
|
||||
+ * convert a colour value to a big endian 32bpp pixel value
|
||||
+ *
|
||||
+ * \param nsfb The framebuffer
|
||||
+ * \param c The framebuffer colour
|
||||
+ * \return A pixel value ready for screen output.
|
||||
+ */
|
||||
static inline uint32_t colour_to_pixel(UNUSED nsfb_t *nsfb, nsfb_colour_t c)
|
||||
{
|
||||
- /* TODO: FIX */
|
||||
- return (c << 8);
|
||||
+ return ((c & 0xFF) << 24) | ((c & 0xFF00) << 8) | ((c & 0xFF0000) >> 8);
|
||||
}
|
||||
-#else /* __BYTE_ORDER == __BIG_ENDIAN */
|
||||
+#else /* BYTE_ORDER == BIG_ENDIAN */
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+/**
|
||||
+ * convert a 32bpp little endian pixel value to netsurf colour
|
||||
+ *
|
||||
+ * \param nsfb The framebuffer
|
||||
+ * \param pixel The pixel value
|
||||
+ * \return The netsurf colour value.
|
||||
+ */
|
||||
static inline nsfb_colour_t pixel_to_colour(UNUSED nsfb_t *nsfb, uint32_t pixel)
|
||||
{
|
||||
return pixel | 0xFF000000U;
|
||||
}
|
||||
|
||||
-/* convert a colour value to a 32bpp pixel value ready for screen output */
|
||||
+
|
||||
+/**
|
||||
+ * convert a colour value to a little endian 32bpp pixel value
|
||||
+ *
|
||||
+ * \param nsfb The framebuffer
|
||||
+ * \param c The netsurf colour
|
||||
+ * \return A pixel value ready for screen output.
|
||||
+ */
|
||||
static inline uint32_t colour_to_pixel(UNUSED nsfb_t *nsfb, nsfb_colour_t c)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
+
|
||||
#endif
|
||||
|
||||
#define PLOT_TYPE uint32_t
|
||||
|
@ -1,32 +1,96 @@
|
||||
$OpenBSD: patch-src_plot_32bpp-xrgb8888_c,v 1.1.1.1 2016/09/01 00:25:40 bentley Exp $
|
||||
--- src/plot/32bpp-xrgb8888.c.orig Tue Aug 30 02:40:26 2016
|
||||
+++ src/plot/32bpp-xrgb8888.c Tue Aug 30 02:40:37 2016
|
||||
@@ -13,8 +13,8 @@
|
||||
#ifndef _WIN32
|
||||
#include <endian.h>
|
||||
#else
|
||||
$OpenBSD: patch-src_plot_32bpp-xrgb8888_c,v 1.2 2016/09/08 03:52:24 bentley Exp $
|
||||
--- src/plot/32bpp-xrgb8888.c.orig Sun Jan 3 04:52:16 2016
|
||||
+++ src/plot/32bpp-xrgb8888.c Wed Sep 7 20:12:50 2016
|
||||
@@ -10,13 +10,6 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
-#ifndef _WIN32
|
||||
-#include <endian.h>
|
||||
-#else
|
||||
-#define __BYTE_ORDER __BYTE_ORDER__
|
||||
-#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||
+#define BYTE_ORDER __BYTE_ORDER__
|
||||
+#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||
#endif
|
||||
|
||||
-#endif
|
||||
-
|
||||
#include "libnsfb.h"
|
||||
@@ -32,7 +32,7 @@ static inline uint32_t *get_xy_loc(nsfb_t *nsfb, int x
|
||||
#include "libnsfb_plot.h"
|
||||
#include "libnsfb_plot_util.h"
|
||||
@@ -24,26 +17,53 @@
|
||||
#include "nsfb.h"
|
||||
#include "plot.h"
|
||||
|
||||
+#define UNUSED __attribute__((unused))
|
||||
|
||||
-#define UNUSED __attribute__((unused))
|
||||
|
||||
+/**
|
||||
+ * Get the address of a logical location on the framebuffer
|
||||
+ */
|
||||
static inline uint32_t *get_xy_loc(nsfb_t *nsfb, int x, int y)
|
||||
{
|
||||
return (void *)(nsfb->ptr + (y * nsfb->linelen) + (x << 2));
|
||||
}
|
||||
|
||||
-#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+#if BYTE_ORDER == BIG_ENDIAN
|
||||
+
|
||||
+#ifdef NSFB_BE_BYTE_ORDER
|
||||
+
|
||||
+/**
|
||||
+ * convert a 32bpp big endian pixel value to netsurf colour
|
||||
+ *
|
||||
+ * \param nsfb The framebuffer
|
||||
+ * \param pixel The pixel value
|
||||
+ * \return The netsurf colour value.
|
||||
+ */
|
||||
static inline nsfb_colour_t pixel_to_colour(UNUSED nsfb_t *nsfb, uint32_t pixel)
|
||||
{
|
||||
return (pixel >> 8) & ~0xFF000000U;
|
||||
@@ -43,7 +43,7 @@ static inline uint32_t colour_to_pixel(UNUSED nsfb_t *
|
||||
}
|
||||
|
||||
-/* convert a colour value to a 32bpp pixel value ready for screen output */
|
||||
+/**
|
||||
+ * convert a colour value to a big endian 32bpp pixel value
|
||||
+ *
|
||||
+ * \param nsfb The framebuffer
|
||||
+ * \param c The framebuffer colour
|
||||
+ * \return A pixel value ready for screen output.
|
||||
+ */
|
||||
static inline uint32_t colour_to_pixel(UNUSED nsfb_t *nsfb, nsfb_colour_t c)
|
||||
{
|
||||
return (c << 8);
|
||||
}
|
||||
-#else /* __BYTE_ORDER == __BIG_ENDIAN */
|
||||
+#else /* BYTE_ORDER == BIG_ENDIAN */
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+/**
|
||||
+ * convert a 32bpp little endian pixel value to netsurf colour
|
||||
+ *
|
||||
+ * \param nsfb The framebuffer
|
||||
+ * \param pixel The pixel value
|
||||
+ * \return The netsurf colour value.
|
||||
+ */
|
||||
static inline nsfb_colour_t pixel_to_colour(UNUSED nsfb_t *nsfb, uint32_t pixel)
|
||||
{
|
||||
return ((pixel & 0xFF) << 16) |
|
||||
@@ -51,11 +71,19 @@ static inline nsfb_colour_t pixel_to_colour(UNUSED nsf
|
||||
((pixel & 0xFF0000) >> 16);
|
||||
}
|
||||
|
||||
-/* convert a colour value to a 32bpp pixel value ready for screen output */
|
||||
+
|
||||
+/**
|
||||
+ * convert a colour value to a little endian 32bpp pixel value
|
||||
+ *
|
||||
+ * \param nsfb The framebuffer
|
||||
+ * \param c The netsurf colour
|
||||
+ * \return A pixel value ready for screen output.
|
||||
+ */
|
||||
static inline uint32_t colour_to_pixel(UNUSED nsfb_t *nsfb, nsfb_colour_t c)
|
||||
{
|
||||
return ((c & 0xff0000) >> 16) | (c & 0xff00) | ((c & 0xff) << 16);
|
||||
}
|
||||
+
|
||||
#endif
|
||||
|
||||
#define PLOT_TYPE uint32_t
|
||||
|
68
www/netsurf/libnsfb/patches/patch-src_plot_h
Normal file
68
www/netsurf/libnsfb/patches/patch-src_plot_h
Normal file
@ -0,0 +1,68 @@
|
||||
$OpenBSD: patch-src_plot_h,v 1.1 2016/09/08 03:52:24 bentley Exp $
|
||||
--- src/plot.h.orig Wed Sep 7 20:11:59 2016
|
||||
+++ src/plot.h Wed Sep 7 20:12:12 2016
|
||||
@@ -1,5 +1,59 @@
|
||||
+/*
|
||||
+ * Copyright 2009 Vincent Sanders <vince@simtec.co.uk>
|
||||
+ *
|
||||
+ * This file is part of libnsfb, http://www.netsurf-browser.org/
|
||||
+ * Licenced under the MIT License,
|
||||
+ * http://www.opensource.org/licenses/mit-license.php
|
||||
+ */
|
||||
|
||||
+/**
|
||||
+ * \file internal plotter interace.
|
||||
+ */
|
||||
|
||||
+#ifndef LIBNSFB_PLOT_H
|
||||
+#define LIBNSFB_PLOT_H
|
||||
+
|
||||
+/*
|
||||
+ * Do the best we can to determine integer byte ordering
|
||||
+ *
|
||||
+ * This series of tests attempts to determine, at compile time, if the integer
|
||||
+ * ordering in memory is big or little endian. This allows the plotters to make
|
||||
+ * assumptions about memory ordering to greatly improve software rendering
|
||||
+ * performance.
|
||||
+ *
|
||||
+ * \note This utterly ignores PDP endianess
|
||||
+ */
|
||||
+#undef NSFB_BE_BYTE_ORDER
|
||||
+#if defined(_WIN32)
|
||||
+ /* windows does not have endian.h but uses these macros */
|
||||
+ #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
+ #define NSFB_BE_BYTE_ORDER
|
||||
+ #endif
|
||||
+#elif defined(__APPLE__)
|
||||
+ /* mac os x has the include somewhere different */
|
||||
+ #include <machine/endian.h>
|
||||
+ #if __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN
|
||||
+ #define NSFB_BE_BYTE_ORDER
|
||||
+ #endif
|
||||
+#else
|
||||
+ #include <endian.h>
|
||||
+ #if defined(__BYTE_ORDER__)
|
||||
+ #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
+ #define NSFB_BE_BYTE_ORDER
|
||||
+ #endif
|
||||
+ #elif defined(__BYTE_ORDER)
|
||||
+ #if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+ #define NSFB_BE_BYTE_ORDER
|
||||
+ #endif
|
||||
+ #elif defined(BYTE_ORDER)
|
||||
+ #if BYTE_ORDER == BIG_ENDIAN
|
||||
+ #define NSFB_BE_BYTE_ORDER
|
||||
+ #endif
|
||||
+ #else
|
||||
+ #error "Endian determination failed"
|
||||
+ #endif
|
||||
+#endif
|
||||
+
|
||||
/** Clears plotting area to a flat colour (if needed)
|
||||
*/
|
||||
typedef bool (nsfb_plotfn_clg_t)(nsfb_t *nsfb, nsfb_colour_t c);
|
||||
@@ -127,3 +181,4 @@ typedef struct nsfb_plotter_fns_s {
|
||||
|
||||
bool select_plotters(nsfb_t *nsfb);
|
||||
|
||||
+#endif
|
Loading…
x
Reference in New Issue
Block a user