History log of /haiku/src/servers/app/PictureBoundingBoxPlayer.cpp
Revision Date Author Comments
# 85b82f85 19-Jul-2022 Dale Cieslak <dcieslak@yahoo.com>

BFont: allow loading of user fonts from disk or memory

This patch adds an API call to BFont, called LoadFont, that
takes a string path to a font file. The user fonts are managed
via a new class called AppFontManager that inherits from the base
class FontManagerBase but adds the methods to add and remove user
fonts from disk or memory. There is also a new method called UnloadFont
to remove a user font, but on exit of an app all user fonts should be
automatically cleaned up.

Global/system fonts are managed by the GlobalFontManager, which is
a new class that also inherits from the base class FontManagerBase,
replacing the old "FontManager" class.

A maximum of 128 user fonts may be loaded, and memory fonts
may not exceed 20MB.

There's also an overloaded version of LoadFont that accepts
an area_id and loads the font from memory. A size and offset may
optionally be provided to allow for an area that contains more
than just a font.

Change-Id: I6add42bdf0c0cefc0e2e2a4984fd848c3e7269e5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4790
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 60d30785 27-Aug-2020 X512 <danger_mail@list.ru>

app_server memory management fixes: use BReference

Use BReference for more automated reference counting in app_server,
fixing some use-after-free and other problems.

Extracted from https://review.haiku-os.org/c/haiku/+/2695

Change-Id: I141bb248229405896b29feff3338447f7257b0b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3175
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


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


# 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
idempotent.