History log of /haiku/src/servers/app/PictureBoundingBoxPlayer.cpp
Revision Date Author Comments
# 22ce5525 28-Dec-2018 Michael Lotz <mmlr@mlotz.ch>

app_server: Fix invalid cast of int32 to size_t array.

Make ServerFont::GetBoundingBoxesForStrings() use size_t.

# 25dbf74b 10-Nov-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

BView: add methods for affine translation/scaling/rotation

* BView::TranslateBy(), BView::ScaleBy() and BView::RotateBy()
allow to conveniently modify the current affine transformation.
This makes it unnecessary to first read the current transform,
modify it, and then set it again.
Uses the new Pre...() methods of BAffineTransform.

* Also, remove setting the transform "through" to the BView even
while recording a BPicture, as this now results in transforms
being applied more than once.

# bafd2b46 22-Aug-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: PictureBoundingBoxPlayer fixups

* TODO: squash commit before merge into master

# 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)

* 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

* 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.

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

app_server: add picture player for determining bounding box

* Add PictureBoundingBoxPlayer, a new player for BPictures. Instead
of drawing the picture, it determines an approximate bounding box
of its contained drawing operations.

* To increase performance, the resulting bounding box is an
approximation: it guarantees to always enclose all pixels of the
picture, however not necessarily tightly.

* PictureBoundingBoxPlayer::Play() gets a DrawState which is the
initial state used when playing the picture. The player does not
modify this state (it uses a copy internally), so the method is