From 973e34089e33f06cfd9ed560db968870e22c2b8a Mon Sep 17 00:00:00 2001
From: inmarket <andrewh@inmarket.com.au>
Date: Tue, 24 Sep 2013 16:10:15 +1000
Subject: GDISP streaming bug fixes Win32 bitmap support Win32 Rotation is back
 to front. Need to check touch and other drivers.

---
 include/gdisp/gdisp.h         | 52 +++++++++++++++++++++++++++++++++++++++++++
 include/gdisp/lld/gdisp_lld.h | 26 +++++++++++-----------
 include/gmisc/gmisc.h         | 17 ++++++++++++++
 include/gmisc/options.h       | 12 +++++-----
 4 files changed, 88 insertions(+), 19 deletions(-)

(limited to 'include')

diff --git a/include/gdisp/gdisp.h b/include/gdisp/gdisp.h
index cb98b46d..6b2f5b47 100644
--- a/include/gdisp/gdisp.h
+++ b/include/gdisp/gdisp.h
@@ -430,6 +430,58 @@ void gdispBlitAreaEx(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx,
  */
 void gdispDrawBox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color);
 
+/* Streaming Functions */
+
+#if GDISP_NEED_STREAMING || defined(__DOXYGEN__)
+	/**
+	 * @brief   Start a streaming operation.
+	 * @details Stream data to a window on the display sequentially and very fast.
+	 * @note	While streaming is in operation - no other calls to GDISP functions
+	 * 			can be made (with the exception of @p gdispBlendColor() and streaming
+	 * 			functions). If a call is made (eg in a multi-threaded application) the other
+	 * 			call is blocked waiting for the streaming operation to finish.
+	 * @note	@p gdispStreamStop() must be called to finish the streaming operation.
+	 * @note	If more data is written than the defined area then the results are unspecified.
+	 * 			Some drivers may wrap back to the beginning of the area, others may just
+	 * 			ignore subsequent data.
+	 * @note	Unlike most operations that clip the defined area to the display to generate
+	 * 			a smaller active area, this call will just silently fail if any of the stream
+	 * 			region lies outside the current clipping area.
+	 * @note	A streaming operation may be terminated early (without writing to every location
+	 * 			in the stream area) by calling @p gdispStreamStop().
+	 *
+	 * @param[in] x,y		The start position
+	 * @param[in] cx,cy		The size of the streamable area
+	 *
+	 * @api
+	 */
+	void gdispStreamStart(coord_t x, coord_t y, coord_t cx, coord_t cy);
+
+	/**
+	 * @brief   Send pixel data to the stream.
+	 * @details Write a pixel to the next position in the streamed area and increment the position
+	 * @pre		@p gdispStreamStart() has been called.
+	 * @note	If the gdispStreamStart() has not been called (or failed due to clipping), the
+	 * 			data provided here is simply thrown away.
+	 *
+	 * @param[in] color		The color of the pixel to write
+	 *
+	 * @api
+	 */
+	void gdispStreamColor(color_t color);
+
+	/**
+	 * @brief   Finish the current streaming operation.
+	 * @details	Completes the current streaming operation and allows other GDISP calls to operate again.
+	 * @pre		@p gdispStreamStart() has been called.
+	 * @note	If the gdispStreamStart() has not been called (or failed due to clipping), this
+	 * 			call is simply ignored.
+	 *
+	 * @api
+	 */
+	void gdispStreamStop(void);
+#endif
+
 /* Clipping Functions */
 
 #if GDISP_NEED_CLIP || defined(__DOXYGEN__)
diff --git a/include/gdisp/lld/gdisp_lld.h b/include/gdisp/lld/gdisp_lld.h
index 38c0ccc0..3698efb0 100644
--- a/include/gdisp/lld/gdisp_lld.h
+++ b/include/gdisp/lld/gdisp_lld.h
@@ -184,7 +184,7 @@ typedef struct GDISPDriver {
 
 } GDISPDriver;
 
-#if !GDISP_MULTIPLE_DRIVERS || defined(GDISP_LLD_DECLARATIONS)
+#if !GDISP_MULTIPLE_DRIVERS || defined(GDISP_LLD_DECLARATIONS) || defined(__DOXYGEN__)
 	#if GDISP_MULTIPLE_DRIVERS
 		#define LLDSPEC			static
 	#else
