[Scummvm-cvs-logs] SF.net SVN: scummvm:[38735] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Feb 21 20:33:02 CET 2009


Revision: 38735
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38735&view=rev
Author:   fingolfin
Date:     2009-02-21 19:33:01 +0000 (Sat, 21 Feb 2009)

Log Message:
-----------
SCI: Renamed include/gfx_*.h to gfx/gfx_*.h and likewise for sfx header files

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/ksound.cpp
    scummvm/trunk/engines/sci/engine/savegame.cfsml
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/gfx/antialias.cpp
    scummvm/trunk/engines/sci/gfx/font-5x8.cpp
    scummvm/trunk/engines/sci/gfx/font-6x10.cpp
    scummvm/trunk/engines/sci/gfx/font.cpp
    scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
    scummvm/trunk/engines/sci/gfx/gfx_res_options.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resource.cpp
    scummvm/trunk/engines/sci/gfx/gfx_support.cpp
    scummvm/trunk/engines/sci/gfx/gfx_tools.cpp
    scummvm/trunk/engines/sci/gfx/operations.cpp
    scummvm/trunk/engines/sci/gfx/resmgr.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_cursor_0.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_font.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_pal_1.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_pic_0.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_picfill.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_resmgr.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_view_0.cpp
    scummvm/trunk/engines/sci/gfx/resource/sci_view_1.cpp
    scummvm/trunk/engines/sci/gfx/sbtree.cpp
    scummvm/trunk/engines/sci/gfx/sci_widgets.cpp
    scummvm/trunk/engines/sci/gfx/widgets.cpp
    scummvm/trunk/engines/sci/include/engine.h
    scummvm/trunk/engines/sci/include/menubar.h
    scummvm/trunk/engines/sci/include/sciconsole.h
    scummvm/trunk/engines/sci/scicore/resource.cpp
    scummvm/trunk/engines/sci/sfx/core.cpp
    scummvm/trunk/engines/sci/sfx/iterator.cpp
    scummvm/trunk/engines/sci/sfx/mixer.h
    scummvm/trunk/engines/sci/sfx/pcm-iterator.cpp
    scummvm/trunk/engines/sci/sfx/pcm_device.cpp
    scummvm/trunk/engines/sci/sfx/player/players.cpp
    scummvm/trunk/engines/sci/sfx/player/polled.cpp
    scummvm/trunk/engines/sci/sfx/player/realtime.cpp
    scummvm/trunk/engines/sci/sfx/sequencer.h
    scummvm/trunk/engines/sci/sfx/softseq/opl2.cpp
    scummvm/trunk/engines/sci/sfx/softseq.h
    scummvm/trunk/engines/sci/sfx/songlib.cpp
    scummvm/trunk/engines/sci/sfx/time.cpp
    scummvm/trunk/engines/sci/sfx/timer.cpp

Added Paths:
-----------
    scummvm/trunk/engines/sci/gfx/gfx_driver.h
    scummvm/trunk/engines/sci/gfx/gfx_operations.h
    scummvm/trunk/engines/sci/gfx/gfx_options.h
    scummvm/trunk/engines/sci/gfx/gfx_res_options.h
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.h
    scummvm/trunk/engines/sci/gfx/gfx_resource.h
    scummvm/trunk/engines/sci/gfx/gfx_state_internal.h
    scummvm/trunk/engines/sci/gfx/gfx_system.h
    scummvm/trunk/engines/sci/gfx/gfx_tools.h
    scummvm/trunk/engines/sci/gfx/gfx_widgets.h
    scummvm/trunk/engines/sci/gfx/sbtree.h
    scummvm/trunk/engines/sci/sfx/sfx_core.h
    scummvm/trunk/engines/sci/sfx/sfx_engine.h
    scummvm/trunk/engines/sci/sfx/sfx_iterator.h
    scummvm/trunk/engines/sci/sfx/sfx_iterator_internal.h
    scummvm/trunk/engines/sci/sfx/sfx_pcm.h
    scummvm/trunk/engines/sci/sfx/sfx_player.h
    scummvm/trunk/engines/sci/sfx/sfx_songlib.h
    scummvm/trunk/engines/sci/sfx/sfx_time.h
    scummvm/trunk/engines/sci/sfx/sfx_timer.h

Removed Paths:
-------------
    scummvm/trunk/engines/sci/include/gfx_driver.h
    scummvm/trunk/engines/sci/include/gfx_operations.h
    scummvm/trunk/engines/sci/include/gfx_options.h
    scummvm/trunk/engines/sci/include/gfx_res_options.h
    scummvm/trunk/engines/sci/include/gfx_resmgr.h
    scummvm/trunk/engines/sci/include/gfx_resource.h
    scummvm/trunk/engines/sci/include/gfx_state_internal.h
    scummvm/trunk/engines/sci/include/gfx_system.h
    scummvm/trunk/engines/sci/include/gfx_tools.h
    scummvm/trunk/engines/sci/include/gfx_widgets.h
    scummvm/trunk/engines/sci/include/sbtree.h
    scummvm/trunk/engines/sci/include/sfx_core.h
    scummvm/trunk/engines/sci/include/sfx_engine.h
    scummvm/trunk/engines/sci/include/sfx_iterator.h
    scummvm/trunk/engines/sci/include/sfx_iterator_internal.h
    scummvm/trunk/engines/sci/include/sfx_pcm.h
    scummvm/trunk/engines/sci/include/sfx_player.h
    scummvm/trunk/engines/sci/include/sfx_songlib.h
    scummvm/trunk/engines/sci/include/sfx_time.h
    scummvm/trunk/engines/sci/include/sfx_timer.h

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -38,7 +38,7 @@
 #include "sci/engine/gc.h"
 #include "sci/include/sciresource.h"
 #include "sci/include/engine.h"
