level 9
zhangjb90s
楼主
今天写程序的时候,发现了一个BUG,IMAGE对象输出的内容不是预期的,调试了4个小时发现竟然跟 IMAGE对象定义顺序和读取图片的顺序 有关。。。。
有问题的定义顺序,读取的IMAGE对象之间都混乱了,IMAGE对象定义顺序和读取图片的顺序不一致
1.IMAGE picture[N],PicSmall[N];
IMAGE block[2],welcome,bk,CutPic[16];
IMAGE temppic;
MOUSEMSG msg;
修改IMAGE的定义顺序,一切正常了
2.IMAGE picture[N],PicSmall[N];
IMAGE block[2],welcome,bk;
IMAGE temppic;
MOUSEMSG msg;
IMAGE CutPic[16];
看了一下IMAGE 内容
class IMAGE
{
public:int getwidth() const;// 获取对象的宽度int getheight() const;// 获取对象的高度
private:int width, height;// 对象的宽高HBITMAP m_hBmp;HDC m_hMemDC;int m_MemCurX;// 当前点X坐标int m_MemCurY;// 当前点Y坐标float m_data[6];COLORREFm_LineColor;// 当前线条颜色COLORREFm_TextColor;// 当前文字颜色COLORREFm_BkColor;// 当前背景颜色DWORD*m_pBuffer;// 绘图区的内存
struct{intlinestyle;WORDupattern;// 自定义画线样式intthickness;}m_LineType;// 画线样式
struct{int pattern;char upattern[8];// 自定义填充样式int color;}m_FillType;// 填充样式virtual void SetDefault();// 设置为默认状态
public:IMAGE(int _width = 0, int _height = 0);// 创建图像IMAGE(const IMAGE &img);// 拷贝构造函数IMAGE& operator = (const IMAGE &img);// 赋值运算符重载函数virtual ~IMAGE();virtual void Resize(int _width, int _height);// 调整尺寸
};
IMAGE对象定义顺序和读取图片的顺序有关系吗?@yangw80
2013年05月09日 08点05分
1
有问题的定义顺序,读取的IMAGE对象之间都混乱了,IMAGE对象定义顺序和读取图片的顺序不一致
1.IMAGE picture[N],PicSmall[N];
IMAGE block[2],welcome,bk,CutPic[16];
IMAGE temppic;
MOUSEMSG msg;
修改IMAGE的定义顺序,一切正常了
2.IMAGE picture[N],PicSmall[N];
IMAGE block[2],welcome,bk;
IMAGE temppic;
MOUSEMSG msg;
IMAGE CutPic[16];
看了一下IMAGE 内容
class IMAGE
{
public:int getwidth() const;// 获取对象的宽度int getheight() const;// 获取对象的高度
private:int width, height;// 对象的宽高HBITMAP m_hBmp;HDC m_hMemDC;int m_MemCurX;// 当前点X坐标int m_MemCurY;// 当前点Y坐标float m_data[6];COLORREFm_LineColor;// 当前线条颜色COLORREFm_TextColor;// 当前文字颜色COLORREFm_BkColor;// 当前背景颜色DWORD*m_pBuffer;// 绘图区的内存
struct{intlinestyle;WORDupattern;// 自定义画线样式intthickness;}m_LineType;// 画线样式
struct{int pattern;char upattern[8];// 自定义填充样式int color;}m_FillType;// 填充样式virtual void SetDefault();// 设置为默认状态
public:IMAGE(int _width = 0, int _height = 0);// 创建图像IMAGE(const IMAGE &img);// 拷贝构造函数IMAGE& operator = (const IMAGE &img);// 赋值运算符重载函数virtual ~IMAGE();virtual void Resize(int _width, int _height);// 调整尺寸
};
IMAGE对象定义顺序和读取图片的顺序有关系吗?@yangw80
