src/hbservers/hbthemeserver/hbnvgiconprocessor_p.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 21 4633027730f5
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    26 #include "hbnvgiconprocessor_p.h"
    26 #include "hbnvgiconprocessor_p.h"
    27 #include "hbnvg_p.h"
    27 #include "hbnvg_p.h"
    28 #include <QFile>
    28 #include <QFile>
    29 #include "hbiconsource_p.h"
    29 #include "hbiconsource_p.h"
    30 #include "hbmemoryutils_p.h"
    30 #include "hbmemoryutils_p.h"
    31 #include <hbtlvwrapper_p.h>
       
    32 #include "hbthemeserverutils_p.h"
    31 #include "hbthemeserverutils_p.h"
    33 
    32 
    34 
    33 
    35 /*!
    34 /*!
    36     @hbserver
    35     @hbserver
    79 {
    78 {
    80     if (!iconKey.size.isValid()) {
    79     if (!iconKey.size.isValid()) {
    81         return false;
    80         return false;
    82     }
    81     }
    83     bool isDefaultSize =  iconKey.size.isNull();
    82     bool isDefaultSize =  iconKey.size.isNull();
    84     if (iconType == "SVG") {
    83     
    85         quint32 domhandle = 0;
    84     HbIconSource *source = HbThemeServerUtils::getIconSource(iconPath);
    86         defaultSize = (HbTlvWrapper::instance())->contentDimensions((QString&)iconPath, domhandle);
    85     QByteArray *sourceByteArray = source->byteArray();
    87         QSizeF renderSize = QSizeF(defaultSize);
    86     if( !sourceByteArray ) {
    88         if (!isDefaultSize) {
    87         return false;
    89             renderSize.scale(iconKey.size, iconKey.aspectRatioMode);
       
    90         }
       
    91         if (domhandle) {
       
    92             byteArray = (HbTlvWrapper::instance())->getTlvEncodedDataFromDom(domhandle, renderSize, iconKey.aspectRatioMode);
       
    93             size = renderSize.toSize();
       
    94         }
       
    95     } else {
       
    96         HbIconSource *source = HbThemeServerUtils::getIconSource(iconPath);
       
    97         QByteArray *sourceByteArray = source->byteArray();
       
    98         if( !sourceByteArray ) {
       
    99             return false;
       
   100         }
       
   101         byteArray = *sourceByteArray;
       
   102         QSizeF renderSize = source->defaultSize();
       
   103         defaultSize = renderSize.toSize();
       
   104         if (!isDefaultSize) {
       
   105             renderSize.scale(iconKey.size, iconKey.aspectRatioMode);
       
   106         }
       
   107         size = renderSize.toSize();
       
   108     }
    88     }
       
    89     byteArray = *sourceByteArray;
       
    90     QSizeF renderSize = source->defaultSize();
       
    91     defaultSize = renderSize.toSize();
       
    92     if (!isDefaultSize) {
       
    93         renderSize.scale(iconKey.size, iconKey.aspectRatioMode);
       
    94     }
       
    95     size = renderSize.toSize();
       
    96     
   109     return true;
    97     return true;
   110 }
    98 }
   111 
    99 
   112 /*!
   100 /*!
   113     \fn HbNvgIconProcessor::sharedIconDataCost()
   101     \fn HbNvgIconProcessor::sharedIconDataCost()