Changeset View
Changeset View
Standalone View
Standalone View
thumbnail/thumbnail.cpp
Show First 20 Lines • Show All 405 Lines • ▼ Show 20 Line(s) | |||||
406 | void ThumbnailProtocol::drawPictureFrame(QPainter *painter, const QPoint ¢erPos, | 406 | void ThumbnailProtocol::drawPictureFrame(QPainter *painter, const QPoint ¢erPos, | ||
407 | const QImage &image, int frameWidth, QSize imageTargetSize) const | 407 | const QImage &image, int frameWidth, QSize imageTargetSize) const | ||
408 | { | 408 | { | ||
409 | // Scale the image down so it matches the aspect ratio | 409 | // Scale the image down so it matches the aspect ratio | ||
410 | float scaling = 1.0; | 410 | float scaling = 1.0; | ||
411 | 411 | | |||
412 | if ((image.size().width() > imageTargetSize.width()) && (imageTargetSize.width() != 0)) { | 412 | if ((image.size().width() > imageTargetSize.width()) && (imageTargetSize.width() != 0)) { | ||
413 | scaling = float(imageTargetSize.width()) / float(image.size().width()); | 413 | scaling = float(imageTargetSize.width()) / float(image.size().width()); | ||
414 | } else | ||||
415 | if ((image.size().height() > imageTargetSize.height()) && (imageTargetSize.height() != 0)) { | ||||
ngraham: Is this an `else if (...) {` or an `else { if (...) {` | |||||
416 | scaling = float(imageTargetSize.height()) / float(image.size().height()); | ||||
414 | } | 417 | } | ||
415 | 418 | | |||
416 | QImage frame(imageTargetSize + QSize(frameWidth * 2, frameWidth * 2), | 419 | QImage frame(imageTargetSize + QSize(frameWidth * 2, frameWidth * 2), | ||
417 | QImage::Format_ARGB32); | 420 | QImage::Format_ARGB32); | ||
418 | frame.fill(0); | 421 | frame.fill(0); | ||
419 | 422 | | |||
420 | float scaledFrameWidth = frameWidth / scaling; | 423 | float scaledFrameWidth = frameWidth / scaling; | ||
421 | 424 | | |||
▲ Show 20 Lines • Show All 359 Lines • Show Last 20 Lines |
Is this an else if (...) { or an else { if (...) {