[Scummvm-cvs-logs] SF.net SVN: scummvm:[35631] scummvm/trunk/gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Dec 31 15:10:24 CET 2008


Revision: 35631
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35631&view=rev
Author:   fingolfin
Date:     2008-12-31 14:10:23 +0000 (Wed, 31 Dec 2008)

Log Message:
-----------
ThemeEngine changes:
* removed lots of dead code / methods
* fixed bad Doxygen comments (they were attached to the wrong member variables)
* some cleanup

Modified Paths:
--------------
    scummvm/trunk/gui/ThemeEngine.cpp
    scummvm/trunk/gui/ThemeEngine.h

Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp	2008-12-31 13:59:00 UTC (rev 35630)
+++ scummvm/trunk/gui/ThemeEngine.cpp	2008-12-31 14:10:23 UTC (rev 35631)
@@ -76,9 +76,7 @@
 }
 
 ThemeEngine::~ThemeEngine() {
-	freeRenderer();
-	freeScreen();
-	freeBackbuffer();
+	deinit();
 	unloadTheme();
 	delete _parser;
 	delete _themeEval;
@@ -86,6 +84,8 @@
 
 	for (ImagesMap::iterator i = _bitmaps.begin(); i != _bitmaps.end(); ++i)
 		ImageMan.unregisterSurface(i->_key);
+
+	ImageMan.removeArchive(_themeFileName);
 }
 
 
@@ -139,13 +139,14 @@
  *********************************************************/
 bool ThemeEngine::init() {
 	// reset everything and reload the graphics
+	if (_initOk)
+		_system->hideOverlay();
 	deinit();
 	setGraphicsMode(_graphicsMode);
 
 	if (_screen->pixels && _backBuffer->pixels) {
 		_initOk = true;
 		clearAll();
-		resetDrawArea();
 	}
 
 	if (_screen->w >= 400 && _screen->h >= 300) {
@@ -162,37 +163,21 @@
 }
 
 void ThemeEngine::deinit() {
-	if (_initOk) {
-		_system->hideOverlay();
-		freeRenderer();
-		freeScreen();
-		freeBackbuffer();
-		_initOk = false;
-	}
-}
-
-void ThemeEngine::freeRenderer() {
 	delete _vectorRenderer;
 	_vectorRenderer = 0;
-}
-
-void ThemeEngine::freeBackbuffer() {
+	if (_screen != 0) {
+		_screen->free();
+		delete _screen;
+		_screen = 0;
+	}
 	if (_backBuffer != 0) {
 		_backBuffer->free();
 		delete _backBuffer;
 		_backBuffer = 0;
 	}
+	_initOk = false;
 }
 
-void ThemeEngine::freeScreen() {
-	if (_screen != 0) {
-		_screen->free();
-		delete _screen;
-		_screen = 0;
-	}
-}
-
-
 void ThemeEngine::unloadTheme() {
 	if (!_themeOk)
 		return;
@@ -238,7 +223,6 @@
 
 void ThemeEngine::enable() {
 	init();
-	resetDrawArea();
 
 	if (_useCursor)
 		setUpCursor();
@@ -265,13 +249,18 @@
 	uint32 height = _system->getOverlayHeight();
 
 	if (backBuffer) {
-		freeBackbuffer();
-		_backBuffer = new Graphics::Surface;
+		if (_backBuffer)
+			_backBuffer->free();
+		else
+			_backBuffer = new Graphics::Surface;
 		_backBuffer->create(width, height, sizeof(PixelType));
 	}
 
-	freeScreen();
-	_screen = new Graphics::Surface;
+
+	if (_screen)
+		_screen->free();
+	else
+		_screen = new Graphics::Surface;
 	_screen->create(width, height, sizeof(PixelType));
 	_system->clearOverlay();
 }
@@ -290,7 +279,7 @@
 		error("Invalid graphics mode");
 	}
 
-	freeRenderer();
+	delete _vectorRenderer;
 	_vectorRenderer = Graphics::createRenderer(mode);
 	_vectorRenderer->setSurface(_screen);
 }
@@ -513,9 +502,6 @@
 
 #endif
 	} else if (node.isDirectory()) {
-
-//		FIXME: This warning makes no sense whatsoever. Who added this?
-//		warning("Don't know how to open theme '%s'", themeName.c_str());
 		archive = new Common::FSDirectory(node);
 	}
 
