Bug 361615 - [Canvas] Implement SWT.NO_BACKGROUND to avoid clearing the canvas rectangle
Summary: [Canvas] Implement SWT.NO_BACKGROUND to avoid clearing the canvas rectangle
Status: ASSIGNED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 370313
Blocks:
  Show dependency tree
 
Reported: 2011-10-21 04:23 EDT by Arian Storch CLA
Modified: 2017-02-11 17:11 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arian Storch CLA 2011-10-21 04:23:45 EDT
Build Identifier: 

Everytime the canvas is rendered, it's first clearing its rectangle. This is not a good default strategy, if you want to perform selective drawing updates later.

Special case:
I render a grid which leads to more than 4000 drawing commands the first time the canvas is painted. Later (because of actions) only special parts of the canvas need to be redrawn. But this selective drawing is senseless because the whole canvas is cleared and filled with a background color.

Reproducible: Always

Steps to Reproduce:
Look at details
Comment 1 Tim Buschtoens CLA 2011-10-21 04:33:46 EDT
So you would like to draw on top of everything else, never clearing anything you have drawn. Is that correct? Could you use two Canvas on top of each other, one for unchanging background, the other for dynamic content?
Comment 2 Arian Storch CLA 2011-10-21 04:38:04 EDT
(In reply to comment #1)
> So you would like to draw on top of everything else, never clearing anything
> you have drawn. Is that correct? Could you use two Canvas on top of each other,
> one for unchanging background, the other for dynamic content?

This could be a solution. But nevertheless the foreground canvas needs to have
a transparent background otherwise the background canvas isn't visible.
Comment 3 Tim Buschtoens CLA 2012-02-01 05:42:55 EST
This would be very useful for clientside scripted painting. The only issue i see is that for IE7/8, the number of shapes would continue growing. To solve this, IE could detect if a rectangle is drawn over the entire area, effectively clearing the canvas.
Comment 4 Ivan Furnadjiev CLA 2016-03-01 05:47:36 EST
Arian, could you try RAP 3.1M5? We don't clear the complete canvas anymore if redraw(x, y, width, heigth) method is used.
Comment 5 Linuxhippy CLA 2017-02-11 17:11:19 EST
I guess I am also bitten by this issue ... I am currently trying to write a widget and ran into this issue too. I would like to do most of the rendering on the server, but allow client-side selection of objects in a MouseDown ClientListener (overdraw the content created on the server-side).

Inside the MouseDown handler I do not have access to a gc (event.gc is null), so I call redraw() there - which clears the canvas no matter what arguments I pass and regardless of SWT.NO_BACKGROUND set.

I worked arround the issue by preserving the GC during paint, and performing draw calls inside the mouse handler, but I would prefer a proper way of solving this issue...