src/hbservers/hbthemeserver/hbsgimageiconprocessor_p.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 2 06ff229162e9
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
   102 {
   102 {
   103     bool isDefaultSize =  iconKey.size.isNull();
   103     bool isDefaultSize =  iconKey.size.isNull();
   104     data.type = INVALID_FORMAT;
   104     data.type = INVALID_FORMAT;
   105 
   105 
   106     HbIconSource *source = HbThemeServerUtils::getIconSource(iconPath);
   106     HbIconSource *source = HbThemeServerUtils::getIconSource(iconPath);
   107     byteArray = *(source->byteArray());
   107     QByteArray *sourceByteArray = source->byteArray();
       
   108     if( !sourceByteArray ) {
       
   109         return false;
       
   110     }
       
   111     byteArray = *sourceByteArray;
   108     QSizeF size = source->defaultSize();
   112     QSizeF size = source->defaultSize();
   109     defaultSize = size.toSize();
   113     defaultSize = size.toSize();
   110     QSizeF renderSize(defaultSize);
   114     QSizeF renderSize(defaultSize);
   111     data.sgImageData.defaultWidth = defaultSize.width();
   115     data.sgImageData.defaultWidth = defaultSize.width();
   112     data.sgImageData.defaultHeight = defaultSize.height();
   116     data.sgImageData.defaultHeight = defaultSize.height();
   283                 position.setX(consolidatedIconWidth - pieceTopRight);
   287                 position.setX(consolidatedIconWidth - pieceTopRight);
   284             }
   288             }
   285 
   289 
   286 
   290 
   287             HbIconSource *source = HbThemeServerUtils::getIconSource(multiPieceIconParams.multiPartIconList[i]);
   291             HbIconSource *source = HbThemeServerUtils::getIconSource(multiPieceIconParams.multiPartIconList[i]);
   288             byteArray = *(source->byteArray());
   292             QByteArray *sourceByteArray = source->byteArray();
       
   293             if( !sourceByteArray ) {
       
   294                 return false;
       
   295             }
       
   296             byteArray = *sourceByteArray;
   289             success = renderNvg(byteArray, QRect(position,
   297             success = renderNvg(byteArray, QRect(position,
   290                                                  multiPieceIconParams.multiPartIconData.pixmapSizes[i]), (Qt::AspectRatioMode)multiPieceIconParams.aspectRatioMode,
   298                                                  multiPieceIconParams.multiPartIconData.pixmapSizes[i]), (Qt::AspectRatioMode)multiPieceIconParams.aspectRatioMode,
   291                                 mirrored);
   299                                 mirrored);
   292 #endif
   300 #endif
   293         }
   301         }
   318         vgTranslate(topLeft.x(), topLeft.y());
   326         vgTranslate(topLeft.x(), topLeft.y());
   319     }
   327     }
   320 
   328 
   321     NvgAspectRatioSettings settings = mapKeyAspectRatioToNvgAspectRatio(aspectRatioMode);
   329     NvgAspectRatioSettings settings = mapKeyAspectRatioToNvgAspectRatio(aspectRatioMode);
   322     nvgEngine.setPreserveAspectRatio(settings.nvgAlignStatusAndAspectRatio, settings.type);
   330     nvgEngine.setPreserveAspectRatio(settings.nvgAlignStatusAndAspectRatio, settings.type);
   323     nvgEngine.setMirroringMode(mirrored);
   331     nvgEngine.enableMirroring(mirrored);
   324 
   332 
   325     HbNvgEngine::NvgErrorType errorType = nvgEngine.drawNvg(byteArray, size);
   333     HbNvgEngine::HbNvgErrorType errorType = nvgEngine.drawNvg(byteArray, size);
   326     return errorType == HbNvgEngine::NvgErrNone;
   334     return errorType == HbNvgEngine::NvgErrNone;
   327 
   335 }
   328 }
   336