Skip to content

Commit 83d9313

Browse files
arunjose696akoch-yatta
authored andcommitted
Guard clipping to avoid resize artifacts in tree viewer
Setting the clipping region temporarily to the textBounds was originally added (https://bugs.eclipse.org/bugs/show_bug.cgi?id=291245 comment 25) to prevent images from being overdrawn when implementting RIGHT or CENTER column alignment support in StyledCellLabelProvider. However, enabling clipping causes artifact lines during tree resizing, as a temporary workaround the clipping call is now guarded and applied only in those alignment cases to avoid issues with resizing of columns.
1 parent 32d98a1 commit 83d9313

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StyledCellLabelProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ protected void paint(Event event, Object element) {
389389
int y = textBounds.y
390390
+ Math.max(0, (textBounds.height - layoutBounds.height) / 2);
391391

392-
if (gc.isClipped()) {
392+
if (gc.isClipped() && ((style & SWT.RIGHT) != 0 || (style & SWT.CENTER) != 0)) {
393393
Rectangle saveClipping = gc.getClipping();
394394
gc.setClipping(textBounds);
395395
textLayout.draw(gc, x, y);

0 commit comments

Comments
 (0)