Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: swt-initiative31/prototype-skija
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4935aba8490f6a879c0c83c1fc1e65002a0bdb3f
Choose a base ref
..
head repository: swt-initiative31/prototype-skija
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 55c51824a36e1df0fd75634652015c6727cf4e13
Choose a head ref
Original file line number Diff line number Diff line change
@@ -388,20 +388,18 @@ private void doPaint(GC gc) {
boolean isPushOrToggleButton = (style & (SWT.PUSH | SWT.TOGGLE)) != 0;
int initialAntiAlias = gc.getAntialias();

final ColorProvider colorProvider = getColorProvider();

int boxSpace = 0;
// Draw check box / radio box / push button border
if (isPushOrToggleButton) {
drawPushButton(gc, 0, 0, width - 1, height - 1, colorProvider);
drawPushButton(gc, 0, 0, width - 1, height - 1);
} else {
boxSpace = BOX_SIZE + SPACING;
int boxLeftOffset = LEFT_MARGIN;
int boxTopOffset = (height - 1 - BOX_SIZE) / 2;
if ((style & SWT.CHECK) == SWT.CHECK) {
drawCheckbox(gc, boxLeftOffset, boxTopOffset, colorProvider);
drawCheckbox(gc, boxLeftOffset, boxTopOffset);
} else if ((style & SWT.RADIO) == SWT.RADIO) {
drawRadioButton(gc, boxLeftOffset, boxTopOffset, colorProvider);
drawRadioButton(gc, boxLeftOffset, boxTopOffset);
}
}

@@ -456,6 +454,7 @@ private void doPaint(GC gc) {
}
}

final ColorProvider colorProvider = getColorProvider();
// Draw text
if (text != null && !text.isEmpty()) {
gc.setForeground(colorProvider.getColor(isEnabled() ? KEY_TEXT : KEY_DISABLE));
@@ -530,7 +529,8 @@ private boolean isCheckButton() {
}

private void drawPushButton(GC gc, int x, int y, int w,
int h, ColorProvider colorProvider) {
int h) {
final ColorProvider colorProvider = getColorProvider();
if (isEnabled()) {
if ((style & SWT.TOGGLE) != 0 && isChecked()) {
gc.setBackground(colorProvider.getColor(KEY_TOGGLE));
@@ -561,7 +561,8 @@ private void drawPushButton(GC gc, int x, int y, int w,
gc.setForeground(fg);
}

private void drawRadioButton(GC gc, int x, int y, ColorProvider colorProvider) {
private void drawRadioButton(GC gc, int x, int y) {
final ColorProvider colorProvider = getColorProvider();
if (getSelection()) {
gc.setBackground(colorProvider.getColor(isEnabled() ? KEY_SELECTION : KEY_DISABLE));
int partialBoxBorder = 2;
@@ -581,7 +582,8 @@ else if (hasMouseEntered) {
gc.drawOval(x, y, BOX_SIZE, BOX_SIZE);
}

private void drawCheckbox(GC gc, int x, int y, ColorProvider colorProvider) {
private void drawCheckbox(GC gc, int x, int y) {
final ColorProvider colorProvider = getColorProvider();
if (getSelection()) {
gc.setBackground(colorProvider.getColor(isEnabled()
? grayed ? KEY_GRAYED : KEY_SELECTION
Original file line number Diff line number Diff line change
@@ -409,9 +409,9 @@ private void paintControl(Event e) {
}
}

drawBackground(e, getClientArea(), colorProvider);
drawBackground(e, getClientArea());
drawText(e, visibleArea);
drawSelection(e, visibleArea, colorProvider);
drawSelection(e, visibleArea);
drawCaret(e, visibleArea);
}

@@ -421,7 +421,7 @@ public void setEnabled(boolean enabled) {
redraw();
}

private void drawSelection(Event e, Rectangle visibleArea, ColorProvider colorProvider) {
private void drawSelection(Event e, Rectangle visibleArea) {
GC gc = e.gc;
int textLength = model.getText().length();
int start = Math.min(Math.max(model.getSelectionStart(), 0), textLength);
@@ -434,6 +434,7 @@ private void drawSelection(Event e, Rectangle visibleArea, ColorProvider colorPr

Color oldForeground = gc.getForeground();
Color oldBackground = gc.getBackground();
final ColorProvider colorProvider = getColorProvider();
gc.setForeground(colorProvider.getColor(KEY_SELECTION_FOREGROUND));
gc.setBackground(colorProvider.getColor(KEY_SELECTION_BACKGROUND));
for (int i = startLocation.line; i <= endLocation.line; i++) {
@@ -499,7 +500,7 @@ private void drawTextLine(String text, int lineNumber, int x, int y, Rectangle v
gc.drawText(text, _x, _y, true);
}

private void drawBackground(Event e, Rectangle clientArea, ColorProvider colorProvider) {
private void drawBackground(Event e, Rectangle clientArea) {
GC gc = e.gc;
int height = clientArea.height;
final boolean drawLine = (style & SWT.BORDER) != 0 && getEditable() && isEnabled();
@@ -509,6 +510,7 @@ private void drawBackground(Event e, Rectangle clientArea, ColorProvider colorPr
gc.fillRectangle(clientArea.x, clientArea.y, clientArea.width, height);
if (drawLine) {
Color prevBackground = gc.getBackground();
final ColorProvider colorProvider = getColorProvider();
gc.setBackground(colorProvider.getColor(isFocusControl() ? KEY_SELECTION_BACKGROUND : KEY_BORDER));
gc.fillRectangle(clientArea.x, clientArea.y + height, clientArea.width, 1);
gc.setBackground(prevBackground);
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@

import org.eclipse.swt.*;
import org.eclipse.swt.accessibility.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;

/**
@@ -663,12 +662,10 @@ private void doPaint(GC gc) {
}
}

final ColorProvider colorProvider = getColorProvider();

// draw border
int style = getStyle();
if ((style & SWT.SHADOW_IN) != 0 || (style & SWT.SHADOW_OUT) != 0) {
paintBorder(gc, width, height, colorProvider);
paintBorder(gc, width, height);
}

/*
@@ -724,7 +721,7 @@ private void doPaint(GC gc) {
}

if (lines != null) {
gc.setForeground(isEnabled() ? getForeground() : colorProvider.getColor(KEY_DISABLED));
gc.setForeground(isEnabled() ? getForeground() : getColorProvider().getColor(KEY_DISABLED));

for (String line : lines) {
int lineX = x;
@@ -748,7 +745,9 @@ private void doPaint(GC gc) {
/**
* Paint the Label's border.
*/
private void paintBorder(GC gc, int width, int height, ColorProvider colorProvider) {
private void paintBorder(GC gc, int width, int height) {
final ColorProvider colorProvider = getColorProvider();

Color c1 = null;
Color c2 = null;

Original file line number Diff line number Diff line change
@@ -473,8 +473,8 @@ private void doPaint(GC gc) {

Point baseExtent = gc.textExtent("a", DRAW_FLAGS);

final ColorProvider colorProvider = getColorProvider();
if (!isEnabled()) {
final ColorProvider colorProvider = getColorProvider();
gc.setForeground(colorProvider.getColor(KEY_DISABLED));
}