-#include "sci/include/gfx_operations.h"
+#include "sci/gfx/gfx_operations.h"
 #include "sci/engine/kernel_types.h"
 
 namespace Sci {

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -27,7 +27,7 @@
 
 #include "sci/include/sciresource.h"
 #include "sci/include/engine.h"
-#include "sci/include/gfx_widgets.h"
+#include "sci/gfx/gfx_widgets.h"
 #include "sci/engine/sci_graphics.h"
 #include "sci/include/sci_widgets.h"
 

Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -24,7 +24,7 @@
  */
 
 #include "sci/include/engine.h"
-#include "sci/include/sfx_player.h"
+#include "sci/sfx/sfx_player.h"
 
 namespace Sci {
 

Modified: scummvm/trunk/engines/sci/engine/savegame.cfsml
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cfsml	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/engine/savegame.cfsml	2009-02-21 19:33:01 UTC (rev 38735)
@@ -32,8 +32,8 @@
 #include <stdarg.h>
 #include <time.h>	// FIXME: For struct tm
 #include "sci/include/sci_memory.h"
-#include "sci/include/gfx_operations.h"
-#include "sci/include/sfx_engine.h"
+#include "sci/gfx/gfx_operations.h"
+#include "sci/sfx/sfx_engine.h"
 #include "sci/include/engine.h"
 #include "sci/engine/heap.h"
 #include "common/stream.h"

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -32,8 +32,8 @@
 #include <stdarg.h>
 #include <time.h>	// FIXME: For struct tm
 #include "sci/include/sci_memory.h"
-#include "sci/include/gfx_operations.h"
-#include "sci/include/sfx_engine.h"
+#include "sci/gfx/gfx_operations.h"
+#include "sci/sfx/sfx_engine.h"
 #include "sci/include/engine.h"
 #include "sci/engine/heap.h"
 #include "common/stream.h"

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -32,7 +32,7 @@
 #include "sci/engine/kernel_types.h"
 #include "sci/engine/seg_manager.h"
 #include "sci/engine/gc.h"
-#include "sci/include/sfx_player.h"
+#include "sci/sfx/sfx_player.h"
 
 #ifdef HAVE_SETJMP_H
 #include <setjmp.h>

Modified: scummvm/trunk/engines/sci/gfx/antialias.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/antialias.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/gfx/antialias.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -25,8 +25,8 @@
 
 /** Antialiasing code **/
 
-#include "sci/include/gfx_system.h"
-#include "sci/include/gfx_tools.h"
+#include "sci/gfx/gfx_system.h"
+#include "sci/gfx/gfx_tools.h"
 
 namespace Sci {
 

Modified: scummvm/trunk/engines/sci/gfx/font-5x8.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/font-5x8.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/gfx/font-5x8.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -1,6 +1,6 @@
 /* Auto-generated by bdftofont.c */
 
-#include "sci/include/gfx_system.h"
+#include "sci/gfx/gfx_system.h"
 
 namespace Sci {
 

Modified: scummvm/trunk/engines/sci/gfx/font-6x10.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/font-6x10.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/gfx/font-6x10.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -1,6 +1,6 @@
 /* Auto-generated by bdftofont.c */
 
-#include "sci/include/gfx_system.h"
+#include "sci/gfx/gfx_system.h"
 
 namespace Sci {
 

Modified: scummvm/trunk/engines/sci/gfx/font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/font.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/gfx/font.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -24,9 +24,9 @@
  */
 
 
-#include "sci/include/gfx_system.h"
-#include "sci/include/gfx_resource.h"
-#include "sci/include/gfx_tools.h"
+#include "sci/gfx/gfx_system.h"
+#include "sci/gfx/gfx_resource.h"
+#include "sci/gfx/gfx_tools.h"
 
 namespace Sci {
 

Modified: scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -27,8 +27,8 @@
 #include "common/system.h"
 #include "common/events.h"
 
-#include "sci/include/gfx_driver.h"
-#include "sci/include/gfx_tools.h"
+#include "sci/gfx/gfx_driver.h"
+#include "sci/gfx/gfx_tools.h"
 
 namespace Sci {
 

Copied: scummvm/trunk/engines/sci/gfx/gfx_driver.h (from rev 38732, scummvm/trunk/engines/sci/include/gfx_driver.h)
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.h	2009-02-21 19:33:01 UTC (rev 38735)
@@ -0,0 +1,322 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef _SCI_GFX_DRIVER_H_
+#define _SCI_GFX_DRIVER_H_
+
+#include "sci/gfx/gfx_system.h"
+#include "sci/include/uinput.h"
+
+namespace Sci {
+
+typedef enum {
+	GFX_BUFFER_FRONT = 0,
+	GFX_BUFFER_BACK = 1,
+	GFX_BUFFER_STATIC = 2
+} gfx_buffer_t;
+
+
+/* graphics driver hints */
+#define GFX_CAPABILITY_SHADING (1<<0)
+#define GFX_CAPABILITY_STIPPLED_LINES (1<<6)
+
+#define GFX_DEBUG_POINTER (1<<0)
+#define GFX_DEBUG_UPDATES (1<<1)
+#define GFX_DEBUG_PIXMAPS (1<<2)
+#define GFX_DEBUG_BASIC (1<<3) /* Basic geometric ops (lines, boxes, etc) */
+
+/* Principial graphics driver architecture
+** ---------------------------------------
+**
+** All graphics drivers must provide
+** - One visual front buffer (the actually visible thing)
+** - Two dynamic back buffers:
+**   + visual
+**   + priority
+** - Two static buffers  (containing the background image and picviews):
+**   + visual
+**   + priority
+**
+** The control buffer is handled outside the graphics driver architecture.
+** Graphics are drawn by first setting the static buffers, then updating
+** the back buffers (from the static buffers), adding all picviews and other
+** widgets, and finally updating the front buffer.
+**
+** All coordinates refer to the scaled coordinate system.
+** Invalid parameters should produce an error message.
+** Support for some valid parameter values is optional (like different line
+** modes). If an unsupported but valid parameter is specified, the function
+** must use a reasonable default value.
+*/
+
+typedef struct _gfx_driver { /* Graphics driver */
+
+	gfx_mode_t *mode; /* Currently active mode, NULL if no mode is active */
+
+	int pointer_x, pointer_y; /* Mouse pointer position */
+
+	int capabilities; /* The driver's capabilities: A list of flags that may
+	                  ** be pre-defined or set after a successful initialization.
+	                  */
+	/* Capability flags:
+	**
+	** The words MUST, SHOULD and MAY are to be interpreted as described in
+	** the IETF RFC 1123.
+	**
+	** GFX_CAPABILITY_SHADING: draw_filled_rect() supports drawing shaded
+	**    rectangles.
+	** GFX_CAPABILITY_STIPPLED_LINES: The driver is able to draw stippled lines
+	**    horizontally and vertically (xl = 0 or yl = 0).
+	*/
+
+	unsigned int debug_flags; /* Driver debug flags */
+
+
+	/*** Initialization ***/
+
+	int (*set_parameter)(struct _gfx_driver *drv, char *attribute, char *value);
+	/* Sets a driver-specific parameter
+	** Parameters: (gfx_driver_t *) drv: Pointer to the affected driver
+	**             (char *) attribute: Name of the attribute/parameter to set
+	**             (char *) value: The value to set, or NULL to query the value
+	** Returns   : (int) GFX_OK or GFX_FATAL, which signals a fatal error
+	**                   condition.
+	** This function should make extensive use of sciprintf() to signal invalid
+	** values or unapplicable attributes.
+	** Note that it may be called either before initialization (to interpret
+	** config file or command line parameters) or afterwars (from the command
+	** console).
+	*/
+
+	int (*init_specific)(struct _gfx_driver *drv, int xres, int yres,
+	                     int bytespp);
+	/* Attempts to initialize a specific graphics mode
+	** Parameters: (gfx_driver_t *) drv: The affected driver
+	**             (int x int) xres, yres: Horizontal and vertical scaling
+	**                         factors
+	**             (int) bytespp: Any of GFX_COLOR_MODE_*. GFX_COLOR_MODE_INDEX
+	**                   implies color index mode.
+	** Returns   : (int) GFX_OK on success, GFX_ERROR if the mode could not be
+	**                   set, or GFX_FATAL if the graphics target is unuseable.
+	** The scaling factors apply to the standard SCI resolution of 320x200 pixels
+	** and is used for internal representation of graphical data. The physical
+	** resolution set by the graphics driver may be different for practical
+	** reasons.
+	** Must also set drv->mode, preferably with the gfx_new_mode() function
+	** specified in gfx_tools.h.
+	*/
+
+	int (*init)(struct _gfx_driver *drv);
+	/* Initialize any graphics mode
+	** Parameters: (gfx_driver_t *) drv: The affected driver
+	** Returns   : (int) GFX_OK on success, GFX_FATAL otherwise.
+	** This function attempts to set /any/ graphics mode, starting with the one
+	** most 'natural' to the graphics target. Target implementors have relatively
+	** free reign in choosing the heuristics used to determine the resulting
+	** mode.
+	** Must also set drv->mode, preferably with the gfx_new_mode() function
+	** specified in gfx_tools.h.
+	*/
+
+	void (*exit)(struct _gfx_driver *drv);
+	/* Uninitializes the current graphics mode
+	** Paramters: (gfx_driver_t *) drv: The driver to uninitialize
+	** Return   : (void)
+	** This function frees all memory allocated by the graphics driver,
+	** including mode and palette information, uninstalls all console commands
+	** introduced by preceeding init() or init_specific() commands, and does any
+	** clean-up work (like closing visuals or returning to text mode) required by
+	** the graphics infrastructure used.
+	*/
+
+
+	/*** Drawing operations ***/
+
+	int (*draw_line)(struct _gfx_driver *drv,
+	                 Common::Point start, Common::Point end,
+	                 gfx_color_t color,
+	                 gfx_line_mode_t line_mode, gfx_line_style_t line_style);
+	/* Draws a single line to the back buffer.
+	** Parameters: (gfx_driver_t *) drv: The driver affected
+	**             (Common::Point) start: Starting point of the line to draw
+	**             (Common::Point) end: End point of the line to draw
+	**             (gfx_color_t *) color: The color to draw with
+	**             (int) line_mode: Any of the line modes
+	**             (int) line_style: Any of the line styles
+	** Returns   : (int) GFX_OK or GFX_FATAL
+	** Note that color.priority is relevant and must be drawn if
+	** (color.mask & GFX_MASK_PRIORITY).
+	** Support for line modes other than GFX_LINE_MODE_FAST is optional.
+	** For non-fine lines, the coordinates provided describe the upper left
+	** corner of the pixels of the line to draw.
+	** line_style support is optional, if GFX_CAPABILITY_STIPPLED_LINES is not
+	** set.
+	*/
+
+	int (*draw_filled_rect)(struct _gfx_driver *drv, rect_t rect,
+	                        gfx_color_t color1, gfx_color_t color2,
+	                        gfx_rectangle_fill_t shade_mode);
+	/* Draws a single filled and possibly shaded rectangle to the back buffer.
+	** Parameters: (gfx_driver_t *) drv: The driver affected
+	**             (rect_t *) rect: The rectangle to draw
+	**             (gfx_color_t *) color1, color2: The colors to draw with
+	**             (int) shade_mode: Any of GFX_SHADE_*.
+	** Returns   : (int) GFX_OK or GFX_FATAL
+	** Note that color.priority is relevant and must be drawn if
+	** (color.mask & GFX_MASK_PRIORITY).
+	** color2 is relevant only if shade_mode is not GFX_SHADE_FLAT.
+	** Support for shade modes other than GFX_SHADE_FLAT is optional.
+	*/
+
+	/*** Pixmap operations ***/
+
+	int (*draw_pixmap)(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int priority,
+	                   rect_t src, rect_t dest, gfx_buffer_t buffer);
+	/* Draws part of a pixmap to the static or back buffer
+	** Parameters: (gfx_driver_t *) drv: The affected driver
+	**             (gfx_pixmap_t *) pxm: The pixmap to draw
+	**             (int) priority: The priority to draw with, or GFX_NO_PRIORITY
+	**                   to draw on top of everything without setting the
+	**                   priority back buffer
+	**             (rect_t) src: The pixmap-relative source rectangle
+	**             (rect_t) dest: The destination rectangle
+	**             (int) buffer: One of GFX_BUFFER_STATIC and GFX_BUFFER_BACK
+	** Returns   : (int) GFX_OK or GFX_FATAL, or GFX_ERROR if pxm was not
+	**                   (but should have been) registered.
+	*/
+
+	int (*grab_pixmap)(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm,
+	                   gfx_map_mask_t map);
+	/* Grabs an image from the visual or priority back buffer
+	** Parameters: (gfx_driver_t *) drv: The affected driver
+	**             (rect_t) src: The rectangle to grab
+	**             (gfx_pixmap_t *) pxm: The pixmap structure the data is to
+	**                              be written to
+	**             (int) map: GFX_MASK_VISUAL or GFX_MASK_PRIORITY
+	** Returns   : (int) GFX_OK, GFX_FATAL, or GFX_ERROR for invalid map values
+	** pxm may be assumed to be empty and pre-allocated with an appropriate
+	** memory size.
+	** This function is now mandatory.
+	*/
+
+
+	/*** Buffer operations ***/
+
+	int (*update)(struct _gfx_driver *drv, rect_t src, Common::Point dest,
+	              gfx_buffer_t buffer);
+	/* Updates the front buffer or the back buffers
+	** Parameters: (gfx_driver_t *) drv: The affected driver
+	**             (rect_t) src: Source rectangle
+	**             (Common::Point) dest: Destination point
+	**             (int) buffer: One of GFX_BUFFER_FRONT or GFX_BUFFER_BACK
+	** Returns   : (int) GFX_OK, GFX_ERROR or GFX_FATAL
+	** This function updates either the visual front buffer, or the two back
+	** buffers, by copying the specified source region to the destination
+	** region.
+	** For heuristical reasons, it may be assumed that the x and y fields of
+	** src and dest will be identical in /most/ cases.
+	** If they aren't, the priority map will not be required to be copied.
+	*/
+
+	int (*set_static_buffer)(struct _gfx_driver *drv, gfx_pixmap_t *pic,
+	                         gfx_pixmap_t *priority);
+	/* Sets the contents of the static visual and priority buffers
+	** Parameters: (gfx_driver_t *) drv: The affected driver
+	**             (gfx_pixmap_t *) pic: The image defining the new content
+	**                              of the visual back buffer
+	**             (gfx_pixmap_t *) priority: The priority map containing
+	**                              the new content of the priority back buffer
+	**                              in the index buffer
+	** Returns   : (int) GFX_OK or GFX_FATAL
+	** pic and priority may be modified or written to freely. They may also be
+	** used as the actual static buffers, since they are not freed and re-
+	** allocated between calls to set_static_buffer() and update(), unless
+	** exit() was called in between.
+	** Note that later version of the driver interface may disallow modifying
+	** pic and priority.
+	** pic and priority are always scaled to the appropriate resolution
+	*/
+
+
+	/*** Mouse pointer operations ***/
+
+	int (*set_pointer)(struct _gfx_driver *drv, gfx_pixmap_t *pointer);
+	/* Sets a new mouse pointer.
+	** Parameters: (gfx_driver_t *) drv: The driver to modify
+	**             (gfx_pixmap_t *) pointer: The pointer to set, or NULL to set
+	**                              no pointer
+	** Returns   : (int) GFX_OK or GFX_FATAL
+	** If pointer is not NULL, it will have been scaled to the appropriate
+	** size and registered as a pixmap (if neccessary) beforehand.
+	** If this function is called for a target that supports only two-color
+	** pointers, the image is a color index image, where only color index values
+	** 0, 1, and GFX_COLOR_INDEX_TRANSPARENT are used.
+	*/
+
+
+	/*** Palette operations ***/
+
+	int (*set_palette)(struct _gfx_driver *drv, int index, byte red, byte green,
+	                   byte blue);
+	/* Manipulates a palette index in the hardware palette
+	** Parameters: (gfx_driver_t *) drv: The driver affected
+	**             (int) index: The index of the palette entry to modify
+	**             (int x int x int) red, green, blue: The RGB intensities to
+	**                               set for the specified index. The minimum
+	**                               intensity is 0, maximum is 0xff.
+	** Returns   : (int) GFX_OK, GFX_ERROR or GFX_FATAL
+	** This function does not need to update mode->palette, as this is done
+	** by the calling code.
+	** set_palette() is only required for targets supporting color index mode.
+	*/
+
+
+	/*** Event management ***/
+
+	sci_event_t (*get_event)(struct _gfx_driver *drv);
+	/* Returns the next event in the event queue for this driver
+	** Parameters: (gfx_driver_t *) drv: The driver to query
+	** Returns   : (sci_event_t) The oldest event still in the driver's event
+	**                           queue, or the null event if there is none.
+	*/
+
+	int (*usec_sleep)(struct _gfx_driver *drv, long usecs);
+	/* Sleeps the specified amount of microseconds, or until the mouse moves
+	** Parameters: (gfx_driver_t *) drv: The relevant driver
+	**             (long) usecs: Amount of microseconds to sleep
+	** Returns   : (int) GFX_OK or GFX_FATAL
+	** This function returns when the specified amount of microseconds has
+	** elapsed, or when the mouse pointer has been moved and needs to be redrawn.
+	** Only targets that can handle colored mouse pointers may choose to handle
+	** all mouse management internally.
+	*/
+
+	void *state; /* Reserved for internal use */
+
+} gfx_driver_t;
+
+} // End of namespace Sci
+
+#endif // !_SCI_GFX_DRIVER_H_

Copied: scummvm/trunk/engines/sci/gfx/gfx_operations.h (from rev 38732, scummvm/trunk/engines/sci/include/gfx_operations.h)
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_operations.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/gfx/gfx_operations.h	2009-02-21 19:33:01 UTC (rev 38735)
@@ -0,0 +1,684 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/* Graphical operations, called from the widget state manager */
+
+#ifndef _GFX_OPERATIONS_H_
+#define _GFX_OPERATIONS_H_
+
+#include "sci/gfx/gfx_resmgr.h"
+#include "sci/gfx/gfx_tools.h"
+#include "sci/gfx/gfx_options.h"
+#include "sci/gfx/gfx_system.h"
+#include "sci/include/uinput.h"
+
+namespace Sci {
+
+#define GFXOP_NO_POINTER -1
+
+/* Threshold in color index mode to differentiate between visible and non-visible stuff.
+** GFXOP_ALPHA_THRESHOLD itself should be treated as non-visible.
+*/
+#define GFXOP_ALPHA_THRESHOLD 0xff
+
+typedef struct {
+	char *text; /* Copy of the actual text */
+
+	int lines_nr;
+	int line_height;
+	text_fragment_t *lines; /* Text offsets */
+	gfx_bitmap_font_t *font;
+	gfx_pixmap_t **text_pixmaps;
+
+	int width, height;
+
+	int priority, control;
+	gfx_alignment_t halign, valign;
+} gfx_text_handle_t;
+
+/* Unless individually stated otherwise, the following applies:
+** All operations herein apply to the standard 320x200 coordinate system.
+** All operations perform clipping relative to state->clip_zone.
+*/
+
+typedef enum {
+	GFX_BOX_SHADE_FLAT,
+	GFX_BOX_SHADE_RIGHT,
+	GFX_BOX_SHADE_LEFT,
+	GFX_BOX_SHADE_DOWN,
+	GFX_BOX_SHADE_UP
+#if 0
+	/* possible with alphaing, but there is no way to check for
+	** alpha capability of gfx_driver->draw_filled_rect() yet
+	*/
+	, GFX_BOX_SHADE_RIGHT_DOWN,
+	GFX_BOX_SHADE_LEFT_DOWN,
+	GFX_BOX_SHADE_RIGHT_UP,
+	GFX_BOX_SHADE_LEFT_UP
+#endif
+} gfx_box_shade_t;
+
+
+typedef struct _dirty_rect {
+	rect_t rect;
+	struct _dirty_rect *next;
+} gfx_dirty_rect_t;
+
+
+typedef struct _gfx_event {
+	sci_event_t event;
+	struct _gfx_event *next;
+} gfx_input_event_t;
+
+typedef struct {
+	int version; /* Interpreter version */
+
+	gfx_options_t *options;
+
+	Common::Point pointer_pos; /* Mouse pointer coordinates */
+
+	rect_t clip_zone_unscaled; /* The current UNSCALED clipping zone */
+	rect_t clip_zone; /* The current SCALED clipping zone; a cached scaled version of clip_zone_unscaled */
+
+	gfx_driver_t *driver;
+	gfx_pixmap_color_t *static_palette; /* Null for dynamic palettes */
+	int static_palette_entries;
+
+	int visible_map;
+
+	gfx_resstate_t *resstate; /* Resource state */
+
+	gfx_pixmap_t *priority_map; /* back buffer priority map (unscaled) */
+	gfx_pixmap_t *static_priority_map; /* static buffer priority map (unscaled) */
+	gfx_pixmap_t *control_map; /* back buffer control map (only exists unscaled in the first place) */
+
+
+	int mouse_pointer_visible; /* Whether the pointer is drawn right now */
+	Common::Point old_pointer_draw_pos; /* Mouse pointer draw coordinates */
+	rect_t pointer_bg_zone; /* old-pointer-draw-pos relative zone inside the pointer
+				** pixmap that was drawn  */
+
+	int mouse_pointer_in_hw; /* Current pointer is being handled in hardware */
+
+	gfx_pixmap_t *mouse_pointer; /* Only set when drawing the mouse manually */
+	gfx_pixmap_t *mouse_pointer_bg; /* Background under the pointer */
+
+	int tag_mode; /* Set to 1 after a new pic is drawn and the resource manager
+		      ** has tagged all resources. Reset after the next front buffer
+		      ** update is done, when all resources that are still tagged are
+		      ** flushed.  */
+
+	int disable_dirty; /* Set to 1 to disable dirty rect accounting */
+
+	int pic_nr; /* Number of the current pic */
+	int palette_nr; /* Palette number of the current pic */
+
+	gfx_input_event_t *events;
+
+	gfx_pixmap_t *fullscreen_override; /* An optional override picture which must have unscaled
+					   ** full-screen size, which overrides all other visibility, and
+					   ** which is generally slow */
+
+	gfxr_pic_t *pic, *pic_unscaled; /* The background picture and its unscaled equivalent */
+
+	struct _dirty_rect *dirty_rects; /* Dirty rectangles */
+
+	void *internal_state; /* Internal interpreter information */
+
+} gfx_state_t;
+
+
+/**************************/
+/* Fundamental operations */
+/**************************/
+
+int gfxop_init_default(gfx_state_t *state, gfx_options_t *options, void *misc_info);
+/* Initializes a graphics mode suggested by the graphics driver
+** Parameters: (gfx_state_ t *) state: The state to initialize in that mode
+**             (gfx_options_t *) options: Rendering options
+**             (void *) misc_info: Additional information for the interpreter
+**                      part of the resource loader
+** Returns   : (int) GFX_OK on success, GFX_FATAL otherwise
+*/
+
+int gfxop_init(gfx_state_t *state, int xfact, int yfact, gfx_color_mode_t bpp,
+           gfx_options_t *options, void *misc_info);
+/* Initializes a custom graphics mode
+** Parameters: (gfx_state_t *) state: The state to initialize
+**             (int x int) xfact, yfact: Horizontal and vertical scale factors
+**             (gfx_color_mode_t) bpp: Bytes per pixel to initialize with, or
+**                                     0 (GFX_COLOR_MODE_AUTO) to auto-detect
+**             (gfx_options_t *) options: Rendering options
+**             (void *) misc_info: Additional information for the interpreter
+**                      part of the resource loader
+** Returns   : (int) GFX_OK on success, GFX_ERROR if that particular mode is
+**                   unavailable, or GFX_FATAL if the graphics driver is unable
+**                   to provide any useful graphics support
+*/
+
+int gfxop_set_parameter(gfx_state_t *state, char *attribute, char *value);
+/* Sets a driver-specific parameter
+** Parameters: (gfx_state_t *) state: The state, encapsulating the driver object to manipulate
+**             (char *) attribute: The attribute to set
+**             (char *) value: The value the attribute should be set to
+** Returns   : (int) GFX_OK on success, GFX_FATAL on fatal error conditions triggered
+**                   by the command
+*/
+
+int gfxop_exit(gfx_state_t *state);
+/* Deinitializes a currently active driver
+** Parameters: (gfx_state_t *) state: The state encapsulating the driver in question
+** Returns   : (int) GFX_OK
+*/
+
+int gfxop_scan_bitmask(gfx_state_t *state, rect_t area, gfx_map_mask_t map);
+/* Calculates a bit mask calculated from some pixels on the specified map
+** Parameters: (gfx_state_t *) state: The state containing the pixels to scan
+**             (rect_t) area: The area to check
+**             (gfx_map_mask_t) map: The GFX_MASKed map(s) to test
+** Returns   : (int) An integer value where, for each 0<=i<=15, bit #i is set
+**             iff there exists a map for which the corresponding bit was set
+**             in the 'map' parameter and for which there exists a pixel within
+**             the specified area so that the pixel's lower 4 bits, interpreted
+**             as an integer value, equal i.
+** (Short version: This is an implementation of "on_control()").
+*/
+
+int gfxop_set_visible_map(gfx_state_t *state, gfx_map_mask_t map);
+/* Sets the currently visible map
+** Parameters: (gfx_state_t *) state: The state to modify
+**             (gfx_map_mask_t) map: The GFX_MASK to set
+** Returns   : (int) GFX_OK, or GFX_ERROR if map was invalid
+** 'visible_map' can be any of GFX_MASK_VISUAL, GFX_MASK_PRIORITY and GFX_MASK_CONTROL; the appropriate
+** map (as far as its contents are known to the graphics subsystem) is then subsequently drawn to the
+** screen at each update. If this is set to anything other than GFX_MASK_VISUAL, slow full-screen updates
+** are performed. Mostly useful for debugging.
+** The screen needs to be updated for the changes to take effect.
+*/
+
+int gfxop_set_clip_zone(gfx_state_t *state, rect_t zone);
+/* Sets a new clipping zone
+** Parameters: (gfx_state_t *) state: The affected state
+**             (rect_t) zone: The new clipping zone
+** Returns   : (int) GFX_OK
+*/
+
+/******************************/
+/* Generic drawing operations */
+/******************************/
+
+int gfxop_draw_line(gfx_state_t *state,
+                Common::Point start, Common::Point end,
+                gfx_color_t color, gfx_line_mode_t line_mode,
+                gfx_line_style_t line_style);
+/* Renders a clipped line to the back buffer
+** Parameters: (gfx_state_t *) state: The state affected
+**             (Common::Point) start: Starting point of the line
+**	       (Common::Point) end: End point of the line
+**             (gfx_color_t) color: The color to use for drawing
+**             (gfx_line_mode_t) line_mode: Any valid line mode to use
+**             (gfx_line_style_t) line_style: The line style to use
+** Returns   : (int) GFX_OK or GFX_FATAL
+*/
+
+int gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx_line_mode_t line_mode,
+                     gfx_line_style_t line_style);
+/* Draws a non-filled rectangular box to the back buffer
+** Parameters: (gfx_state_t *) state: The affected state
+**             (rect_t) rect: The rectangular area the box is drawn to
+**             (gfx_color_t) color: The color the box is to be drawn in
+**             (gfx_line_mode_t) line_mode: The line mode to use
+**             (gfx_line_style_t) line_style: The line style to use for the box
+** Returns   : (int) GFX_OK or GFX_FATAL
+** Boxes drawn in thin lines will surround the minimal area described by rect.
+*/
+
+int gfxop_draw_box(gfx_state_t *state, rect_t box, gfx_color_t color1, gfx_color_t color2,
+               gfx_box_shade_t shade_type);
+/* Draws a filled box to the back buffer
+** Parameters: (gfx_state_t *) state: The affected state
+**             (rect_t) box: The area to draw to
+**             (gfx_color_t) color1: The primary color to use for drawing
+**             (gfx_color_t) color2: The secondary color to draw in
+**             (gfx_box_shade_t) shade_type: The shading system to use
+**                               (e.g. GFX_BOX_SHADE_FLAT)
+** Returns   : (int) GFX_OK or GFX_FATAL
+** The draw mask, control, and priority values are derived from color1.
+*/
+
+int gfxop_fill_box(gfx_state_t *state, rect_t box, gfx_color_t color);
+/* Fills a box in the back buffer with a specific color
+** Parameters: (gfx_state_t *) state: The state to draw to
+**             (rect_t) box: The box to fill
+**             (gfx_color_t) color: The color to use for filling
+** Returns   : (int) GFX_OK or GFX_FATAL
+** This is a simple wrapper function for gfxop_draw_box
+*/
+
+int gfxop_clear_box(gfx_state_t *state, rect_t box);
+/* Copies a box from the static buffer to the back buffer
+** Parameters: (gfx_state_t *) state: The affected state
+**             (rect_t) box: The box to propagate from the static buffer
+** Returns   : (int) GFX_OK or GFX_FATAL
+*/
+
+
+int gfxop_update(gfx_state_t *state);
+/* Updates all dirty rectangles
+** Parameters: (gfx_state_t) *state: The relevant state
+** Returns   : (int) GFX_OK or GFX_FATAL if reported by the driver
+** In order to track dirty rectangles, they must be enabled in the options.
+** This function instructs the resource manager to free all tagged data
+** on certain occasions (see gfxop_new_pic).
+*/
+
+
+int gfxop_update_box(gfx_state_t *state, rect_t box);
+/* Propagates a box from the back buffer to the front (visible) buffer
+** Parameters: (gfx_state_t *) state: The affected state
+**             (rect_t) box: The box to propagate to the front buffer
+** Returns   : (int) GFX_OK or GFX_FATAL
+** This function instructs the resource manager to free all tagged data
+** on certain occasions (see gfxop_new_pic).
+** When called with dirty rectangle management enabled, it will automatically
+** propagate all dirty rectangles as well, UNLESS dirty frame accounting has
+** been disabled explicitly.
+*/
+
+int gfxop_enable_dirty_frames(gfx_state_t *state);
+/* Enables dirty frame accounting
+** Parameters: (gfx_state_t *) state: The state dirty frame accounting is to be enabled in
+** Returns   : (int) GFX_OK or GFX_ERROR if state was invalid
+** Dirty frame accounting is enabled by default.
+*/
+
+int gfxop_disable_dirty_frames(gfx_state_t *state);
+/* Disables dirty frame accounting
+** Parameters: (gfx_state_t *) state: The state dirty frame accounting is to be disabled in
+** Returns   : (int) GFX_OK or GFX_ERROR if state was invalid
+*/
+
+
+/********************/
+/* Color operations */
+/********************/
+
+int gfxop_set_color(gfx_state_t *state, gfx_color_t *color, int r, int g, int b, int a,
+                int priority, int control);
+/* Maps an r/g/b value to a color and sets a gfx_color_t structure
+** Parameters: (gfx_state_t *) state: The current state
+**             (gfx_color_t *) color: Pointer to the structure to write to
+**             (int x int x int) r,g,b: The red/green/blue color intensity values
+**                               of the result color (0x00 (minimum) to 0xff (max))
+**                               If any of these values is less than zero, the
+**                               resulting color will not affect the visual map when
+**                               used for drawing
+**             (int) a: The alpha (transparency) value, with 0x00 meaning absolutely
+**                      opaque and 0xff meaning fully transparent. Alpha blending support
+**                      is optional for drivers, so these are the only two values that
+**                      are guaranteed to work as intended. Any value in between them
+**                      must guarantee the following opaqueness:
+**                      opaqueness(x-1) >= opaqueness(x) >= opaqueness (x+1)
+**                      (i.e. ([0,255], less-transparent-than) must define a partial order)
+**             (int) priority: The priority to use for drawing, or -1 for none
+**             (int) control: The control to use for drawing, or -1 to disable drawing to the
+**                            control map
+** Returns   : (int) GFX_OK or GFX_ERROR if state is invalid
+** In palette mode, this may allocate a new color. Use gfxop_free_color() described below to
+** free that color.
+*/
+
+int gfxop_set_system_color(gfx_state_t *state, gfx_color_t *color);
+/* Designates a color as a 'system color'
+** Parameters: (gfx_state_t *) state: The affected state
+**             (gfx_color_t *) color: The color to designate as a system color
+** Returns   : (int) GFX_OK or GFX_ERROR if state is invalid
+** System colors are permanent colors that cannot be deallocated. As such, they must be used
+** with caution.
+*/
+
+int gfxop_free_color(gfx_state_t *state, gfx_color_t *color);
+/* Frees a color allocated by gfxop_set_color()
+** Parmaeters: (gfx_state_t *) state: The state affected
+**             (gfx_color_t *) color: The color to de-allocate
+** Returns   : (int) GFX_OK or GFX_ERROR if state is invalid
+** This function is a no-op in non-index mode, or if color is a system color.
+*/
+
+
+/**********************/
+/* Pointer and IO ops */
+/**********************/
+
+int gfxop_usleep(gfx_state_t *state, long usecs);
+/* Suspends program execution for the specified amount of microseconds
+** Parameters: (gfx_state_t *) state: The state affected
+**             (long) usecs: The amount of microseconds to wait
+** Returns   : (int) GFX_OK or GFX_ERROR
+** The mouse pointer will be redrawn continually, if applicable
+*/
+
+int gfxop_set_pointer_cursor(gfx_state_t *state, int nr);
+/* Sets the mouse pointer to a cursor resource
+** Parameters: (gfx_state_t *) state: The affected state
+**             (int) nr: Number of the cursor resource to use
+** Returns   : (int) GFX_OK, GFX_ERROR if the resource did not
+**                   exist and was not GFXOP_NO_POINTER, or GFX_FATAL on
+**                   fatal error conditions.
+** Use nr = GFX_NO_POINTER to disable the mouse pointer (default).
+*/
+
+int gfxop_set_pointer_view(gfx_state_t *state, int nr, int loop, int cel, Common::Point *hotspot);
+/* Sets the mouse pointer to a view resource
+** Parameters: (gfx_state_t *) state: The affected state
+**             (int) nr: Number of the view resource to use
+**             (int) loop: View loop to use
+**             (int) cel: View cel to use
+**             (Common::Point *) hotspot: Manually set hotspot to use, or NULL for default.
+** Returns   : (int) GFX_OK or GFX_FATAL
+** Use gfxop_set_pointer_cursor(state, GFXOP_NO_POINTER) to disable the
+** pointer.
+*/
+
+int gfxop_set_pointer_position(gfx_state_t *state, Common::Point pos);
+/* Teleports the mouse pointer to a specific position
+** Parameters: (gfx_state_t *) state: The state the pointer is in
+**             (Common::Point) pos: The position to teleport it to
+** Returns   : (int) Any error code or GFX_OK
+** Depending on the graphics driver, this operation may be without
+** any effect
+*/
+
+sci_event_t gfxop_get_event(gfx_state_t *state, unsigned int mask);
+/* Retreives the next input event from the driver
+** Parameters: (gfx_state_t *) state: The affected state
+**             (int) mask: The event mask to poll from (see uinput.h)
+** Returns   : (sci_event_t) The next event in the driver's event queue, or
+**             a NONE event if no event matching the mask was found.
+*/
+
+
+/*******************/
+/* View operations */
+/*******************/
+
+int gfxop_lookup_view_get_loops(gfx_state_t *state, int nr);
+/* Determines the number of loops associated with a view
+** Parameters: (gfx_state_t *) state: The state to use
+**             (int) nr: Number of the view to investigate
+** Returns   : (int) The number of loops, or GFX_ERROR if the view didn't exist
+*/
+
+int gfxop_lookup_view_get_cels(gfx_state_t *state, int nr, int loop);
+/* Determines the number of cels associated stored in a loop
+** Parameters: (gfx_state_t *) state: The state to look up in
+**             (int) nr: Number of the view to look up in
+**             (int) loop: Number of the loop the number of cels of
+**                         are to  be investigated
+** Returns   : (int) The number of cels in that loop, or GFX_ERROR if either
+**                   the view or the loop didn't exist
+*/
+
+int gfxop_check_cel(gfx_state_t *state, int nr, int *loop, int *cel);
+/* Clips the view/loop/cel position of a cel
+** Parameters: (gfx_state_t *) state: The state to use
+**             (int) nr: Number of the view to use
+**             (int *) loop: Pointer to the variable storing the loop
+**                           number to verify
+**             (int *) cel: Pointer to the variable storing the cel
+**                          number to check
+** Returns   : (int) GFX_OK or GFX_ERROR if the view didn't exist
+** *loop is clipped first, then *cel. The resulting setup will be a valid
+** view configuration.
+*/
+
+int gfxop_overflow_cel(gfx_state_t *state, int nr, int *loop, int *cel);
+/* Resets loop/cel values to zero if they have become invalid
+** Parameters: (gfx_state_t *) state: The state to use
+**             (int) nr: Number of the view to use
+**             (int *) loop: Pointer to the variable storing the loop
+**                           number to verify
+**             (int *) cel: Pointer to the variable storing the cel
+**                          number to check
+** Returns   : (int) GFX_OK or GFX_ERROR if the view didn't exist
+** *loop is clipped first, then *cel. The resulting setup will be a valid
+** view configuration.
+*/
+
+int gfxop_get_cel_parameters(gfx_state_t *state, int nr, int loop, int cel,
+                         int *width, int *height, Common::Point *offset);
+/* Retreives the width and height of a cel
+** Parameters: (gfx_state_t *) state: The state to use
+**             (int) nr: Number of the view
+**             (int) loop: Loop number to examine
+**             (int) cel: The cel (inside the loop) to look up
+**             (int *) width: The variable the width will be stored in
+**             (int *) height: The variable the height will be stored in
+**             (Common::Point *) offset: The variable the cel's x/y offset will be stored in
+** Returns   : (int) GFX_OK if the lookup succeeded, GFX_ERROR if the nr/loop/cel
+**             combination was invalid
+*/
+
+int gfxop_draw_cel(gfx_state_t *state, int nr, int loop, int cel, Common::Point pos,
+               gfx_color_t color, int palette);
+/* Draws (part of) a cel to the back buffer
+** Parameters: (gfx_state_t *) state: The state encapsulating the driver to draw with
+**             (int) nr: Number of the view to draw
+**             (int) loop: Loop of the cel to draw
+**             (int) cel: The cel number of the cel to draw
+**             (Common::Point) pos: The positino the cel is to be drawn to
+**             (gfx_color_t color): The priority and control values to use for drawing
+**	       (int) palette: The palette to use
+** Returns   : (int) GFX_OK or GFX_FATAL
+*/
+
+
+int gfxop_draw_cel_static(gfx_state_t *state, int nr, int loop, int cel, Common::Point pos,
+                      gfx_color_t color, int palette);
+/* Draws a cel to the static buffer; no clipping is performed
+** Parameters: (gfx_state_t *) state: The state encapsulating the driver to draw with
+**             (int) nr: Number of the view to draw
+**             (int) loop: Loop of the cel to draw
+**             (int) cel: The cel number of the cel to draw
+**             (Common::Point) pos: The positino the cel is to be drawn to
+**             (gfx_color_t color): The priority and control values to use for drawing
+**	       (int) palette: The palette to use
+** Returns   : (int) GFX_OK or GFX_FATAL
+** Let me repeat, no clipping (except for the display borders) is performed.
+*/
+
+
+int gfxop_draw_cel_static_clipped(gfx_state_t *state, int nr, int loop, int cel, Common::Point pos,
+                              gfx_color_t color, int palette);
+/* Draws (part of) a clipped cel to the static buffer
+** Parameters: (gfx_state_t *) state: The state encapsulating the driver to draw with
+**             (int) nr: Number of the view to draw
+**             (int) loop: Loop of the cel to draw
+**             (int) cel: The cel number of the cel to draw
+**             (Common::Point) pos: The positino the cel is to be drawn to
+**             (gfx_color_t color): The priority and control values to use for drawing
+**	       (int) palette: The palette to use
+** Returns   : (int) GFX_OK or GFX_FATAL
+** This function does clip.
+*/
+
+
+/******************/
+/* Pic operations */
+/******************/
+/* These operations are exempt from clipping */
+
+int gfxop_new_pic(gfx_state_t *state, int nr, int flags, int default_palette);
+/* Draws a pic and writes it over the static buffer
+** Parameters: (gfx_state_t *) state: The state affected
+**             (int) nr: Number of the pic to draw
+**             (int) flags: Interpreter-dependant flags to use for drawing
+**             (int) default_palette: The default palette for drawing
+** Returns   : (int) GFX_OK or GFX_FATAL
+** This function instructs the resource manager to tag all data as "unused".
+** See the resource manager tag functions for a full description.
+*/
+
+void *gfxop_get_pic_metainfo(gfx_state_t *state);
+/* Retreives all meta-information assigned to the current pic
+** Parameters: (gfx_state_t *) state: The state affected
+** Returns   : (void *) NULL if the pic doesn't exist or has no meta-information,
+**             the meta-info otherwise
+** This meta-information is referred to as 'internal data' in the pic code
+*/
+
+int gfxop_add_to_pic(gfx_state_t *state, int nr, int flags, int default_palette);
+/* Adds a pic to the static buffer
+** Parameters: (gfx_state_t *) state: The state affected
+**             (int) nr: Number of the pic to add
+**             (int) flags: Interpreter-dependant flags to use for drawing
+**             (int) default_palette: The default palette for drawing
+** Returns   : (int) GFX_OK or GFX_FATAL
+*/
+
+
+
+
+/*******************/
+/* Text operations */
+/*******************/
+
+
+int gfxop_get_font_height(gfx_state_t *state, int font_nr);
+/* Returns the fixed line height for one specified font
+** Parameters: (gfx_state_t *) state: The state to work on
+**             (int) font_nr: Number of the font to inspect
+** Returns   : (int) GFX_ERROR, GFX_FATAL, or the font line height
+*/
+
+int gfxop_get_text_params(gfx_state_t *state, int font_nr, const char *text,
+                      int maxwidth, int *width, int *height, int flags,
+                      int *lines_nr, int *lineheight, int *lastline_width);
+/* Calculates the width and height of a specified text in a specified font
+** Parameters: (gfx_state_t *) state: The state to use
+**             (int) font_nr: Font number to use for the calculation
+**             (const char *) text: The text to examine
+**             (int) flags: ORred GFXR_FONT_FLAGs
+**             (int) maxwidth: The maximum pixel width to allow for the text
+** Returns   : (int) GFX_OK or GFX_ERROR if the font didn't exist
+**             (int) *width: The resulting width
+**             (int) *height: The resulting height
+**             (int) *lines_nr: Number of lines used in the text
+**             (int) *lineheight: Pixel height (SCI scale) of each text line
+**             (int) *lastline_wdith: Pixel offset (SCI scale) of the space
+**                   after the last character in the last line
+*/
+
+gfx_text_handle_t *gfxop_new_text(gfx_state_t *state, int font_nr, char *text, int maxwidth,
+               gfx_alignment_t halign, gfx_alignment_t valign,
+               gfx_color_t color1, gfx_color_t color2, gfx_color_t bg_color,
+               int flags);
+/* Generates a new text handle that can be used to draw any text
+** Parameters: (gfx_state_t *) state: The state to use
+**             (int) font_nr: Font number to use for the calculation
+**             (char *) text: The text to examine
+**             (int) maxwidth: The maximum pixel width to allow for the text
+**             (gfx_alignment_t) halign: The horizontal text alignment
+**             (gfx_alignment_t) valign: The vertical text alignment
+**             (gfx_color_t x gfx_color_t) color1, color2: The text's foreground colors
+**                                         (the function will dither between those two)
+**             (gfx_color_t) bg_color: The background color
+**             (int) flags: ORred GFXR_FONT_FLAGs
+** Returns   : (gfx_text_handle_t *) A newly allocated gfx_text_handle_t, or
+**             NULL if font_nr was invalid
+** The control and priority values for the text will be extracted from color1.
+** Note that the colors must have been allocated properly, or the text may display in
+** incorrect colors.
+*/
+
+int gfxop_free_text(gfx_state_t *state, gfx_text_handle_t *handle);
+/* Frees a previously allocated text handle and all related resources
+** Parameters: (gfx_state_t *) state: The state to use
+**             (gfx_text_handle_t *) handle: The handle to free
+** Returns   : (int) GFX_OK
+*/
+
+int gfxop_draw_text(gfx_state_t *state, gfx_text_handle_t *handle, rect_t zone);
+/* Draws text stored in a text handle
+** Parameters: (gfx_state_t *) state: The target state
+**             (gfx_text_handle_t *) handle: The text handle to use for drawing
+**             (rect_t) zone: The rectangular box to draw to. In combination with
+**                            halign and valign, this defines where the text is
+**                            drawn to.
+** Returns   : (int) GFX_OK or GFX_FATAL
+*/
+
+
+/****************************/
+/* Manual pixmap operations */
+/****************************/
+
+gfx_pixmap_t *gfxop_grab_pixmap(gfx_state_t *state, rect_t area);
+/* Grabs a screen section from the back buffer and stores it in a pixmap
+** Parameters: (gfx_state_t *) state: The affected state
+**             (rect_t) area: The area to grab
+** Returns   : (gfx_pixmap_t *) A result pixmap, or NULL on error
+** Obviously, this only affects the visual map
+*/
+
+int gfxop_draw_pixmap(gfx_state_t *state, gfx_pixmap_t *pxm, rect_t zone, Common::Point pos);
+/* Draws part of a pixmap to the screen
+** Parameters: (gfx_state_t *) state: The affected state
+**             (gfx_pixmap_t *) pxm: The pixmap to draw
+**             (rect_t) zone: The segment of the pixmap to draw
+**             (Common::Point) pos: The position the pixmap should be drawn to
+** Returns   : (int) GFX_OK or any error code
+*/
+
+int gfxop_free_pixmap(gfx_state_t *state, gfx_pixmap_t *pxm);
+/* Frees a pixmap returned by gfxop_grab_pixmap()
+** Parameters: (gfx_state_t *) state: The affected state
+**             (gfx_pixmap_t *) pxm: The pixmap to free
+** Returns   : (int) GFX_OK, or GFX_ERROR if the state was invalid
+*/
+
+/******************************/
+/* Dirty rectangle operations */
+/******************************/
+
+gfx_dirty_rect_t *gfxdr_add_dirty(gfx_dirty_rect_t *base, rect_t box, int strategy);
+/* Adds a dirty rectangle to 'base' according to a strategy
+** Parameters: (gfx_dirty_rect_t *) base: The base rectangle to add to, or NULL
+**             (rect_t) box: The dirty frame to add
+**             (int) strategy: The dirty frame heuristic to use (see gfx_options.h)
+** Returns   : (gfx_dirty_rect_t *) an appropriate singly-linked dirty rectangle
+**                                  result cluster
+*/
+
+int _gfxop_clip(rect_t *rect, rect_t clipzone);
+/* Clips a rectangle against another one
+** Parameters: (rect_t *) rect: The rectangle to clip
+**             (rect_t) clipzone: The outer bounds rect must be in
+** Reuturns  : (int) 1 if rect is empty now, 0 otherwise
+*/
+
+} // End of namespace Sci
+
+#endif // !_GFX_OPERATIONS_H_

Copied: scummvm/trunk/engines/sci/gfx/gfx_options.h (from rev 38732, scummvm/trunk/engines/sci/include/gfx_options.h)
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_options.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/gfx/gfx_options.h	2009-02-21 19:33:01 UTC (rev 38735)
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+
+#ifndef _GFX_OPTIONS_H_
+#define _GFX_OPTIONS_H_
+
+#include "sci/gfx/gfx_resource.h"
+#include "sci/gfx/gfx_tools.h"
+#include "sci/gfx/gfx_res_options.h"
+
+namespace Sci {
+
+/* Dirty rectangle heuristics: */
+
+/* One: Redraw one rectangle surrounding the dirty area (insert is O(1)) */
+#define GFXOP_DIRTY_FRAMES_ONE 1
+
+/* Clusters: Accumulate dirty rects, merging those that overlap (insert is O(n))  */
+#define GFXOP_DIRTY_FRAMES_CLUSTERS 2
+
+
+typedef struct _gfx_options {
+	/* gfx_options_t: Contains all user options to the rendering pipeline */
+	/* See note in sci_conf.h for config_entry_t before changing types of
+	** variables */
+
+	int buffer_pics_nr; /* Number of unused pics to buffer */
+
+	int correct_rendering; /* Whether to render slow, but correct (rather than
+				** fast and almost correct) */
+
+	/* SCI0 pic resource options */
+	int pic0_unscaled; /* Don't draw scaled SCI0 pics */
+
+	int pic0_dither_mode; /* Defined in gfx_resource.h */
+	int pic0_dither_pattern; /* Defined in gfx_resource.h */
+
+	gfx_brush_mode_t pic0_brush_mode;
+	gfx_line_mode_t pic0_line_mode;
+
+	gfx_xlate_filter_t cursor_xlate_filter;
+	gfx_xlate_filter_t view_xlate_filter;
+	gfx_xlate_filter_t pic_xlate_filter; /* Only relevant if (pic0_unscaled) */
+	gfx_xlate_filter_t text_xlate_filter;
+	gfxr_font_scale_filter_t fixed_font_xlate_filter; /* Scale filter for systems that provide font support which isn't scaled */
+
+	gfxr_antialiasing_t pic0_antialiasing;
+
+	gfx_res_fullconf_t res_conf; /* Resource customisation: Per-resource palettes etc. */
+
+	int dirty_frames;
+
+	int workarounds; /* Workaround flags- see below */
+
+	rect_t pic_port_bounds;
+} gfx_options_t;
+
+/* SQ3 counts whitespaces towards the total text size, as does gfxop_get_text_params() if this is set: */
+#define GFX_WORKAROUND_WHITESPACE_COUNT (1 << 0)
+
+} // End of namespace Sci
+
+#endif // !_GFX_OPTIONS_H_
+

Modified: scummvm/trunk/engines/sci/gfx/gfx_res_options.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_res_options.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/gfx/gfx_res_options.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -23,9 +23,9 @@
  *
  */
 
-#include "sci/include/gfx_system.h"
-#include "sci/include/gfx_options.h"
-#include "sci/include/gfx_resmgr.h"
+#include "sci/gfx/gfx_system.h"
+#include "sci/gfx/gfx_options.h"
+#include "sci/gfx/gfx_resmgr.h"
 
 #include <ctype.h>
 

Copied: scummvm/trunk/engines/sci/gfx/gfx_res_options.h (from rev 38732, scummvm/trunk/engines/sci/include/gfx_res_options.h)
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_res_options.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/gfx/gfx_res_options.h	2009-02-21 19:33:01 UTC (rev 38735)
@@ -0,0 +1,110 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/* Configuration options for per-resource customisations */
+
+#ifndef _GFX_RES_OPTIONS_H_
+#define _GFX_RES_OPTIONS_H_
+
+#include "sci/gfx/gfx_resource.h"
+#include "sci/gfx/gfx_resmgr.h"
+
+namespace Sci {
+
+struct gfx_res_pattern_t {
+	int min, max;
+};
+
+/* GFX resource assignments */
+
+typedef struct {
+	short type; /* GFX_RES_ASSIGN_TYPE_* */
+
+	union {
+		struct {
+			int colors_nr;
+			gfx_pixmap_color_t *colors;
+		} palette;
+	} assign;
+} gfx_res_assign_t;
+
+
+/* GFX resource modifications */
+
+#define GFX_RES_MULTIPLY_FIXED 0 /* Linear palette update */
+
+typedef struct {
+	short type; /* GFX_RES_ASSIGN_TYPE_* */
+
+	union {
+		byte factor[3]; /* divide by 16 to retrieve factor */
+	} mod;
+} gfx_res_mod_t;
+
+
+typedef struct _gfx_res_conf {
+	int type; /* Resource type-- only one allowed */
+
+	/* If any of the following is 0, it means that there is no restriction.
+	** Otherwise, one of the patterns associated with them must match. */
+	int patterns_nr; /* Number of patterns (only 'view' patterns for views) */
+	int loops_nr, cels_nr; /* Number of loop/cel patterns, for views only.
+			       ** For pics, loops_nr identifies the palette. */
+
+	gfx_res_pattern_t *patterns;
+
+	union {
+		gfx_res_assign_t assign;
+		gfx_res_mod_t mod;
+	} conf; /* The actual configuration */
+
+	struct _gfx_res_conf *next;
+} gfx_res_conf_t;
+
+
+typedef gfx_res_conf_t *gfx_res_conf_p_t;
+
+typedef struct {
+	gfx_res_conf_p_t assign[GFX_RESOURCE_TYPES_NR];
+	gfx_res_conf_p_t mod[GFX_RESOURCE_TYPES_NR];
+} gfx_res_fullconf_t;
+
+
+struct _gfx_options;
+
+int gfx_get_res_config(struct _gfx_options *options,
+                   gfx_pixmap_t *pxm);
+/* Configures a graphical pixmap according to config options
+** Parameters: (gfx_options_t *) options: The options according to which
+**                                        configuration should be performed
+**             (gfx_resource_type_t) pxm: The pixmap to configure
+** Returns   : (int) 0 on success, non-zero otherwise
+** Modifies pxm as considered appropriate by configuration options. Does
+** not do anything in colour index mode.
+*/
+
+} // End of namespace Sci
+
+#endif /* !_GFX_RES_OPTIONS_H_ */

Copied: scummvm/trunk/engines/sci/gfx/gfx_resmgr.h (from rev 38732, scummvm/trunk/engines/sci/include/gfx_resmgr.h)
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.h	2009-02-21 19:33:01 UTC (rev 38735)
@@ -0,0 +1,338 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef _GFX_RESMGR_H_
+#define _GFX_RESMGR_H_
+
+// FIXME/TODO: The name "(Graphics) resource manager", and the associated
+// filenames, are misleading. This should be renamed to "Graphics manager"
+// or something like that.
+
+#include "sci/gfx/gfx_resource.h"
+#include "sci/gfx/sbtree.h"
+
+namespace Sci {
+
+typedef enum {
+	GFX_RESOURCE_TYPE_VIEW = 0,
+	GFX_RESOURCE_TYPE_PIC,
+	GFX_RESOURCE_TYPE_FONT,
+	GFX_RESOURCE_TYPE_CURSOR,
+	GFX_RESOURCE_TYPE_PALETTE,
+	/* FIXME: Add PAL resource */
+
+	GFX_RESOURCE_TYPES_NR /* Number of resource types that are to be supported */
+} gfx_resource_type_t;
+
+#define GFX_RESOURCE_TYPE_0 GFX_RESOURCE_TYPE_VIEW
+
+#define GFXR_RES_ID(type, index) ((type) << 16 | (index))
+#define GFXR_RES_TYPE(id) (id >> 16)
+#define GFXR_RES_NR(id) (id & 0xffff)
+
+
+struct gfx_resource_t {
+	int ID; /* Resource ID */
+	int lock_sequence_nr; /* See description of lock_counter in gfx_resstate_t */
+	int mode; /* A mode type hash */
+
+	union {
+		gfx_pixmap_t *pointer;
+		gfxr_view_t *view;
+		gfx_bitmap_font_t *font;
+		gfxr_pic_t *pic;
+	} scaled_data;
+
+	union {
+		gfx_pixmap_t *pointer;
+		gfxr_view_t *view;
+		gfx_bitmap_font_t *font;
+		gfxr_pic_t *pic;
+	} unscaled_data;
+
+};
+
+
+struct _gfx_options;
+
+typedef struct {
+	int version; /* Interpreter version */
+	struct _gfx_options *options;
+	gfx_driver_t *driver;
+	gfx_pixmap_color_t *static_palette;
+	int static_palette_entries;
+	int lock_counter; /* Global lock counter; increased for each new resource allocated.
+			  ** The newly allocated resource will then be assigned the new value
+			  ** of the lock_counter, as will any resources referenced afterwards.
+			  */
+	int tag_lock_counter; /* lock counter value at tag time */
+
+	sbtree_t *resource_trees[GFX_RESOURCE_TYPES_NR];
+	void *misc_payload;
+} gfx_resstate_t;
+
+
+
+gfx_resstate_t *gfxr_new_resource_manager(int version, struct _gfx_options *options,
+                          gfx_driver_t *driver, void *misc_payload);
+/* Allocates and initializes a new resource manager
+** Parameters: (int) version: Interpreter version
+**             (gfx_options_t *): Pointer to all relevant drawing options
+**             (gfx_driver_t *): The graphics driver (needed for capability flags and the mode
+**                               structure)
+**             (void *) misc_payload: Additional information for the interpreter's
+**                      resource loaders
+** Returns   : (gfx_resstate_t *): A newly allocated resource manager
+** The options are considered to be read-only, as they belong to the overlying state object.
+*/
+
+void gfxr_free_resource_manager(gfx_driver_t *driver, gfx_resstate_t *state);
+/* Frees a previously allocated resource manager, and all allocated resources.
+** Parameters: (gfx_driver_t *) driver: The graphics driver; used to free pixmaps that
+**                                      are installed in a driver-specific registry
+**             (gfx_resstate_t *) state: The state manager to free
+** Return    : (void)
+*/
+
+void gfxr_free_all_resources(gfx_driver_t *driver, gfx_resstate_t *state);
+/* Frees all resources currently allocated
+** Parameter: (gfx_driver_t *) driver: The driver to free with
+**            (gfx_resstate_t *) state: The state to do this on
+** Returns  : (void)
+** This function is intended to be used primarily for debugging.
+*/
+
+void gfxr_tag_resources(gfx_resstate_t *state);
+/* 'Tags' all resources for deletion
+** Paramters: (gfx_resstate_t *) state: The resource state to modify
+** Returns  : (void)
+** Tagged resources are untagged if they are referenced.
+*/
+
+void gfxr_free_tagged_resources(gfx_driver_t *driver, gfx_resstate_t *state);
+/* Frees all tagged resources.
+** Parameters: (gfx_driver_t *) driver: The graphics driver the pixmaps are potentially
+**                                      registered in
+**             (gfx_resstate_t *) state: The state to alter
+** Returns   : (void)
+** Resources are tagged by calling gfx_tag_resources(), and untagged by calling the
+** approprate dereferenciation function.
+** Note that this function currently only affects view resources, as pic resources are
+** treated differently, while font and cursor resources are relatively rare.
+*/
+
+
+gfxr_pic_t *gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags,
+             int default_palette, int scaled);
+/* Retreives a displayable (translated) pic resource
+** Parameters: (gfx_resstate_t *) state: The resource state
+**             (int) nr: Number of the pic resource
+**             (int) maps: The maps to translate (ORred GFX_MASK_*)
+**             (int) flags: Interpreter-dependant pic flags
+**             (int) default_palette: The default palette to use for drawing (if applicable)
+**             (int) scaled: Whether to return the scaled maps, or the unscaled
+**                           ones (which may be identical) for some special operations.
+** Returns   : (gfx_pic_t *) The appropriate pic resource with all maps as index (but not
+**                           neccessarily translated) data.
+*/
+
+gfxr_pic_t *gfxr_add_to_pic(gfx_resstate_t *state, int old_nr, int new_nr, int maps, int flags,
+                int old_default_palette, int default_palette, int scaled);
+/* Retreives a displayable (translated) pic resource written ontop of an existing pic
+** Parameters: (gfx_resstate_t *) state: The resource state
+**             (int) old_nr: Number of the pic resource to write on
+**             (int) new_nr: Number of the pic resource that is to be added
+**             (int) maps: The maps to translate (ORred GFX_MASK_*)
+**             (int) flags: Interpreter-dependant pic flags
+**             (int) default_palette: The default palette to use for drawing (if applicable)
+**             (int) scaled: Whether to return the scaled maps, or the unscaled
+**                           ones (which may be identical) for some special operations.
+** Returns   : (gfx_pic_t *) The appropriate pic resource with all maps as index (but not
+**                           neccessarily translated) data.
+** This function invalidates the cached pic pointed to by old_nr in the cache. While subsequent
+** gfxr_add_to_pic() writes will still modify the 'invalidated' pic, gfxr_get_pic() operations will
+** cause it to be removed from the cache and to be replaced by a clean version.
+*/
+
+gfxr_view_t *gfxr_get_view(gfx_resstate_t *state, int nr, int *loop, int *cel, int palette);
+/* Retreives a translated view cel
+** Parameters: (gfx_resstate_t *) state: The resource state
+**             (int) nr: The view number
+**             (int *) loop: Pointer to a variable containing the loop number
+**             (int *) cel: Pointer to a variable containing the cel number
+**	       (int) palette: The palette to use
+** Returns   : (gfx_view_t *) The relevant view, or NULL if nr was invalid
+** loop and cel are given as pointers in order to allow the underlying variables to be
+** modified if they are invalid (this is relevant for SCI version 0, where invalid
+** loop and cel numbers have to be interpreted as 'maximum' or 'minimum' by the interpreter)
+*/
+
+gfx_bitmap_font_t *gfxr_get_font(gfx_resstate_t *state, int nr, int scaled);
+/* Retreives a font
+** Parameters: (gfx_resstate_t *) state: The relevant resource state
+**             (int) nr: The font number
+**             (int) scaled: Whether the font should be font-scaled
+** Returns   : (gfx_font_t *) The appropriate font, or NULL on error
+*/
+
+gfx_pixmap_t *gfxr_get_cursor(gfx_resstate_t *state, int nr);
+/* Retreives an SCI0/SCI01 mouse cursor
+** Parameters: (gfx_resstate_t *) state: The resource state
+**             (int) nr: The cursour number
+** Returns   : (gfx_font_t *) The approprate cursor as a pixmap, or NULL on error
+*/
+
+gfx_pixmap_color_t *gfxr_get_palette(gfx_resstate_t *state, int nr);
+/* Retreives a palette
+** Parameters: (gfx_resstate_t *) state: The resource state
+**             (int) nr: The cursour number
+** Returns   : (gfx_font_t *) The approprate cursor as a pixmap, or NULL on error
+*/
+
+
+/* =========================== */
+/* Interpreter-dependant stuff */
+/* =========================== */
+
+
+int gfxr_interpreter_options_hash(gfx_resource_type_t type, int version,
+                              struct _gfx_options *options, void *internal, int palette);
+/* Calculates a unique hash value for the specified options/type setup
+** Parameters: (gfx_resource_type_t) type: The type the hash is to be generated for
+**             (int) version: The interpreter type and version
+**             (gfx_options_t *) options: The options to hashify
+**             (void *) internal: Internal information provided by the interpreter
+**	       (int) palette: The palette to use (FIXME: should this be here?)
+** Returns   : (int) A hash over the values of the options entries, covering entries iff
+**                   they are relevant for the specified type
+** Covering more entries than relevant may slow down the system when options are changed,
+** while covering less may result in invalid cached data being used.
+** Only positive values may be returned, as negative values are used internally by the generic
+** resource manager code.
+** Also, only the lower 20 bits are available to the interpreter.
+** (Yes, this isn't really a "hash" in the traditional sense...)
+*/
+
+int *gfxr_interpreter_get_resources(gfx_resstate_t *state, gfx_resource_type_t type,
+                               int version, int *entries_nr, void *internal);
+/* Retreives all resources of a specified type that are available from the interpreter
+** Parameters: (gfx_resstate_t *) state: The relevant resource state
+**             (gfx_respirce_type_t) type: The resource type to query
+**             (int) version: The interpreter type and version
+**             (int *) entries_nr: The variable the number of entries will eventually be stored in
+**             (void *) internal: Internal information provided by the interpreter
+** Returns   : (int *) An array of resource numbers
+** Unsupported/non-existing resources should return NULL here; this is equivalent to supported
+** resources of which zero are available.
+** The returned structure (if non-zero) must be freed by the querying code (the resource manager).
+*/
+
+gfxr_pic_t *gfxr_interpreter_init_pic(int version, gfx_mode_t *mode, int ID, void *internal);
+/* Initializes a pic
+** Parameters: (int) version: Interpreter version to use
+**             (gfx_mode_t *) mode: The graphics mode the pic will be using
+**             (int) ID: The ID to assign to the gfxr_pic_t structure
+**             (void *) internal: Internal information provided by the interpreter
+** Returns   : (gfxr_pic_t *) A newly allocated pic
+** This function is typically called befode gfxr_interpreter_clear_pic().
+** Must remember to initialize 'internal' to NULL or a malloc()'d area.
+*/
+
+void gfxr_interpreter_clear_pic(int version, gfxr_pic_t *pic, void *internal);
+/* Clears a previously allocated pic
+** Parameters: (int) version: Interpreter version
+**             (gfxr_pic_t *) pic: The pic to clear
+**             (void *) internal: Internal information provided by the interpreter
+** Returns  :  (void)
+** This function is called in preparation for the pic to be drawn with gfxr_interpreter_calculate_pic.
+*/
+
+int gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
+                               int flags, int default_palette, int nr, void *internal);
+/* Instructs the interpreter-specific code to calculate a picture
+** Parameters: (gfx_resstate_t *) state: The resource state, containing options and version information
+**             (gfxr_pic_t *) scaled_pic: The pic structure that is to be written to
+**             (gfxr_pic_t *) unscaled_pic: The pic structure the unscaled pic is to be written to,
+**                                          or NULL if it isn't needed.
+**             (int) flags: Pic drawing flags (interpreter dependant)
+**             (int) default_palette: The default palette to use for pic drawing (interpreter dependant)
+**             (int) nr: pic resource number
+**             (void *) internal: Internal information provided by the interpreter
+** Returns   : (int) GFX_ERROR if the resource could not be found, GFX_OK otherwise
+*/
+
+gfxr_view_t *gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, void *internal, int palette);
+/* Instructs the interpreter-specific code to calculate a view
+** Parameters: (gfx_resstate_t *) state: The resource manager state
+**             (int) nr: The view resource number
+**             (void *) internal: Internal information provided by the interpreter
+** Returns   : (gfx_view_t *) The appropriate view, or NULL on error
+*/
+
+gfx_bitmap_font_t *gfxr_interpreter_get_font(gfx_resstate_t *state, int nr, void *internal);
+/* Instructs the interpreter-specific code to calculate a font
+** Parameters: (gfx_resstate_t *) state: The resource manager state
+**             (int) nr: The font resource number
+**             (void *) internal: Internal information provided by the interpreter
+** Returns   : (gfx_font_t *) The newly calculated font, or NULL on error
+*/
+
+gfx_pixmap_t *gfxr_interpreter_get_cursor(gfx_resstate_t *state, int nr, void *internal);
+/* Instructs the interpreter-specific code to calculate a cursor
+** Paramaters: (gfx_resstate_t *) state: The resource manager state
+**             (int nr): The cursor resource number
+**             (void *) internal: Internal information provided by the interpreter
+** Returns   : (gfx_pixmap_t *) The cursor pixmap, or NULL on error
+*/
+
+gfx_pixmap_color_t *gfxr_interpreter_get_static_palette(gfx_resstate_t *state, int version, int *colors_nr, void *internal);
+/* Retreives the static palette from the interpreter-specific code
+** Parameters: (int) version: Interpreter version to use
+**             (int *) colors_nr: Number of colors to use
+**             (void *) internal: Internal information provided by the interpreter
+** Returns   : (gfx_pixmap_color_t *) *colors_nr static color entries
+**             if a static palette must be used, NULL otherwise
+*/
+
+gfx_pixmap_color_t *gfxr_interpreter_get_palette(gfx_resstate_t *state, int version, int *colors_nr, void *internal, int nr);
+/* Retreives the static palette from the interpreter-specific code
+** Parameters: (int) version: Interpreter version to use
+**             (int *) colors_nr: Number of colors to use
+**             (void *) internal: Internal information provided by the interpreter
+** Returns   : (gfx_pixmap_color_t *) *colors_nr static color entries
+**             if a static palette must be used, NULL otherwise
+*/
+
+int gfxr_interpreter_needs_multicolored_pointers(int version, void *internal);
+/* Determines whether support for pointers with more than two colors is required
+** Parameters: (int) version: Interpreter version to test for
+**             (void *) internal: Internal information provided by the interpreter
+** Returns   : (int) 0 if no support for multi-colored pointers is required, non-0
+**                   otherwise
+*/
+
+} // End of namespace Sci
+
+#endif /* !_GFX_RSMGR_H_ */

Modified: scummvm/trunk/engines/sci/gfx/gfx_resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resource.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/gfx/gfx_resource.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -23,9 +23,9 @@
  *
  */
 
-#include "sci/include/gfx_system.h"
-#include "sci/include/gfx_resource.h"
-#include "sci/include/gfx_tools.h"
+#include "sci/gfx/gfx_system.h"
+#include "sci/gfx/gfx_resource.h"
+#include "sci/gfx/gfx_tools.h"
 
 namespace Sci {
 

Copied: scummvm/trunk/engines/sci/gfx/gfx_resource.h (from rev 38732, scummvm/trunk/engines/sci/include/gfx_resource.h)
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resource.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/gfx/gfx_resource.h	2009-02-21 19:33:01 UTC (rev 38735)
@@ -0,0 +1,414 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/* SCI Resource library */
+
+#ifndef _GFX_RESOURCE_H_
+#define _GFX_RESOURCE_H_
+
+#include "sci/gfx/gfx_system.h"
+#include "sci/gfx/gfx_driver.h"
+
+namespace Sci {
+
+/*** Styles for pic0 drawing ***/
+/* Dithering modes */
+#define GFXR_DITHER_MODE_D16 0  /* Sierra SCI style */
+#define GFXR_DITHER_MODE_F256 1 /* Flat color interpolation */
+#define GFXR_DITHER_MODE_D256 2 /* 256 color dithering */
+/* Dithering patterns */
+#define GFXR_DITHER_PATTERN_SCALED 0 /* Dither per pixel on the 320x200 grid */
+#define GFXR_DITHER_PATTERN_1 1      /* Dither per pixel on the target */
+
+#define SCI_TITLEBAR_SIZE 10
+
+#define DRAWPIC01_FLAG_FILL_NORMALLY 1
+#define DRAWPIC01_FLAG_OVERLAID_PIC 2
+
+#define GFXR_AUX_MAP_SIZE (320*200)
+
+
+#define GFX_SCI0_IMAGE_COLORS_NR 16
+#define GFX_SCI0_PIC_COLORS_NR 256
+
+#define GFX_SCI1_AMIGA_COLORS_NR 32
+
+extern int sci0_palette;
+
+/* (gfx_pic_0.c) The 16 EGA base colors */
+extern gfx_pixmap_color_t gfx_sci0_image_colors[][16];
+
+/* (gfx_pic_0.c) The 256 interpolated colors (initialized when
+** gfxr_init_pic() is called for the first time, or when gfxr_init_static_palette() is called)
+*/
+extern gfx_pixmap_color_t gfx_sci0_pic_colors[];
+
+
+typedef struct {
+	gfx_line_mode_t line_mode; /* one of GFX_LINE_MODE_* */
+	gfx_brush_mode_t brush_mode;
+	rect_t pic_port_bounds;
+} gfxr_pic0_params_t;
+
+typedef struct {
+	int ID; /* pic number (NOT resource ID, just number) */
+	gfx_mode_t *mode;
+	gfx_pixmap_t *visual_map;
+	gfx_pixmap_t *priority_map;
+	gfx_pixmap_t *control_map;
+
+	byte aux_map[GFXR_AUX_MAP_SIZE];
+
+	/* Auxiliary map details:
+	** Bit 0: Vis
+	** Bit 1: Pri
+	** Bit 2: Ctrl
+	** Bit 3-5: 'filled' (all three bits are set to 1)
+	*/
+
+	rect_t bounds;
+
+	void *undithered_buffer; /* copies visual_map->index_data before dithering */
+	int undithered_buffer_size;
+
+	void *internal; /* Interpreter information, or NULL. Will be freed
+			** automatically when the pic is freed!  */
+
+} gfxr_pic_t;
+
+
+typedef struct {
+	int cels_nr;
+	gfx_pixmap_t **cels;
+} gfxr_loop_t;
+
+
+typedef struct {
+	int ID;
+
+	int flags;
+	int colors_nr;
+	gfx_pixmap_color_t *colors;
+
+	int loops_nr;
+	gfxr_loop_t *loops;
+
+	int translation[GFX_SCI0_IMAGE_COLORS_NR];
+} gfxr_view_t;
+
+
+typedef enum {
+	GFXR_FONT_SCALE_FILTER_NONE
+} gfxr_font_scale_filter_t;
+
+
+typedef struct {
+	const char *offset;
+	int length;
+} text_fragment_t;
+
+/* unscaled color index mode: Used in addition to a scaled mode
+** to render the pic resource twice. See gfxr_remove_artifacts_pic0().
+*/
+extern gfx_mode_t mode_1x1_color_index;
+
+void gfxr_init_static_palette();
+/* Initializes the static 256 color palette
+** Parameters: (void)
+** Returns   : (void)
+*/
+
+gfxr_pic_t *gfxr_init_pic(gfx_mode_t *mode, int ID, int sci1);
+/* Initializes a gfxr_pic_t for a specific mode
+** Parameters: (gfx_mode_t *) mode: The specific graphics mode
+**             (int) ID: The ID to assign to the resulting pixmaps
+** Returns   : (gfxr_pic_t *) The allocated pic resource, or NULL on error.
+** This function allocates memory for use by resource drawer functions.
+*/
+
+void gfxr_free_pic(gfx_driver_t *driver, gfxr_pic_t *pic);
+/* Uninitializes a pic resource
+** Parameters: (gfx_driver_t *) driver: The driver the pic should be removed from
+**             (gfxr_pic_t *) pic: The pic to free
+** Returns   : (void)
+*/
+
+void gfxr_free_view(gfx_driver_t *driver, gfxr_view_t *view);
+/* Frees all memory associated with a view
+** Paremeters: (gfx_driver_t *) driver: The driver the view should be removed from
+**             (gfxr_view_t *) view: The view to free
+** Returns   : (void)
+*/
+
+
+/*******************/
+/* Font operations */
+/*******************/
+/* SCI0, SCI01 and SCI1 all use the same font format. */
+
+/* SQ3 uses a somewhat different scheme for calculating text sizes: it counts
+** whitespace while calculating the text size.  */
+#define GFXR_FONT_FLAG_COUNT_WHITESPACE (1<<0)
+/* Don't give newline characters special semantics */
+#define GFXR_FONT_FLAG_NO_NEWLINES (1<<1)
+/* Interpret CR LF sequences as a single newline, rather than two of them */
+#define GFXR_FONT_FLAG_EAT_TRAILING_LF (1<<2)
+
+
+gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size);
+/* Geneartes a bitmap font data structure from a resource
+** Parameters: (int) id: Resource ID of the resulting font
+**             (byte *) resource: Pointer to the resource data
+**             (int) size: Size of the resource block
+** Returns   : (gfx_bitmap_font_t *) The resulting font structure, or
+**                                   NULL on error
+*/
+
+void gfxr_free_font(gfx_bitmap_font_t *font);
+/* Frees a previously allocated font structure
+** Parameters: (gfx_bitmap_font_t *) font: The font to free
+** Returns   : (void)
+*/
+
+gfx_bitmap_font_t *gfxr_scale_font(gfx_bitmap_font_t *font, gfx_mode_t *mode, gfxr_font_scale_filter_t filter);
+/* Scales a font resource
+** Parameters: (gfx_bitmap_font_t *) font: The font to scale
+**             (gfx_mode_t *) mode: The graphics mode to scale it for
+**             (gfxr_font_scale_filter_t) filter: A filter to use
+** Returns   : (gfx_bitmap_font_t *) A scaled font, or NULL on error
+*/
+
+text_fragment_t *gfxr_font_calculate_size(gfx_bitmap_font_t *font, int max_width, const char *text,
+                         int *width, int *height,
+                         int *lines, int *line_height, int *last_offset,
+                         int flags);
+/* Calculates the size that would be occupied by drawing a specified text
+** Parameters: (gfx_bitmap_font_t *) font: The font to calculate with
+**             (int) max_width: Maximum pixel width allowed for the output
+**             (const char *) text: The text to calculate for
+**             (int) flags: Any text formatting flags
+** Returns   : (text_fragment *) a newly allocated array of text_fragments,
+**                               containing the start and size of each string
+**                               segment
+**             (int) *width: The resulting width
+**             (int) *height: The resulting height
+**             (int) *lines: Number of lines used
+**             (int) *line_height: Pixel height of a single line of text
+**             (int) *last_offset: Pixel offset after the last drawn line
+** This function assumes 320x200 mode.
+*/
+
+gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *text, int characters,
+               gfx_pixmap_color_t *fg0, gfx_pixmap_color_t *fg1, gfx_pixmap_color_t *bg);
+/* Draws text in a specific font to a pixmap
+** Parameters: (gfx_bitmap_font_t *) font: The font to use for drawing
+**             (char *) text: The start of the text to draw
+**             (int) characters: The number of characters to draw
+**             (gfx_pixmap_color_t *) fg0: The first foreground color
+**             (gfx_pixmap_color_t *) fg1: The second foreground color
+**             (gfx_pixmap_color_t *) bg: The background color
+** Returns   : (gfx_pixmap_t *) The result pixmap, or NULL on error
+** The results are written to the pixmap's index buffer. Contents of the
+** foreground and background fields are copied into a newly allocated font
+** structure, so that the pixmap may be translated directly.
+** If any of the colors is null, it will be assumed to be transparent.
+** In color index mode, the specified colors have to be preallocated.
+*/
+
+
+/*********************/
+/*  SCI0 operations  */
+/*********************/
+
+
+void gfxr_clear_pic0(gfxr_pic_t *pic, int sci_titlebar_size);
+/* Clears all pic buffers of one pic
+** Parameters: (gfxr_pic_t) pic: The picture to clear
+**             (int) sci_titlebar_size: How much space to reserve for the title bar
+** Returns   : (void)
+** This function should be called before gfxr_draw_pic0, unless cumulative
+** drawing is intended
+*/
+
+
+void gfxr_draw_pic01(gfxr_pic_t *pic, int fill_normally, int default_palette,
+                int size, byte *resource, gfxr_pic0_params_t *style, int resid, int sci1,
+                gfx_pixmap_color_t *static_pal, int static_pal_nr);
+/* Draws a pic resource (all formats prior to SCI1.1)
+** Parameters: (gfxr_pic_t *) pic: The pic to draw to
+**             (int) fill_normally: If 1, the pic is drawn normally; if 0, all
+**                                  fill operations will fill with black
+**             (int) default_palette: The default palette to use for drawing
+**             (int) size: Resource size
+**             (byte *) resource: Pointer to the resource data
+**             (gfxr_pic0_params_t *) style: The drawing style
+**             (int) resid: The resource ID
+**             (int) sci1: Nonzero if SCI1
+**             (gfx_pixmap_color_t *) static_pal: The static palette
+**             (int) static_pal_nr: Number of entries in static palette
+** Returns   : (void)
+** The result is stored in gfxr_visual_map, gfxr_priority_map, and gfxr_control_map.
+** The palette entry of gfxr_visual_map is never used.
+** Note that the picture will not be drawn dithered; use gfxr_dither_pic0 for that.
+*/
+
+void gfxr_draw_pic11(gfxr_pic_t *pic, int fill_normally, int default_palette,
+                int size, byte *resource, gfxr_pic0_params_t *style, int resid,
+                gfx_pixmap_color_t *static_pal, int static_pal_nr);
+/* Draws a pic resource (SCI1.1)
+** Parameters: (gfxr_pic_t *) pic: The pic to draw to
+**             (int) fill_normally: If 1, the pic is drawn normally; if 0, all
+**                                  fill operations will fill with black
+**             (int) default_palette: The default palette to use for drawing
+**             (int) size: Resource size
+**             (byte *) resource: Pointer to the resource data
+**             (gfxr_pic0_params_t *) style: The drawing style
+**             (int) resid: The resource ID
+**             (gfx_pixmap_color_t *) static_pal: The static palette
+**             (int) static_pal_nr: Number of entries in static palette
+** Returns   : (void)
+** The result is stored in gfxr_visual_map, gfxr_priority_map, and gfxr_control_map.
+** The palette entry of gfxr_visual_map is never used.
+** Note that the picture will not be drawn dithered; use gfxr_dither_pic0 for that.
+*/
+
+void gfxr_remove_artifacts_pic0(gfxr_pic_t *dest, gfxr_pic_t *src);
+/* Removes artifacts from a scaled pic
+** Parameters: (gfxr_pic_t *) dest: The scaled pic
+**             (gfxr_pic_t *) src: An unscaled pic
+** Returns   : (void)
+** Using information from the (correctly rendered) src pic, this function implements
+** some heuristics to remove artifacts from dest. Must be used before dither_pic0 is
+** called, because it operates on the index buffer.
+*/
+
+void gfxr_dither_pic0(gfxr_pic_t *pic, int mode, int pattern);
+/* Dithers a gfxr_visual_map
+** Parameters: (gfxr_pic_t *) pic: The pic to dither
+**             (int) mode: One of GFXR_DITHER_MODE
+**             (int) pattern: One of GFXR_DITHER_PATTERN
+** Returns   : (void)
+*/
+
+gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette);
+/* Calculates an SCI0 view
+** Parameters: (int) id: Resource ID of the view
+**             (byte *) resource: Pointer to the resource to read
+**             (int) size: Size of the resource
+**	       (int) palette: The palette to use
+** Returns   : (gfxr_view_t *) The resulting view
+*/
+
+gfx_pixmap_t *gfxr_draw_cursor0(int id, byte *resource, int size);
+/* Calculates an SCI0 cursor
+** Parameters: (int) id: The cursor's resource ID
+**             (byte *) resource: Pointer to the resource data
+**             (int) size: Resource size
+** Returns   : (gfx_pixmap_t *) A newly allocated pixmap storing the cursor
+*/
+
+/**********************/
+/*  SCI01 operations  */
+/**********************/
+
+gfx_pixmap_t *gfxr_draw_cursor01(int id, byte *resource, int size);
+/* Calculates an SCI01 cursor
+** Parameters: (int) id: The cursor's resource ID
+**             (byte *) resource: Pointer to the resource data
+**             (int) size: Resource size
+** Returns   : (gfx_pixmap_t *) A newly allocated pixmap containing an index
+**                               color representation of the cursor
+*/
+
+
+/*********************/
+/*  SCI1 operations  */
+/*********************/
+
+gfx_pixmap_color_t *gfxr_read_pal1(int id, int *colors_nr, byte *resource, int size);
+/* Reads an SCI1 palette
+** Parameters: (int) id: Resource ID for the palette (or the view it was found in)
+**             (int *) colors_nr: Pointer to the variable the number of colors
+**                                will be stored in
+**             (byte *) resource: Source data
+**             (int) size: Size of the memory block pointed to by resource
+** Returns   : (gfx_pixmap_color_t *) *colors_nr color_t entries with the colors
+*/
+
+gfx_pixmap_color_t *gfxr_read_pal1_amiga(int *colors_nr, FILE *f);
+/* Reads an SCI1 palette
+** Parameters: (int *) colors_nr: Pointer to the variable the number of colors
+**                                will be stored in
+**             (FILE *) f: Palette file
+** Returns   : (gfx_pixmap_color_t *) *colors_nr color_t entries with the colors
+*/
+
+gfx_pixmap_color_t *gfxr_read_pal11(int id, int *colors_nr, byte *resource, int size);
+/* Reads an SCI1.1 palette
+** Parameters: (int) id: Resource ID for the palette (or the view it was found in)
+**             (int *) colors_nr: Pointer to the variable the number of colors
+**                                will be stored in
+**             (byte *) resource: Source data
+**             (int) size: Size of the memory block pointed to by resource
+** Returns   : (gfx_pixmap_color_t *) *colors_nr color_t entries with the colors
+*/
+
+gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, gfx_pixmap_color_t *static_pal,
+                int static_pal_nr);
+/* Calculates an SCI1 view
+** Parameters: (int) id: Resource ID of the view
+**             (byte *) resource: Pointer to the resource to read
+**             (int) size: Size of the resource
+**             (gfx_pixmap_color_t *) static_pal: The static palette
+**             (int) static_pal_nr: Number of entries in static palette
+** Returns   : (gfxr_view_t *) The resulting view
+*/
+
+gfx_pixmap_t *gfxr_draw_cel11(int id, int loop, int cel, int mirrored, byte *resource_base, byte *cel_base, int size, gfxr_view_t *view);
+
+
+gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode);
+/* Endianness-adjusts a pixmap, if neccessary
+** Parameters: (gfx_pixmap_t *) pixmap: The pixmap to adjust
+**             (gfx_mode_t *) mode: The mode to adjust it for
+** Returns   : (gfx_pixmap_t *) pixmap, or NULL on error
+** The pixmap is adjusted iff the mode signals that this is
+** required (by means of setting the appropriate flag), and
+** the mode has a byte depth of more than 1.
+*/
+
+
+static inline int get_uint_16(const byte *offset) {
+	return ((unsigned int) offset[0] | (((unsigned int) offset[1]) << 8));
+}
+
+static inline int get_int_16(const byte *offset) {
+	return ((int) offset[0] | (((int) offset[1]) << 8));
+}
+
+} // End of namespace Sci
+
+#endif /* !_GFX_RESOURCE_H_ */
+

