void (Graphics2D g, int startVisualLine, int endVisualLine) { int x = getAnnotationsAreaOffset(); int w = getAnnotationsAreaWidthEx(); if (w == 0) return; int viewportStartY = myEditor.getScrollingModel().getVisibleArea().y; AffineTransform old = setMirrorTransformIfNeeded(g, x, w); try { Color color = myEditor.getColorsScheme().getColor(EditorColors.ANNOTATIONS_COLOR); g.setColor(color != null ? color : JBColor.blue); g.setFont(myEditor.getColorsScheme().getFont(EditorFontType.PLAIN)); for (int i = 0; i < myTextAnnotationGutters.size(); i++) { TextAnnotationGutterProvider gutterProvider = myTextAnnotationGutters.get(i); int lineHeight = myEditor.getLineHeight(); int lastLine = myEditor.logicalToVisualPosition(new LogicalPosition(endLineNumber(), 0)).line; endVisualLine = Math.min(endVisualLine, lastLine); if (startVisualLine > endVisualLine) { break; } int annotationSize = myTextAnnotationGutterSizes.getInt(i); int logicalLine = -1; Color bg = null; VisualLinesIterator visLinesIterator = new VisualLinesIterator(myEditor, startVisualLine); while (!visLinesIterator.atEnd() && visLinesIterator.getVisualLine() <= endVisualLine) { if (!visLinesIterator.isCustomFoldRegionLine()) { int y = visLinesIterator.getY(); int bgLineHeight = lineHeight; boolean paintText = !visLinesIterator.startsWithSoftWrap() || y <= viewportStartY; if (y < viewportStartY && visLinesIterator.endsWithSoftWrap()) { // "sticky" line annotation y = viewportStartY; } else if (viewportStartY < y && y < viewportStartY + lineHeight && visLinesIterator.startsWithSoftWrap()) { // avoid drawing bg over the "sticky" line above, or over a possible gap in the gutter below (e.g., code vision) bgLineHeight = y - viewportStartY; y = viewportStartY + lineHeight; } if (paintText || logicalLine == -1) { logicalLine = visLinesIterator.getDisplayedLogicalLine(); bg = gutterProvider.getBgColor(logicalLine, myEditor); } if (bg != null) { g.setColor(bg); g.fillRect(x, y, annotationSize, bgLineHeight); } if (paintText) { paintAnnotationLine(g, gutterProvider, logicalLine, x, y); } } visLinesIterator.advance(); } x += annotationSize; } } finally { if (old != null) g.setTransform(old); } }