equal
deleted
inserted
replaced
137 RSgImage *sgImage = tempSgImage.data(); |
137 RSgImage *sgImage = tempSgImage.data(); |
138 Q_CHECK_PTR(sgImage); |
138 Q_CHECK_PTR(sgImage); |
139 |
139 |
140 TInt err = sgImage->Create(info, 0, 0); |
140 TInt err = sgImage->Create(info, 0, 0); |
141 if (err != KErrNone) { |
141 if (err != KErrNone) { |
|
142 sgImageRenderer->setLastError(err); |
142 return false; |
143 return false; |
143 } |
144 } |
144 |
145 |
145 TSgDrawableId sgImageId = sgImage->Id(); |
146 TSgDrawableId sgImageId = sgImage->Id(); |
146 |
147 |
147 memcpy(&data.sgImageData.id, &sgImageId.iId, sizeof(data.sgImageData.id)); |
148 memcpy(&data.sgImageData.id, &sgImageId.iId, sizeof(data.sgImageData.id)); |
148 data.type = SGIMAGE; |
149 data.type = SGIMAGE; |
|
150 data.renderingMode = EHWRendering; |
149 |
151 |
150 bool success = sgImageRenderer->beginRendering(sgImage); |
152 bool success = sgImageRenderer->beginRendering(sgImage); |
151 if (!success) { |
153 if (!success) { |
152 return false; |
154 return false; |
153 } |
155 } |
159 success = renderNvg(byteArray, QRect(0, 0, data.sgImageData.width, data.sgImageData.height), |
161 success = renderNvg(byteArray, QRect(0, 0, data.sgImageData.width, data.sgImageData.height), |
160 iconKey.aspectRatioMode, iconKey.mirrored); |
162 iconKey.aspectRatioMode, iconKey.mirrored); |
161 if (!success) { |
163 if (!success) { |
162 return false; |
164 return false; |
163 } |
165 } |
164 vgFinish(); |
166 vgFlush(); |
165 // Once finished, release all handles to the image, and shut down EGL. |
167 // Once finished, release all handles to the image, and shut down EGL. |
166 // Make a null EGLSurface current to release the current surface before |
168 // Make a null EGLSurface current to release the current surface before |
167 // destroying. The RSgImage contents will persist until the RSgImage is closed. |
169 // destroying. The RSgImage contents will persist until the RSgImage is closed. |
168 sgImageRenderer->endRendering(); |
170 sgImageRenderer->endRendering(); |
169 tempSgImage.take(); |
171 tempSgImage.take(); |
242 RSgImage *sgImage = tempSgImage.data(); |
244 RSgImage *sgImage = tempSgImage.data(); |
243 Q_CHECK_PTR(sgImage); |
245 Q_CHECK_PTR(sgImage); |
244 |
246 |
245 TInt err = sgImage->Create(info, 0, 0); |
247 TInt err = sgImage->Create(info, 0, 0); |
246 if (err != KErrNone) { |
248 if (err != KErrNone) { |
|
249 sgImageRenderer->setLastError(err); |
247 return false; |
250 return false; |
248 } |
251 } |
249 |
252 |
250 data.type = SGIMAGE; |
253 data.type = SGIMAGE; |
|
254 data.renderingMode = EHWRendering; |
251 data.sgImageData.width = qRound(multiPieceIconParams.size.width()); |
255 data.sgImageData.width = qRound(multiPieceIconParams.size.width()); |
252 data.sgImageData.height = qRound(multiPieceIconParams.size.height()); |
256 data.sgImageData.height = qRound(multiPieceIconParams.size.height()); |
253 data.sgImageData.defaultWidth = defaultSize.width(); |
257 data.sgImageData.defaultWidth = defaultSize.width(); |
254 data.sgImageData.defaultHeight = defaultSize.height(); |
258 data.sgImageData.defaultHeight = defaultSize.height(); |
255 //data.sgImageData.sgImage = sgImage; |
259 //data.sgImageData.sgImage = sgImage; |
299 if (!success) { |
303 if (!success) { |
300 sgImageRenderer->endRendering(); |
304 sgImageRenderer->endRendering(); |
301 return false; |
305 return false; |
302 } |
306 } |
303 } |
307 } |
304 vgFinish(); |
308 vgFlush(); |
305 |
309 |
306 sgImageRenderer->endRendering(); |
310 sgImageRenderer->endRendering(); |
307 |
311 |
308 tempSgImage.take(); |
312 tempSgImage.take(); |
309 HbSgImageRenderer::addSgImageToHash(data.sgImageData.id, sgImage); |
313 HbSgImageRenderer::addSgImageToHash(data.sgImageData.id, sgImage); |
325 NvgAspectRatioSettings settings = mapKeyAspectRatioToNvgAspectRatio(aspectRatioMode); |
329 NvgAspectRatioSettings settings = mapKeyAspectRatioToNvgAspectRatio(aspectRatioMode); |
326 sgImageRenderer->nvgEngine()->setPreserveAspectRatio(settings.nvgAlignStatusAndAspectRatio, settings.type); |
330 sgImageRenderer->nvgEngine()->setPreserveAspectRatio(settings.nvgAlignStatusAndAspectRatio, settings.type); |
327 sgImageRenderer->nvgEngine()->enableMirroring(mirrored); |
331 sgImageRenderer->nvgEngine()->enableMirroring(mirrored); |
328 |
332 |
329 HbNvgEngine::HbNvgErrorType errorType = sgImageRenderer->nvgEngine()->drawNvg(byteArray, size); |
333 HbNvgEngine::HbNvgErrorType errorType = sgImageRenderer->nvgEngine()->drawNvg(byteArray, size); |
|
334 if (errorType == HbNvgEngine::NvgErrNoMemory){ |
|
335 sgImageRenderer->setLastError(KErrNoGraphicsMemory); |
|
336 } |
330 return errorType == HbNvgEngine::NvgErrNone; |
337 return errorType == HbNvgEngine::NvgErrNone; |
331 } |
338 } |
332 |
339 |