[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : alex
Repository : xara
Revision : 1605
Date : Sat Jul 29 20:26:04 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/doccolor.cpp
M /Trunk/XaraLX/Kernel/doccolor.h
Fix initialization of doccolours so memory comparison works properly on the == and != operators on retail builds.
Diff:
Index: Trunk/XaraLX/Kernel/doccolor.h
===================================================================
--- Trunk/XaraLX/Kernel/doccolor.h (revision 1604)
+++ Trunk/XaraLX/Kernel/doccolor.h (revision 1605)
@@ -307,6 +307,11 @@
protected:
void InitialiseInfoField(ColourModel ColModel);
+
+ // We need this because the ColourPacked entries are different sizes, and therefore incompletely
+ // initialized when set up with a colour model smaller than the default. This causes issues on
+ // retail builds because we later memcmp the entire structure to tell if colours are the same.
+ void ZapSourceColour() {memset(&SourceColour, 0, sizeof(SourceColour)); memset(&CachedColour, 0, sizeof(CachedColour)); }
};
Index: Trunk/XaraLX/Kernel/doccolor.cpp
===================================================================
--- Trunk/XaraLX/Kernel/doccolor.cpp (revision 1604)
+++ Trunk/XaraLX/Kernel/doccolor.cpp (revision 1605)
@@ -184,6 +184,7 @@
DocColour::DocColour()
{
+ ZapSourceColour();
InitialiseInfoField(COLOURMODEL_RGBT);
SourceColour.RGBT.Red = 0; // Black & 100% Transparent
@@ -248,6 +249,7 @@
DocColour::DocColour(StockColour Col)
{
+ ZapSourceColour();
PColourValue Red = 0, Green = 0, Blue = 0, Transparent = 0;
InitialiseInfoField(COLOURMODEL_RGBT);
@@ -354,6 +356,7 @@
DocColour::DocColour(ColourValue Red, ColourValue Green, ColourValue Blue)
{
+ ZapSourceColour();
ColourRGBT temp;
InitialiseInfoField( COLOURMODEL_RGBT );
@@ -399,6 +402,7 @@
DocColour::DocColour(ColourModel ColModel, ColourGeneric *Col)
{
+ ZapSourceColour();
InitialiseInfoField(ColModel);
DEFAULTCONTEXT(ColModel)->PackColour(Col, &SourceColour);
}
@@ -1607,6 +1611,7 @@
DocColour::DocColour(INT32 Red, INT32 Green, INT32 Blue)
{
+ ZapSourceColour();
InitialiseInfoField(COLOURMODEL_RGBT);
SourceColour.RGBT.Red = (PColourValue) Red;
Xara