@@ -69,27 +69,19 @@ fun KtProperty.getOrCreateGutterIcon(): Icon? {
6969 * This function parses the ImageVector definition and renders it as a Swing Icon
7070 * suitable for display in the IDE UI (project view, gutter, completion, etc.).
7171 */
72- private fun KtFile.createImageVectorIcon (): Icon ? {
73- val irImageVector = ImageVectorPsiParser .parseToIrImageVector(this ) ? : return null
74- val vectorXml = irImageVector.toVectorXmlString()
75-
76- return ImageVectorIcon (
77- vectorXml = vectorXml,
78- aspectRatio = irImageVector.aspectRatio,
79- dominantShade = irImageVector.dominantShadeColor,
80- )
81- }
82-
83- private fun KtProperty.createIcon (): Icon ? {
84- val irImageVector = parseImageVectorProperty(this ) ? : return null
85- val vectorXml = irImageVector.toVectorXmlString()
86-
87- return ImageVectorIcon (
88- vectorXml = vectorXml,
89- aspectRatio = irImageVector.aspectRatio,
90- dominantShade = irImageVector.dominantShadeColor,
91- )
92- }
72+ private fun KtFile.createImageVectorIcon (): Icon ? =
73+ ImageVectorPsiParser .parseToIrImageVector(this )
74+ ?.toIcon()
75+
76+ private fun KtProperty.createIcon (): Icon ? =
77+ parseImageVectorProperty(this )
78+ ?.toIcon()
79+
80+ private fun IrImageVector.toIcon (): Icon = ImageVectorIcon (
81+ vectorXml = toVectorXmlString(),
82+ aspectRatio = aspectRatio,
83+ dominantShade = dominantShadeColor,
84+ )
9385
9486private fun parseImageVectorProperty (property : KtProperty ): IrImageVector ? {
9587 // Try parsing the current file
0 commit comments