void (@NotNull CustomFoldRegion region, @NotNull Graphics2D g, @NotNull Rectangle2D r, @NotNull TextAttributes textAttributes) { int startX = calcInlayStartX(); int endX = (int)r.getX() + (int)r.getWidth(); if (startX >= endX) return; int margin = scale(TOP_BOTTOM_MARGINS); int filledHeight = (int)r.getHeight() - margin * 2; if (filledHeight <= 0) return; int filledStartY = (int)r.getY() + margin; Editor editor = region.getEditor(); Color defaultBgColor = ((EditorEx)editor).getBackgroundColor(); Color currentBgColor = textAttributes.getBackgroundColor(); Color bgColor = currentBgColor == null ? defaultBgColor : ColorUtil.mix(defaultBgColor, textAttributes.getBackgroundColor(), .5); if (currentBgColor != null) { g.setColor(bgColor); int arcDiameter = ARC_RADIUS * 2; if (endX - startX >= arcDiameter) { g.fillRect(startX, filledStartY, endX - startX - ARC_RADIUS, filledHeight); Object savedHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.fillRoundRect(endX - arcDiameter, filledStartY, arcDiameter, filledHeight, arcDiameter, arcDiameter); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedHint); } else { g.fillRect(startX, filledStartY, endX - startX, filledHeight); } } g.setColor(editor.getColorsScheme().getColor(DefaultLanguageHighlighterColors.DOC_COMMENT_GUIDE)); g.fillRect(startX, filledStartY, scale(LINE_WIDTH), filledHeight); int topBottomInset = scale(TOP_BOTTOM_INSETS); int componentWidth = endX - startX - scale(LEFT_INSET) - scale(RIGHT_INSET); int componentHeight = filledHeight - topBottomInset * 2; if (componentWidth > 0 && componentHeight > 0) { JComponent component = getRendererComponent(editor, componentWidth); component.setBackground(bgColor); Graphics dg = g.create(startX + scale(LEFT_INSET), filledStartY + topBottomInset, componentWidth, componentHeight); UISettings.setupAntialiasing(dg); component.paint(dg); dg.dispose(); } }