Subversion Repositories tpanel

Rev

Rev 446 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 446 Rev 482
Line 88... Line 88...
88
 
88
 
89
    if (pl < 1 || pl < mPixelSize)
89
    if (pl < 1 || pl < mPixelSize)
90
        return;
90
        return;
91
 
91
 
92
    int width = pl / mPixelSize;
92
    int width = pl / mPixelSize;
93
    int height = mSize / pl;
93
    int height = static_cast<int>(mSize) / pl;
94
 
94
 
95
    if ((size_t)(height * pl) > mSize)
95
    if ((size_t)(height * pl) > mSize)
96
    {
96
    {
97
        MSG_ERROR("TBitmap::setPixline: Number of pixels exceeds the allocated size of image!");
97
        MSG_ERROR("TBitmap::setPixline: Number of pixels exceeds the allocated size of image!");
98
        return;
98
        return;
Line 158... Line 158...
158
        return;
158
        return;
159
    }
159
    }
160
 
160
 
161
    mPixline = w * mPixelSize;
161
    mPixline = w * mPixelSize;
162
    mWidth = w;
162
    mWidth = w;
163
    mHeight = mSize / mPixline;
163
    mHeight = static_cast<int>(mSize) / mPixline;
164
}
164
}
165
 
165
 
166
void TBitmap::setHeight(int h)
166
void TBitmap::setHeight(int h)
167
{
167
{
168
    DECL_TRACER("TBitmap::setHeight(int h)");
168
    DECL_TRACER("TBitmap::setHeight(int h)");
Line 185... Line 185...
185
 
185
 
186
    if (w < 1 || h < 1)
186
    if (w < 1 || h < 1)
187
        return;
187
        return;
188
 
188
 
189
    int pixline = w * mPixelSize;
189
    int pixline = w * mPixelSize;
190
    int maxHeight = mSize / pixline;
190
    int maxHeight = static_cast<int>(mSize) / pixline;
191
 
191
 
192
    if (h > maxHeight || (size_t)(pixline * h) > mSize)
192
    if (h > maxHeight || (size_t)(pixline * h) > mSize)
193
    {
193
    {
194
        MSG_ERROR("Width and height exceeds allocated image size!");
194
        MSG_ERROR("Width and height exceeds allocated image size!");
195
        return;
195
        return;
Line 215... Line 215...
215
        return;
215
        return;
216
    }
216
    }
217
 
217
 
218
    mPixelSize = ps;
218
    mPixelSize = ps;
219
    mPixline = pixline;
219
    mPixline = pixline;
220
    mHeight = mSize / pixline;
220
    mHeight = static_cast<int>(mSize) / pixline;
221
}
221
}
222
 
222
 
223
bool TBitmap::isValid()
223
bool TBitmap::isValid()
224
{
224
{
225
    DECL_TRACER("TBitmap::isValid()");
225
    DECL_TRACER("TBitmap::isValid()");