Skip to content

Commit 7fe73be

Browse files
committed
Merge pull request #34 from jeroendeswaef/fix-linux-scrolling-crash
fix scrolling issue with news.ycombinator.com on linux
2 parents dfc2b9c + 959a35b commit 7fe73be

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/el_image.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -206,20 +206,22 @@ void litehtml::el_image::draw( uint_ptr hdc, int x, int y, const position* clip
206206
// draw image as background
207207
if(pos.does_intersect(clip))
208208
{
209-
background_paint bg;
210-
bg.image = m_src;
211-
bg.clip_box = pos;
212-
bg.origin_box = pos;
213-
bg.border_box = pos;
214-
bg.border_box += m_padding;
215-
bg.border_box += m_borders;
216-
bg.repeat = background_repeat_no_repeat;
217-
bg.image_size.width = pos.width;
218-
bg.image_size.height = pos.height;
219-
bg.border_radius = m_css_borders.radius.calc_percents(bg.border_box.width, bg.border_box.height);
220-
bg.position_x = pos.x;
221-
bg.position_y = pos.y;
222-
get_document()->container()->draw_background(hdc, bg);
209+
if (pos.width > 0 && pos.height > 0) {
210+
background_paint bg;
211+
bg.image = m_src;
212+
bg.clip_box = pos;
213+
bg.origin_box = pos;
214+
bg.border_box = pos;
215+
bg.border_box += m_padding;
216+
bg.border_box += m_borders;
217+
bg.repeat = background_repeat_no_repeat;
218+
bg.image_size.width = pos.width;
219+
bg.image_size.height = pos.height;
220+
bg.border_radius = m_css_borders.radius.calc_percents(bg.border_box.width, bg.border_box.height);
221+
bg.position_x = pos.x;
222+
bg.position_y = pos.y;
223+
get_document()->container()->draw_background(hdc, bg);
224+
}
223225
}
224226

225227
// draw borders

0 commit comments

Comments
 (0)