Bug 1184009 - Limit image preview sizes. r=acomminos
This commit is contained in:
@@ -101,14 +101,17 @@ UpdateFilePreviewWidget(GtkFileChooser *file_chooser,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf *preview_pixbuf;
|
GdkPixbuf *preview_pixbuf = nullptr;
|
||||||
// Only scale down images that are too big
|
// Only scale down images that are too big
|
||||||
if (preview_width > MAX_PREVIEW_SIZE || preview_height > MAX_PREVIEW_SIZE) {
|
if (preview_width > MAX_PREVIEW_SIZE || preview_height > MAX_PREVIEW_SIZE) {
|
||||||
|
if (ceil(preview_width / double(MAX_PREVIEW_SIZE) + 1.0) *
|
||||||
|
ceil(preview_height / double(MAX_PREVIEW_SIZE) + 1.0) < 0x7FFFFF) {
|
||||||
preview_pixbuf = gdk_pixbuf_new_from_file_at_size(image_filename,
|
preview_pixbuf = gdk_pixbuf_new_from_file_at_size(image_filename,
|
||||||
MAX_PREVIEW_SIZE,
|
MAX_PREVIEW_SIZE,
|
||||||
MAX_PREVIEW_SIZE,
|
MAX_PREVIEW_SIZE,
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
preview_pixbuf = gdk_pixbuf_new_from_file(image_filename, nullptr);
|
preview_pixbuf = gdk_pixbuf_new_from_file(image_filename, nullptr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user