void (Graphics2D g, NavBarItem item, NavBarPanel navbar) { JBInsets paddings = JBInsets.create(getElementPadding(item)); if (ExperimentalUI.isNewUI()) { Rectangle rect = new Rectangle(item.getSize()); JBInsets.removeFrom(rect, paddings); int offset = rect.x; if (!item.isFirstElement()) { NavBarItem.CHEVRON_ICON.paintIcon(item, g, offset, rect.y + (rect.height - NavBarItem.CHEVRON_ICON.getIconHeight()) / 2); int delta = NavBarItem.CHEVRON_ICON.getIconWidth() + JBUI.CurrentTheme.StatusBar.Breadcrumbs.CHEVRON_INSET.get(); offset += delta; rect.width -= delta; } paintHighlight(g, navbar, item, new Rectangle(offset, rect.y, rect.width, rect.height)); boolean paintIcon = false; if (item.needPaintIcon()) { Icon icon = item.getIcon(); if (icon != null) { paintIcon = true; offset += item.getIpad().left; icon.paintIcon(item, g, offset, rect.y + (rect.height - icon.getIconHeight()) / 2 + item.getVerticalIconOffset()); offset += icon.getIconWidth(); } } offset += paintIcon ? item.getIconTextGap() : item.getIpad().left; item.doPaintText(g, offset); } else { final boolean floating = navbar.isInFloatingMode(); boolean toolbarVisible = UISettings.getInstance().getShowMainToolbar(); final boolean selected = item.isSelected() && item.isFocused(); boolean nextSelected = item.isNextSelected() && navbar.isFocused(); ImageType type = ImageType.from(floating, toolbarVisible, selected, nextSelected); // see: https://github.com/JetBrains/intellij-community/pull/1111 Map<ImageType, ScaleContextCache<BufferedImage>> cache = AbstractNavBarUI.cache.computeIfAbsent(item, k -> new HashMap<>()); ScaleContextCache<BufferedImage> imageCache = cache.computeIfAbsent(type, k -> { return new ScaleContextCache<>(ctx -> { return drawToBuffer(item, ctx, floating, toolbarVisible, selected, nextSelected, item.isLastElement()); }); }); BufferedImage image = imageCache.getOrProvide(ScaleContext.create(g)); if (image == null) { return; } StartupUiUtil.drawImage(g, image, 0, 0, null); final int offset = item.isFirstElement() ? getFirstElementLeftOffset() : 0; int textOffset = paddings.width() + offset; if (item.needPaintIcon()) { Icon icon = item.getIcon(); if (icon != null) { int iconOffset = paddings.left + offset; icon.paintIcon(item, g, iconOffset, (item.getHeight() - icon.getIconHeight()) / 2); textOffset += icon.getIconWidth(); } } item.doPaintText(g, textOffset); } }