@@ -1073,7 +1059,7 @@
 
 const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &filename) {
 	Common::Archive *arch = 0;
-	const Graphics::NewFont *font = 0;
+	const Graphics::Font *font = 0;
 
 	Common::FSNode node(getThemeFileName());
 

Modified: scummvm/trunk/gui/ThemeEngine.h
===================================================================
--- scummvm/trunk/gui/ThemeEngine.h	2008-12-31 13:59:00 UTC (rev 35630)
+++ scummvm/trunk/gui/ThemeEngine.h	2008-12-31 14:10:23 UTC (rev 35631)
@@ -113,12 +113,14 @@
 	 * Default values for each DrawData item.
 	 * @see kDrawDataDefaults[] for implementation.
 	 */
-	static const struct DrawDataInfo {
-		DrawData id;		/** The actual ID of the DrawData item. */
-		const char *name;	/** The name of the DrawData item as it appears in the Theme Description files */
-		bool buffer;		/** Sets whether this item is buffered on the backbuffer or drawn directly to the screen. */
-		DrawData parent;	/** Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover */
-	} kDrawDataDefaults[];
+	struct DrawDataInfo {
+		DrawData id;		//!< The actual ID of the DrawData item.
+		const char *name;	//!< The name of the DrawData item as it appears in the Theme Description files
+		bool buffer;		//!< Sets whether this item is buffered on the backbuffer or drawn directly to the screen.
+		DrawData parent;	//!< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover
+	}
+	
+	static const kDrawDataDefaults[];
 
 
 	enum TextData {
@@ -205,14 +207,15 @@
 		kImageLogoSmall		//!< ScummVM logo used in the GMM
 	};
 
-	/** Graphics mode enumeration.
-	 *	Each item represents a set of BPP and Renderer modes for a given
+	/**
+	 * Graphics mode enumeration.
+	 * Each item represents a set of BPP and Renderer modes for a given
 	 * surface.
 	 */
 	enum GraphicsMode {
-		kGfxDisabled = 0,	/** No GFX */
-		kGfxStandard16bit,	/** 2BPP with the standard (aliased) renderer. */
-		kGfxAntialias16bit	/** 2BPP with the optimized AA renderer. */
+		kGfxDisabled = 0,	//!< No GFX
+		kGfxStandard16bit,	//!< 2BPP with the standard (aliased) renderer.
+		kGfxAntialias16bit	//!< 2BPP with the optimized AA renderer.
 	};
 
 	/** Constant value to expand dirty rectangles, to make sure they are fully copied */
@@ -238,13 +241,6 @@
 	/** Default destructor */
 	~ThemeEngine();
 
-	/**
-	 *	VIRTUAL METHODS
-	 *	This is the implementation of the GUI::Theme API to allow
-	 *	the ThemeEngine class to be plugged in as any other GUI
-	 *	theme. In fact, the renderer works like any other GUI theme,
-	 *	but supports extensive customization of the drawn widgets.
-	 */
 	bool init();
 	void deinit();
 	void clearAll();
@@ -271,28 +267,15 @@
 	 */
 	void updateScreen();
 
-	/** Since the rendering pipeline changes, closing all dialogs causes no effect
-		TODO: remove this from the original GUI::Theme API */
-	void closeAllDialogs() {}
 
-	/** Drawing area has been removed: it was too hackish. A workaround is on the works.
-		TODO: finish the workaround for the credits dialog
-		TODO: remove this from the original GUI::Theme API */
-	void resetDrawArea() {}
-
-
 	/**
 	 *	FONT MANAGEMENT METHODS
 	 */
 
 	TextData fontStyleToData(FontStyle font) const {
-		switch (font) {
-			case kFontStyleNormal:
-				return kTextDataNormalFont;
-
-			default:
-				return kTextDataDefault;
-		}
+		if (font == kFontStyleNormal)
+			return kTextDataNormalFont;
+		return kTextDataDefault;
 	}
 
 	const Graphics::Font *getFont(FontStyle font = kFontStyleBold) const;
@@ -544,14 +527,6 @@
 	void unloadTheme();
 
 	/**
-	 * Not implemented yet.
-	 * TODO: reload themes, reload the renderer, recheck everything
-	 */
-	void screenChange() {
-		error("Screen Changes are not supported yet. Fix this!");
-	}
-
-	/**
 	 *	Actual Dirty Screen handling function.
 	 *	Handles all the dirty squares in the list, merges and optimizes
 	 *	them when possible and draws them to the screen.
@@ -559,21 +534,6 @@
 	 */
 	void renderDirtyScreen();
 
-	/**
-	 *	Frees the vector renderer.
-	 */
-	void freeRenderer();
-
-	/**
-	 * Frees the Back buffer surface, only if it's available.
-	 */
-	void freeBackbuffer();
-
-	/**
-	 * Frees the main screen drawing surface, only if it's available.
-	 */
-	void freeScreen();
-
 	TextData getTextData(DrawData ddId);
 
 	/**
@@ -671,8 +631,10 @@
 	Common::String _fontName;
 	const Graphics::Font *_font;
 
-	/** Array of all the DrawData elements than can be drawn to the screen.
-		Must be full so the renderer can work. */
+	/**
+	 * Array of all the DrawData elements than can be drawn to the screen.
+	 * Must be full so the renderer can work.
+	 */
 	WidgetDrawData *_widgets[kDrawDataMAX];
 
 	/** Array of all the text fonts that can be drawn. */
@@ -689,11 +651,11 @@
 	/** Queue with all the drawing that must be done to the screen */
 	Common::List<ThemeItem *> _screenQueue;
 
-	bool _initOk; /** Class and renderer properly initialized */
-	bool _themeOk; /** Theme data successfully loaded. */
-	bool _enabled; /** Whether the Theme is currently shown on the overlay */
+	bool _initOk; //!< Class and renderer properly initialized
+	bool _themeOk; //!< Theme data successfully loaded.
+	bool _enabled; //!< Whether the Theme is currently shown on the overlay
 
-	Common::String _themeName; /** Name of the currently loaded theme */
+	Common::String _themeName; //!< Name of the currently loaded theme
 	Common::String _themeFileName;
 
 	/** Custom Cursor Management */
@@ -702,7 +664,9 @@
 	bool _useCursor;
 	int _cursorHotspotX, _cursorHotspotY;
 	int _cursorTargetScale;
-	enum { MAX_CURS_COLORS = 255 };
+	enum {
+		MAX_CURS_COLORS = 255
+	};
 	byte *_cursor;
 	bool _needPaletteUpdates;
 	uint _cursorWidth, _cursorHeight;


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