@@ -203,7 +203,7 @@ typedef struct GDISPDriver {
 	 */
 	LLDSPEC	bool_t gdisp_lld_init(GDISPDriver *g);
 
-	#if GDISP_HARDWARE_STREAM
+	#if GDISP_HARDWARE_STREAM || defined(__DOXYGEN__)
 		/**
 		 * @brief   Start a streamed operation
 		 * @pre		GDISP_HARDWARE_STREAM is TRUE
@@ -228,7 +228,7 @@ typedef struct GDISPDriver {
 		 */
 		LLDSPEC	void gdisp_lld_stream_color(GDISPDriver *g);
 
-		#if GDISP_HARDWARE_STREAM_READ
+		#if GDISP_HARDWARE_STREAM_READ || defined(__DOXYGEN__)
 			/**
 			 * @brief   Read a pixel from the current streaming position and then increment that position
 			 * @return	The color at the current position
@@ -241,7 +241,7 @@ typedef struct GDISPDriver {
 			LLDSPEC	color_t gdisp_lld_stream_read(GDISPDriver *g);
 		#endif
 
-		#if GDISP_HARDWARE_STREAM_END
+		#if GDISP_HARDWARE_STREAM_END || defined(__DOXYGEN__)
 			/**
 			 * @brief   End the current streaming operation
 			 * @pre		GDISP_HARDWARE_STREAM and GDISP_HARDWARE_STREAM_END is TRUE
@@ -254,7 +254,7 @@ typedef struct GDISPDriver {
 		#endif
 	#endif
 
-	#if GDISP_HARDWARE_DRAWPIXEL
+	#if GDISP_HARDWARE_DRAWPIXEL || defined(__DOXYGEN__)
 		/**
 		 * @brief   Draw a pixel
 		 * @pre		GDISP_HARDWARE_DRAWPIXEL is TRUE
@@ -268,7 +268,7 @@ typedef struct GDISPDriver {
 		LLDSPEC	void gdisp_lld_draw_pixel(GDISPDriver *g);
 	#endif
 
-	#if GDISP_HARDWARE_CLEARS
+	#if GDISP_HARDWARE_CLEARS || defined(__DOXYGEN__)
 		/**
 		 * @brief   Clear the screen using the defined color
 		 * @pre		GDISP_HARDWARE_CLEARS is TRUE
@@ -281,7 +281,7 @@ typedef struct GDISPDriver {
 		LLDSPEC	void gdisp_lld_clear(GDISPDriver *g);
 	#endif
 
-	#if GDISP_HARDWARE_FILLS
+	#if GDISP_HARDWARE_FILLS || defined(__DOXYGEN__)
 		/**
 		 * @brief   Fill an area with a single color
 		 * @pre		GDISP_HARDWARE_FILLS is TRUE
@@ -296,7 +296,7 @@ typedef struct GDISPDriver {
 		LLDSPEC	void gdisp_lld_fill_area(GDISPDriver *g);
 	#endif
 
-	#if GDISP_HARDWARE_BITFILLS
+	#if GDISP_HARDWARE_BITFILLS || defined(__DOXYGEN__)
 		/**
 		 * @brief   Fill an area using a bitmap
 		 * @pre		GDISP_HARDWARE_BITFILLS is TRUE
@@ -313,7 +313,7 @@ typedef struct GDISPDriver {
 		LLDSPEC	void gdisp_lld_blit_area(GDISPDriver *g);
 	#endif
 
-	#if GDISP_HARDWARE_PIXELREAD
+	#if GDISP_HARDWARE_PIXELREAD || defined(__DOXYGEN__)
 		/**
 		 * @brief   Read a pixel from the display
 		 * @return	The color at the defined position
@@ -327,7 +327,7 @@ typedef struct GDISPDriver {
 		LLDSPEC	color_t gdisp_lld_get_pixel_color(GDISPDriver *g);
 	#endif
 
-	#if GDISP_HARDWARE_SCROLL && GDISP_NEED_SCROLL
+	#if (GDISP_HARDWARE_SCROLL && GDISP_NEED_SCROLL) || defined(__DOXYGEN__)
 		/**
 		 * @brief   Scroll an area of the screen
 		 * @pre		GDISP_HARDWARE_SCROLL is TRUE (and the application needs it)
@@ -346,7 +346,7 @@ typedef struct GDISPDriver {
 		LLDSPEC	void gdisp_lld_vertical_scroll(GDISPDriver *g);
 	#endif
 
-	#if GDISP_HARDWARE_CONTROL && GDISP_NEED_CONTROL
+	#if (GDISP_HARDWARE_CONTROL && GDISP_NEED_CONTROL) || defined(__DOXYGEN__)
 		/**
 		 * @brief   Control some feature of the hardware
 		 * @pre		GDISP_HARDWARE_CONTROL is TRUE (and the application needs it)
@@ -360,7 +360,7 @@ typedef struct GDISPDriver {
 		LLDSPEC	void gdisp_lld_control(GDISPDriver *g);
 	#endif
 
-	#if GDISP_HARDWARE_QUERY && GDISP_NEED_QUERY
+	#if (GDISP_HARDWARE_QUERY && GDISP_NEED_QUERY) || defined(__DOXYGEN__)
 		/**
 		 * @brief   Query some feature of the hardware
 		 * @return	The information requested (typecast as void *)
@@ -374,7 +374,7 @@ typedef struct GDISPDriver {
 		LLDSPEC	void *gdisp_lld_query(GDISPDriver *g);				// Uses p.x (=what);
 	#endif
 
-	#if GDISP_HARDWARE_CLIP && (GDISP_NEED_CLIP || GDISP_NEED_VALIDATION)
+	#if (GDISP_HARDWARE_CLIP && (GDISP_NEED_CLIP || GDISP_NEED_VALIDATION)) || defined(__DOXYGEN__)
 		/**
 		 * @brief   Set the hardware clipping area
 		 * @pre		GDISP_HARDWARE_CLIP is TRUE (and the application needs it)
diff --git a/include/gmisc/gmisc.h b/include/gmisc/gmisc.h
index 5943e642..ff3d0c76 100644
--- a/include/gmisc/gmisc.h
+++ b/include/gmisc/gmisc.h
@@ -184,6 +184,23 @@ extern "C" {
 		/** @} */
 #endif
 
+#if GMISC_NEED_INVSQRT
+		/**
+		 * @brief	Fast inverse square root function (x^-1/2)
+		 * @return	The approximate inverse square root
+		 *
+		 * @param[in] n	The number to find the inverse square root of
+		 *
+		 * @note	This function generates an approximate result. Higher accuracy (at the expense
+		 * 			of speed) can be obtained by modifying the source code (the necessary line
+		 * 			is already there - just commented out).
+		 * @note	This function relies on the internal machine format of a float and a long.
+		 * 			If your machine architecture is very unusual this function may not work.
+		 *
+		 * @api
+		 */
+		float invsqrt(float n);
+#endif
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/gmisc/options.h b/include/gmisc/options.h
index d5cf5898..73b41800 100644
--- a/include/gmisc/options.h
+++ b/include/gmisc/options.h
@@ -28,18 +28,18 @@
 		#define GMISC_NEED_ARRAYOPS		FALSE
 	#endif
 	/**
-	 * @brief   Include fast array based trig functions (sin, cos)
+	 * @brief   Include fast fixed point trig functions (sin, cos)
 	 * @details	Defaults to FALSE
 	 */
-	#ifndef GMISC_NEED_FASTTRIG
-		#define GMISC_NEED_FASTTRIG		FALSE
+	#ifndef GMISC_NEED_FIXEDTRIG
+		#define GMISC_NEED_FIXEDTRIG		FALSE
 	#endif
 	/**
-	 * @brief   Include fast fixed point trig functions (sin, cos)
+	 * @brief   Include fast inverse square root (x^-1/2)
 	 * @details	Defaults to FALSE
 	 */
-	#ifndef GMISC_NEED_FIXEDTRIG
-		#define GMISC_NEED_FIXEDTRIG		FALSE
+	#ifndef GMISC_NEED_INVSQRT
+		#define GMISC_NEED_INVSQRT		FALSE
 	#endif
 /**
  * @}
-- 
cgit v1.2.3