summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
693be98)
If the item height is smaller than the image height, scale the image.
Change-Id: I9393a7d0d7eebf28c30c4a51e271d7c6ea8e2216
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/88688
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
// draw icon
int imgHeight = img.getImageData().height;
int imgWidth = img.getImageData().width;
// draw icon
int imgHeight = img.getImageData().height;
int imgWidth = img.getImageData().width;
+ int dstHeight = Math.min(bounds.height, imgHeight);
+ int dstWidth = dstHeight * imgWidth / imgHeight;
- int y = bounds.y + (bounds.height - imgHeight) / 2;
- gc.drawImage(img, x, y);
+ int y = bounds.y + (bounds.height - dstHeight) / 2;
+ gc.drawImage(img, 0, 0, imgWidth, imgHeight, x, y, dstWidth, dstHeight);
width += imgWidth + MARGIN;
}
} else {
width += imgWidth + MARGIN;
}
} else {