|
7 | 7 | // |
8 | 8 |
|
9 | 9 | #include "config.h" |
| 10 | + |
10 | 11 | #include "platform/common/graphics.h" |
11 | 12 | #include "platform/common/utils.h" |
12 | 13 | #include "common/device.h" |
@@ -71,15 +72,6 @@ Font::~Font() { |
71 | 72 | } |
72 | 73 | } |
73 | 74 |
|
74 | | -// |
75 | | -// Canvas implementation |
76 | | -// |
77 | | -Canvas::Canvas() { |
78 | | -} |
79 | | - |
80 | | -Canvas::~Canvas() { |
81 | | -} |
82 | | - |
83 | 75 | // |
84 | 76 | // Graphics implementation |
85 | 77 | // |
@@ -121,11 +113,10 @@ void Graphics::drawImageRegion(Canvas *src, const MAPoint2d *dstPoint, const MAR |
121 | 113 | if (_drawTarget && _drawTarget != src) { |
122 | 114 | int destY = dstPoint->y; |
123 | 115 | int srcH = srcRect->height; |
124 | | - if (srcRect->top + srcRect->height > src->height()) { |
125 | | - srcH = src->height() - srcRect->top; |
| 116 | + if (srcRect->top + srcRect->height > src->_h) { |
| 117 | + srcH = src->_h - srcRect->top; |
126 | 118 | } |
127 | | - int targetH = _drawTarget->height(); |
128 | | - for (int y = 0; y < srcH && destY < targetH; y++, destY++) { |
| 119 | + for (int y = 0; y < srcH && destY < _drawTarget->_h; y++, destY++) { |
129 | 120 | pixel_t *line = src->getLine(y + srcRect->top) + srcRect->left; |
130 | 121 | pixel_t *dstLine = _drawTarget->getLine(destY) + dstPoint->x; |
131 | 122 | memcpy(dstLine, line, srcRect->width * sizeof(pixel_t)); |
@@ -257,8 +248,8 @@ int Graphics::getPixel(int posX, int posY) { |
257 | 248 | if (_drawTarget |
258 | 249 | && posX > -1 |
259 | 250 | && posY > -1 |
260 | | - && posX < _drawTarget->width() |
261 | | - && posY < _drawTarget->height() - 1) { |
| 251 | + && posX < _drawTarget->_w |
| 252 | + && posY < _drawTarget->_h - 1) { |
262 | 253 | pixel_t *line = _drawTarget->getLine(posY); |
263 | 254 | result = line[posX]; |
264 | 255 | } |
@@ -291,13 +282,19 @@ MAHandle Graphics::setDrawTarget(MAHandle maHandle) { |
291 | 282 | } else { |
292 | 283 | _drawTarget = (Canvas *)maHandle; |
293 | 284 | } |
294 | | - _drawTarget->freeClip(); |
| 285 | + delete _drawTarget->_clip; |
| 286 | + _drawTarget->_clip = NULL; |
295 | 287 | return (MAHandle) _drawTarget; |
296 | 288 | } |
297 | 289 |
|
298 | 290 | // |
299 | 291 | // maapi implementation |
300 | 292 | // |
| 293 | +MAHandle maCreatePlaceholder(void) { |
| 294 | + MAHandle maHandle = (MAHandle) new Canvas(); |
| 295 | + return maHandle; |
| 296 | +} |
| 297 | + |
301 | 298 | int maFontDelete(MAHandle maHandle) { |
302 | 299 | if (maHandle != -1) { |
303 | 300 | graphics->deleteFont((Font *)maHandle); |
|
0 commit comments