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() |