2
* Copyright 2014 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authors: Jussi Pakkanen <jussi.pakkanen@canonical.com>
17
* James Henstridge <james.henstridge@canonical.com>
18
* Pawel Stolowski <pawel.stolowski@canonical.com>
21
#include "artgeneratorcommon.h"
24
QString sizeToDesiredSizeString(const QSize& requestedSize)
26
QString desiredSize = "original";
27
int size = requestedSize.width() > requestedSize.height() ? requestedSize.width() : requestedSize.height();
29
desiredSize = "small";
30
} else if (size < 256) {
31
desiredSize = "large";
32
} else if (size < 512) {
33
desiredSize = "xlarge";
38
QImage imageFromFd(int fd, QSize *realSize)
41
file.open(fd, QIODevice::ReadOnly);
43
image.load(&file, NULL);
44
*realSize = image.size();