r5327 tlsa - /trunk/netsurf/desktop/knockout.c

netsurf at semichrome.net netsurf at semichrome.net
Mon Sep 15 19:47:37 BST 2008


Author: tlsa
Date: Mon Sep 15 13:47:37 2008
New Revision: 5327

URL: http://source.netsurf-browser.org?rev=5327&view=rev
Log:
Add general comment on knockout rendering.

Modified:
    trunk/netsurf/desktop/knockout.c

Modified: trunk/netsurf/desktop/knockout.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/knockout.c?rev=5327&r1=5326&r2=5327&view=diff
==============================================================================
--- trunk/netsurf/desktop/knockout.c (original)
+++ trunk/netsurf/desktop/knockout.c Mon Sep 15 13:47:37 2008
@@ -18,6 +18,48 @@
 
 /** \file
  * Knockout rendering (implementation).
+ *
+ * Knockout rendering is an optimisation which is particularly for
+ * unaccelerated screen redraw. It tries to avoid plotting the same area more
+ * than once.
+ *
+ * If the object is to plot two overlapping rectangles (one large, one small),
+ * such as:
+ *
+ *   +-----------------+
+ *   |#################|
+ *   |####+-------+####|
+ *   |####|:::::::|####|
+ *   |####|:::::::|####|
+ *   |####|:::::::|####|
+ *   |####+-------+####|
+ *   |#################|
+ *   +-----------------+
+ *
+ * Without knockout rendering we plot the bottom rectangle and then the top one:
+ *
+ *   +-----------------+                 +-----------------+
+ *   |#################|                 |#################|
+ *   |#################|                 |####+-------+####|
+ *   |#################|                 |####|:::::::|####|
+ *   |#################|    and then,    |####|:::::::|####|
+ *   |#################|                 |####|:::::::|####|
+ *   |#################|                 |####+-------+####|
+ *   |#################|                 |#################|
+ *   +-----------------+                 +-----------------+
+ *
+ * With knockoout rendering, the bottom rectangle is split up into smaller
+ * ones and each pixel is just plotted once:
+ *
+ *   +-----------------+
+ *   |#################|
+ *   +----+-------+----+
+ *   |####|:::::::|####|
+ *   |####|:::::::|####|
+ *   |####|:::::::|####|
+ *   +----+-------+----+
+ *   |#################|
+ *   +-----------------+
  */
 
 #define NDEBUG




More information about the netsurf-commits mailing list