@@ -99,15 +99,6 @@ QNanoImage::QNanoImage(const QImage &image, const QString &filename, ImageFlags
99
99
updateUniqueKey ();
100
100
}
101
101
102
- QNanoImage::QNanoImage (QIODevice *device, const QString &uniqueKey, ImageFlags flags)
103
- : m_device(device)
104
- , m_uniqueKey(uniqueKey)
105
- , m_flags(flags)
106
- {
107
- Q_ASSERT (device);
108
- updateUniqueKey ();
109
- }
110
-
111
102
/* !
112
103
\fn void QNanoImage::setFilename(const QString &filename)
113
104
@@ -220,21 +211,6 @@ QNanoImage QNanoImage::fromCache(QNanoPainter *painter, const QString &filename,
220
211
return image;
221
212
}
222
213
223
- QNanoImage QNanoImage::fromCache (QNanoPainter *painter, QIODevice *device, const QString &uniqueKey, ImageFlags flags)
224
- {
225
- Q_ASSERT (painter);
226
- Q_ASSERT (device);
227
- QNanoImage image;
228
- image.m_imageData .reset (new QNanoDataElement ());
229
- image.m_device = device;
230
- image.m_uniqueKey = uniqueKey;
231
- image.m_flags = flags;
232
- image.updateUniqueKey ();
233
- image.m_parentPainter = painter;
234
- image.getID (painter->nvgCtx ());
235
- return image;
236
- }
237
-
238
214
// ***** Private *****
239
215
240
216
/* !
@@ -280,17 +256,10 @@ int QNanoImage::getID(NVGcontext* nvg)
280
256
}
281
257
} else {
282
258
// Image is not yet in cache, so load and add it
283
- QIODevice *device;
284
- QFile file;
285
- if (m_device)
286
- device = m_device;
287
- else {
288
- file.setFileName (m_filename);
289
- device = &file;
290
- }
291
- if (device->open (QIODevice::ReadOnly)) {
259
+ QFile file (m_filename);
260
+ if (file.open (QFile::ReadOnly)) {
292
261
m_imageData.reset (new QNanoDataElement ());
293
- QByteArray array = device-> readAll ();
262
+ QByteArray array = file. readAll ();
294
263
int length = array.size ();
295
264
unsigned char * data = reinterpret_cast <unsigned char *>(&array.data ()[0 ]);
296
265
m_imageData->id = nvgCreateImageMem (nvg, m_flags, data, length);
@@ -310,7 +279,7 @@ void QNanoImage::updateUniqueKey()
310
279
{
311
280
if (m_textureId > 0 )
312
281
m_uniqueKey = QString (" %1_" ).arg (QString::number (m_textureId));
313
- else if (!m_device)
282
+ else
314
283
m_uniqueKey = m_filename;
315
284
316
285
m_uniqueKey.append (QString::number (m_flags));
0 commit comments