Fix BitmapData issues for HL
This commit is contained in:
@@ -19,7 +19,7 @@ namespace lime {
|
||||
int offsetX;
|
||||
int offsetY;
|
||||
Rectangle* rect;
|
||||
/*ImageType*/ int type;
|
||||
venum* type;
|
||||
int version;
|
||||
int width;
|
||||
double x;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace lime {
|
||||
|
||||
int byteOffset;
|
||||
Image* image;
|
||||
Rectangle* rect;
|
||||
Rectangle rect;
|
||||
int stride;
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace lime {
|
||||
double x;
|
||||
double y;
|
||||
|
||||
Rectangle ();
|
||||
Rectangle (double x, double y, double width, double height);
|
||||
Rectangle (value rect);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace lime {
|
||||
bool premultiplied = image->buffer->premultiplied;
|
||||
uint8_t* data = (uint8_t*)image->buffer->data->buffer->b;
|
||||
|
||||
Rectangle* _rect = (Rectangle*)(image->type);
|
||||
ImageDataView dataView = ImageDataView (image, rect);
|
||||
|
||||
colorMatrix->GetAlphaTable (alphaTable);
|
||||
@@ -811,14 +812,14 @@ namespace lime {
|
||||
ImageDataView::ImageDataView (Image* image, Rectangle* rect) {
|
||||
|
||||
this->image = image;
|
||||
this->rect = Rectangle(rect->x, rect->y, rect->width, rect->height);
|
||||
|
||||
if (rect->x < 0) rect->x = 0;
|
||||
if (rect->y < 0) rect->y = 0;
|
||||
if (rect->x + rect->width > image->width) rect->width = image->width - rect->x;
|
||||
if (rect->y + rect->height > image->height) rect->height = image->height - rect->y;
|
||||
if (rect->width < 0) rect->width = 0;
|
||||
if (rect->height < 0) rect->height = 0;
|
||||
this->rect = rect;
|
||||
if (this->rect.x < 0) this->rect.x = 0;
|
||||
if (this->rect.y < 0) this->rect.y = 0;
|
||||
if (this->rect.x + this->rect.width > image->width) this->rect.width = image->width - this->rect.x;
|
||||
if (this->rect.y + this->rect.height > image->height) this->rect.height = image->height - this->rect.y;
|
||||
if (this->rect.width < 0) this->rect.width = 0;
|
||||
if (this->rect.height < 0) this->rect.height = 0;
|
||||
|
||||
stride = image->buffer->Stride ();
|
||||
|
||||
@@ -830,7 +831,7 @@ namespace lime {
|
||||
|
||||
void ImageDataView::Clip (int x, int y, int width, int height) {
|
||||
|
||||
rect->Contract (x, y, width, height);
|
||||
rect.Contract (x, y, width, height);
|
||||
__Update ();
|
||||
|
||||
}
|
||||
@@ -847,25 +848,25 @@ namespace lime {
|
||||
|
||||
if (x < 0) {
|
||||
|
||||
rect->x += x;
|
||||
if (rect->x < 0) rect->x = 0;
|
||||
rect.x += x;
|
||||
if (rect.x < 0) rect.x = 0;
|
||||
|
||||
} else {
|
||||
|
||||
rect->x += x;
|
||||
rect->width -= x;
|
||||
rect.x += x;
|
||||
rect.width -= x;
|
||||
|
||||
}
|
||||
|
||||
if (y < 0) {
|
||||
|
||||
rect->y += y;
|
||||
if (rect->y < 0) rect->y = 0;
|
||||
rect.y += y;
|
||||
if (rect.y < 0) rect.y = 0;
|
||||
|
||||
} else {
|
||||
|
||||
rect->y += y;
|
||||
rect->height -= y;
|
||||
rect.y += y;
|
||||
rect.height -= y;
|
||||
|
||||
}
|
||||
|
||||
@@ -883,10 +884,10 @@ namespace lime {
|
||||
|
||||
inline void ImageDataView::__Update () {
|
||||
|
||||
this->x = (int) ceil (rect->x);
|
||||
this->y = (int) ceil (rect->y);
|
||||
this->width = (int) floor (rect->width);
|
||||
this->height = (int) floor (rect->height);
|
||||
this->x = (int) ceil (rect.x);
|
||||
this->y = (int) ceil (rect.y);
|
||||
this->width = (int) floor (rect.width);
|
||||
this->height = (int) floor (rect.height);
|
||||
byteOffset = (stride * (this->y + image->offsetY)) + ((this->x + image->offsetX) * 4);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,15 @@ namespace lime {
|
||||
static bool init = false;
|
||||
|
||||
|
||||
Rectangle::Rectangle () {
|
||||
|
||||
t = 0;
|
||||
|
||||
SetTo (0, 0, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Rectangle::Rectangle (double x, double y, double width, double height) {
|
||||
|
||||
t = 0;
|
||||
|
||||
Reference in New Issue
Block a user