Copied: scummvm/trunk/engines/sci/gfx/gfx_state_internal.h (from rev 38732, scummvm/trunk/engines/sci/include/gfx_state_internal.h)
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_state_internal.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/gfx/gfx_state_internal.h	2009-02-21 19:33:01 UTC (rev 38735)
@@ -0,0 +1,239 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef _GFX_STATE_INTERNAL_H_
+#define _GFX_STATE_INTERNAL_H_
+
+#include "sci/gfx/gfx_tools.h"
+#include "sci/gfx/gfx_options.h"
+#include "sci/gfx/gfx_operations.h"
+#include "sci/gfx/gfx_resmgr.h"
+#include "sci/gfx/gfx_system.h"
+
+namespace Sci {
+
+#define GFXW_FLAG_VISIBLE (1<<0)
+#define GFXW_FLAG_OPAQUE (1<<1)
+#define GFXW_FLAG_CONTAINER (1<<2)
+#define GFXW_FLAG_DIRTY (1<<3)
+#define GFXW_FLAG_TAGGED (1<<4)
+#define GFXW_FLAG_MULTI_ID (1<<5) /* Means that the ID used herein may be used more than once, i.e. is not unique */
+#define GFXW_FLAG_IMMUNE_TO_SNAPSHOTS (1<<6) /* Snapshot restoring doesn't kill this widget, and +5 bonus to saving throws vs. Death Magic */
+#define GFXW_FLAG_NO_IMPLICIT_SWITCH (1<<7) /* Ports: Don't implicitly switch to this port when disposing windows */
+
+typedef struct {
+	int serial; /* The first serial number to kill */
+	rect_t area;
+} gfxw_snapshot_t;
+
+typedef enum {
+	GFXW_, /* Base widget */
+
+	GFXW_BOX,
+	GFXW_RECT,
+	GFXW_LINE, /* For lines, the bounding rectangle's xl, yl determine the line's expansion:
+		   ** (x2, y2) = (x+xl, y+yl) */
+	GFXW_INVERSE_LINE,
+	GFXW_VIEW,
+	GFXW_STATIC_VIEW,
+	GFXW_DYN_VIEW,
+	GFXW_PIC_VIEW,
+	GFXW_TEXT,
+
+	GFXW_CONTAINER,
+
+	GFXW_LIST,
+	GFXW_SORTED_LIST,
+	GFXW_VISUAL,
+	GFXW_PORT
+
+} gfxw_widget_type_t;
+
+
+#define GFXW_MAGIC_VALID 0xC001
+#define GFXW_MAGIC_INVALID 0xbad
+
+#define GFXW_NO_ID -1
+
+struct _gfxw_widget;
+struct _gfxw_container_widget;
+struct _gfxw_visual;
+
+typedef int gfxw_point_op(struct _gfxw_widget *, Common::Point);
+typedef int gfxw_visual_op(struct _gfxw_widget *, struct _gfxw_visual *);
+typedef int gfxw_op(struct _gfxw_widget *);
+typedef int gfxw_op_int(struct _gfxw_widget *, int);
+typedef int gfxw_bin_op(struct _gfxw_widget *, struct _gfxw_widget *);
+
+#define WIDGET_COMMON \
+   int magic; /* Extra check after typecasting */ \
+   int serial; /* Serial number */ \
+   int flags; /* Widget flags */ \
+   gfxw_widget_type_t type; \
+   rect_t bounds; /* Boundaries */ \
+   struct _gfxw_widget *next; /* Next widget in widget list */ \
+   int ID; /* Unique ID or GFXW_NO_ID */ \
+   int subID; /* A 'sub-ID', or GFXW_NO_ID */ \
+   struct _gfxw_container_widget *parent; /* The parent widget, or NULL if not owned */ \
+   struct _gfxw_visual *visual; /* The owner visual */ \
+   int widget_priority; /* Drawing priority, or -1 */ \
+   gfxw_point_op *draw; /* Draw widget (if dirty) and anything else required for the display to be consistant */ \
+   gfxw_op *widfree; /* Remove widget (and any sub-widgets it may contain) */ \
+   gfxw_op *tag; /* Tag the specified widget */ \
+   gfxw_op_int *print; /* Prints the widget's contents, using sciprintf. Second parameter is indentation. */ \
+   gfxw_bin_op *compare_to; /* a.compare_to(a, b) returns <0 if a<b, =0 if a=b and >0 if a>b */ \
+   gfxw_bin_op *equals; /* a equals b if both cause the same data to be displayed */ \
+   gfxw_bin_op *should_replace; /* (only if a equals b) Whether b should replace a even though they are equivalent */ \
+   gfxw_bin_op *superarea_of; /* a superarea_of b <=> for each pixel of b there exists an opaque pixel in a at the same location */ \
+   gfxw_visual_op *set_visual /* Sets the visual the widget belongs to */
+
+typedef struct _gfxw_widget {
+	WIDGET_COMMON;
+} gfxw_widget_t;
+
+
+#define GFXW_IS_BOX(widget) ((widget)->type == GFXW_BOX)
+typedef struct {
+	WIDGET_COMMON;
+	gfx_color_t color1, color2;
+	gfx_box_shade_t shade_type;
+} gfxw_box_t;
+
+
+#define GFXW_IS_PRIMITIVE(widget) ((widget)->type == GFXW_RECT || (widget)->type == GFXW_LINE || (widget->type == GFXW_INVERSE_LINE))
+typedef struct {
+	WIDGET_COMMON;
+	gfx_color_t color;
+	gfx_line_mode_t line_mode;
+	gfx_line_style_t line_style;
+} gfxw_primitive_t;
+
+
+
+#define VIEW_COMMON \
+	WIDGET_COMMON; \
+	Common::Point pos; /* Implies the value of 'bounds' in WIDGET_COMMON */ \
+	gfx_color_t color; \
+	int view, loop, cel; \
+	int palette
+
+#define GFXW_IS_VIEW(widget) ((widget)->type == GFXW_VIEW || (widget)->type == GFXW_STATIC_VIEW \
+			      || (widget)->type == GFXW_DYN_VIEW || (widget)->type == GFXW_PIC_VIEW)
+typedef struct {
+	VIEW_COMMON;
+} gfxw_view_t;
+
+#define GFXW_IS_DYN_VIEW(widget) ((widget)->type == GFXW_DYN_VIEW || (widget)->type == GFXW_PIC_VIEW)
+typedef struct {
+	VIEW_COMMON;
+	/* fixme: This code is specific to SCI */
+	rect_t draw_bounds; /* The correct position to draw to */
+	void *under_bitsp, *signalp;
+	int under_bits, signal;
+	int z; /* The z coordinate: Added to y, but used for sorting */
+	int sequence; /* Sequence number: For sorting */
+	int force_precedence; /* Precedence enforcement variable for sorting- defaults to 0 */
+} gfxw_dyn_view_t;
+
+
+
+#define GFXW_IS_TEXT(widget) ((widget)->type == GFXW_TEXT)
+typedef struct {
+	WIDGET_COMMON;
+	int font_nr;
+	int lines_nr, lineheight, lastline_width;
+	char *text;
+	gfx_alignment_t halign, valign;
+	gfx_color_t color1, color2, bgcolor;
+	int text_flags;
+	int width, height; /* Real text width and height */
+	gfx_text_handle_t *text_handle;
+} gfxw_text_t;
+
+
+/* Container widgets */
+
+typedef int gfxw_unary_container_op(struct _gfxw_container_widget *);
+typedef int gfxw_container_op(struct _gfxw_container_widget *, gfxw_widget_t *);
+typedef int gfxw_rect_op(struct _gfxw_container_widget *, rect_t, int);
+
+#define WIDGET_CONTAINER \
+   WIDGET_COMMON; \
+   rect_t zone; /* The writeable zone (absolute) for contained objects */ \
+   gfx_dirty_rect_t *dirty; /* List of dirty rectangles */ \
+   gfxw_widget_t *contents; \
+   gfxw_widget_t **nextpp; /* Pointer to the 'next' pointer in the last entry in contents */ \
+   gfxw_unary_container_op *free_tagged; /* Free all tagged contained widgets */ \
+   gfxw_unary_container_op *free_contents; /* Free all contained widgets */ \
+   gfxw_rect_op *add_dirty_abs; /* Add an absolute dirty rectangle */ \
+   gfxw_rect_op *add_dirty_rel; /* Add a relative dirty rectangle */ \
+   gfxw_container_op *add  /* Append widget to an appropriate position (for view and control lists) */
+
+
+typedef struct _gfxw_container_widget {
+	WIDGET_CONTAINER;
+} gfxw_container_t;
+
+
+#define GFXW_IS_CONTAINER(widget) ((widget)->type == GFXW_PORT || (widget)->type == GFXW_VISUAL || \
+				   (widget)->type == GFXW_SORTED_LIST || (widget)->type == GFXW_LIST)
+
+#define GFXW_IS_LIST(widget) ((widget)->type == GFXW_LIST || (widget)->type == GFXW_SORTED_LIST)
+#define GFXW_IS_SORTED_LIST(widget) ((widget)->type == GFXW_SORTED_LIST)
+typedef gfxw_container_t gfxw_list_t;
+
+#define GFXW_IS_VISUAL(widget) ((widget)->type == GFXW_VISUAL)
+typedef struct _gfxw_visual {
+	WIDGET_CONTAINER;
+	struct _gfxw_port **port_refs; /* References to ports */
+	int port_refs_nr;
+	int font_nr; /* Default font */
+	gfx_state_t *gfx_state;
+}  gfxw_visual_t;
+
+#define GFXW_IS_PORT(widget) ((widget)->type == GFXW_PORT)
+typedef struct _gfxw_port {
+	WIDGET_CONTAINER;
+
+	gfxw_list_t *decorations; /* optional window decorations- drawn before the contents */
+	gfxw_widget_t *port_bg; /* Port background widget or NULL */
+	gfx_color_t color, bgcolor;
+	int chrono_port;
+	int font_nr;
+	Common::Point draw_pos; /* Drawing position */
+	gfxw_snapshot_t *restore_snap; /* Snapshot to be restored automagically,
+					  experimental feature used in the PQ3 interpreter */
+	int port_flags; /* interpreter-dependant flags */
+	const char *title_text;
+	byte gray_text; /* Whether text is 'grayed out' (dithered) */
+} gfxw_port_t;
+
+#undef WIDGET_COMMON
+#undef WIDGET_CONTAINER
+
+} // End of namespace Sci
+
+#endif /* !_GFX_STATE_INTERNAL_H_ */
+

Modified: scummvm/trunk/engines/sci/gfx/gfx_support.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-02-21 19:28:06 UTC (rev 38734)
+++ scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-02-21 19:33:01 UTC (rev 38735)
@@ -27,8 +27,8 @@
 ** for use with the graphical state manager
 */
 
-#include "sci/include/gfx_system.h"
-#include "sci/include/gfx_tools.h"
+#include "sci/gfx/gfx_system.h"
+#include "sci/gfx/gfx_tools.h"
 
 #define DRAWLINE_FUNC _gfx_draw_line_buffer_1
 #define PIXELWIDTH 1

Copied: scummvm/trunk/engines/sci/gfx/gfx_system.h (from rev 38732, scummvm/trunk/engines/sci/include/gfx_system.h)
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_system.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/gfx/gfx_system.h	2009-02-21 19:33:01 UTC (rev 38735)
@@ -0,0 +1,395 @@

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list