History log of /haiku/src/servers/app/Canvas.h
Revision Date Author Comments
# 5f51a74f 02-Dec-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Build fix.

Some code in a just merged patch needs another one that's still being
discussed on Gerrit. Extract just the parts we need to get things
building again.


# 2193dcd7 13-Nov-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: plug DrawState instance leak, other minor fixes

* OffscreenCanvas was not deleting its DrawState. Found thanks to
the allocation tracking feature in libroot_debug (thanks mmlr!)

* Also a missing nothrow and a missing ref release in an error case


# e718dc91 12-Nov-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: Clip alpha masks to canvas size

* Making the alpha masks independent of view size is a good thing,
however it turns out that I was too optimistic about the
consequences: webkit sometimes sets masks for the whole page, not
just the currently visible area. E.g. on Github diff views, it
was seen to set a clipping path which is about 1,000 x 10,000
pixels in size. Generating these huge masks eats up lots of memory
and time.

* We now clip the alpha masks to the current view size. This
introduces a dependency between mask and view again, however a
weaker one than it used to be before the mask rework. When the
view is enlarged, and the alpha mask was previously clipped during
rendering, we regenerate it at the new size. When the view is
shrunk however, we don't do anything and just keep the
now larger than necessary mask around (so we don't have to
regenerate again when the view is subsequently enlarged again --
except if it then becomes even larger than it used to be).
Changing the view origin is unaffected and still doesn't cause a
regenerate.


# 4bd6f322 09-Nov-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server/Interface Kit: add new clipping API

* Add new clipping API for rectangles (ClipToRect, ClipToInverseRect)
and shapes (ClipToShape, ClipToInverseShape)

* Works with affine transforms and automatically switches from fast
region-based clipping to alpha-mask based clipping as necessary.

* Always self-intersecting, i.e. no state push required to further
narrow down the clipping region. All of the 4 new methods can be
mixed in any order.


# 551438b9 25-Jul-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: add new BView layers API

* Add new methods
BView::BeginLayer(uint8 opacity)
BView::EndLayer()

* All drawing between begin and end of a layer is redirected onto an
intermediate bitmap. When ending the layer, this bitmap is
composited onto the view with the opacity given when the layer was
started.

* Layers can be nested arbitrarily and will be blended onto each
other in order. There can also be any arbitrary interleaving of
layer begin/end and drawing operations.

* Internally, drawing commands are redirected into a BPicture between
BeginLayer and EndLayer (but client code need not know or care
about this). Client code can also start/end other BPictures while
inside a layer.

* Uses the PictureBoundingBoxPlayer to determine the size of the
layer bitmap before allocating and drawing into it, so it does not
allocate more memory than necessary and -- more importantly -- it
will not alpha-composite more pixels than necessary.

* Drawing mode is always set to B_OP_ALPHA, blend mode to
(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE) while inside layers. This is
necessary for (a) correct compositing output and (b) for
redirection of drawing into the intermediate bitmap, which uses the
renderer_region offset (in B_OP_COPY, the Painter does not use the
AGG renderer methods, it directly accesses the pixel data. This
would access out-of-bounds without the offset, so B_OP_COPY cannot
be allowed.)
To ensure these modes aren't changed, BView::SetDrawingMode()
and BView::SetBlendingMode() are ignored while inside a layer.

* The main motivation behind this new API is WebKit, which internally
expects such a layers functionality to be present. A performant and
reusable implementation of this functionality can only be done
server-side in app_server.


# b5c7f936 08-Jul-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: allow replacing the DrawState in a Canvas

* Needed for layers support. The previously set DrawState and its
stack predecessors are not freed, so take care to not leak memory
when using this.


# ae046876 08-Jul-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: add Canvas::PenToLocalTransform


# 6f2a446e 06-Apr-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: extract coordinate conversion class

* Move coordinate conversion into a new class SimpleTransform. It
supports scaling and translation which is sufficient for conversion
between screen, local and pen (drawing) coordinates.

* Because all the overloaded methods for converting
BPoint/BRect/BRegion/etc are now within the single SimpleTransform
class, the interfaces of Canvas, View, DrawState, etc. are slimmed
down. These classes have too many responsibilities, so some will be
factored out into separate classes, this being the first.


# ab1bd2fd 04-Jan-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: rename DrawingContext to Canvas

* Better reflects the purpose of the class: an interface for things
in which we can draw (e.g. a View)

* Accordingly rename OffscreenContext to OffscreenCanvas