[Scummvm-cvs-logs] SF.net SVN: scummvm:[44477] scummvm/trunk/engines/sci/gfx
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Wed Sep 30 10:23:12 CEST 2009
Revision: 44477
http://scummvm.svn.sourceforge.net/scummvm/?rev=44477&view=rev
Author: thebluegr
Date: 2009-09-30 08:23:12 +0000 (Wed, 30 Sep 2009)
Log Message:
-----------
Converted _color_equals() into respective equality operators within the gfx_color_t structure
Modified Paths:
--------------
scummvm/trunk/engines/sci/gfx/gfx_system.h
scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp
Modified: scummvm/trunk/engines/sci/gfx/gfx_system.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_system.h 2009-09-30 07:47:58 UTC (rev 44476)
+++ scummvm/trunk/engines/sci/gfx/gfx_system.h 2009-09-30 08:23:12 UTC (rev 44477)
@@ -66,16 +66,6 @@
};
-
-/** Full color */
-struct gfx_color_t {
- PaletteEntry visual;
- uint8 alpha; /**< transparency = (1-opacity) */
- int8 priority, control;
- byte mask; /**< see mask values below */
-};
-
-
// TODO: Replace rect_t by Common::Rect
/** Rectangle description */
struct rect_t {
@@ -259,6 +249,38 @@
/** @} */
+/** Full color */
+struct gfx_color_t {
+ PaletteEntry visual;
+ uint8 alpha; /**< transparency = (1-opacity) */
+ int8 priority, control;
+ byte mask; /**< see mask values below */
+
+ bool operator==(const gfx_color_t &c) const {
+ if (mask != c.mask)
+ return false;
+
+ if (mask & GFX_MASK_VISUAL) {
+ if (visual.r != c.visual.r || visual.g != c.visual.g || visual.b != c.visual.b || alpha != c.alpha)
+ return false;
+ }
+
+ if (mask & GFX_MASK_PRIORITY)
+ if (priority != c.priority)
+ return false;
+
+ if (mask & GFX_MASK_CONTROL)
+ if (control != c.control)
+ return false;
+
+ return true;
+ }
+
+ bool operator!=(const gfx_color_t &c) const {
+ return !(*this == c);
+ }
+};
+
} // End of namespace Sci
#endif // SCI_GFX_GFX_SYSTEM
Modified: scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp 2009-09-30 07:47:58 UTC (rev 44476)
+++ scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp 2009-09-30 08:23:12 UTC (rev 44477)
@@ -192,28 +192,6 @@
return 1; \
}
-
-// TODO: Turn this into an operator==
-static int _color_equals(gfx_color_t a, gfx_color_t b) {
- if (a.mask != b.mask)
- return 0;
-
- if (a.mask & GFX_MASK_VISUAL) {
- if (a.visual.r != b.visual.r || a.visual.g != b.visual.g || a.visual.b != b.visual.b || a.alpha != b.alpha)
- return 0;
- }
-
- if (a.mask & GFX_MASK_PRIORITY)
- if (a.priority != b.priority)
- return 0;
-
- if (a.mask & GFX_MASK_CONTROL)
- if (a.control != b.control)
- return 0;
-
- return 1;
-}
-
int GfxWidget::setVisual(GfxVisual *visual) {
_visual = visual;
@@ -361,14 +339,14 @@
if (!toCommonRect(wbox->_bounds).equals(toCommonRect(obox->_bounds)))
return 0;
- if (!_color_equals(wbox->_color1, obox->_color1))
+ if (wbox->_color1 != obox->_color1)
return 0;
if (wbox->_shadeType != obox->_shadeType)
return 0;
if (wbox->_shadeType != GFX_BOX_SHADE_FLAT
- && _color_equals(wbox->_color2, obox->_color2))
+ && wbox->_color2 == obox->_color2)
return 0;
return 1;
@@ -438,7 +416,7 @@
wprim->_bounds.width != oprim->_bounds.width || wprim->_bounds.height != oprim->_bounds.height)
return 0;
- if (!_color_equals(wprim->_color, oprim->_color))
+ if (wprim->_color != oprim->_color)
return 0;
if (wprim->_lineMode != oprim->_lineMode)
@@ -685,7 +663,7 @@
if (wview->_view != oview->_view || wview->_loop != oview->_loop || wview->_cel != oview->_cel)
return 0;
- if (!_color_equals(wview->_color, oview->_color))
+ if (wview->_color != oview->_color)
return 0;
if (wview->_flags != oview->_flags)
@@ -840,8 +818,8 @@
if (wtext->_font != otext->_font)
return 0;
- /* if (!(_color_equals(wtext->_color1, otext->_color1) && _color_equals(wtext->_color2, otext->_color2)
- && _color_equals(wtext->_bgcolor, otext->_bgcolor)))
+ /* if (!(wtext->_color1 == otext->_color1 && wtext->_color2 == otext->_color2
+ && wtext->_bgcolor == otext->_bgcolor))
return 0; */
return 1;
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