History log of /haiku/src/servers/app/DrawState.cpp
Revision Date Author Comments
# 7858871e 03-May-2023 Máximo Castañeda <antiswen@yahoo.es>

DrawState: disable drawing when clipping to an invalid rect

An invalid rect would mean an empty area to clip to. Its inverse would
be an infinite area with no holes.

Fixes #18395.

Change-Id: I5c739149e539ab63e9aaab6e8716aa73e3ee9d2f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6406
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: John Scipione <jscipione@gmail.com>


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


# 779ab335 09-Dec-2020 X512 <danger_mail@list.ru>

use .IsSet() instead if .Get() != NULL

Change-Id: Ia2b7a719fd398e78cc3b11d4f7b02cb81179f65f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3488
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


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

app_server memory management: use ObjectDeleter to mark ownership

Make object ownership explicit by use of ObjectDeleter where possible.

Change-Id: I499a00aa3390d1510ae284419e73faffa5166430
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2695
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


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


# 1876ba00 02-Jan-2019 Stephan Aßmus <superstippi@gmx.de>

DrawState: Return mask from ReadFontFromLink()

When changing the font state, a uin16 mask at the beginning of the
commands encodes which font parameters are transmitted in the link
data. Return this mask, so that one can know what parameters have
changed in the DrawState's ServerFont.

Change-Id: I52a9a665aac8eb0e6505193eba32c4b137846c78
Reviewed-on: https://review.haiku-os.org/814
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 630e3f14 11-Mar-2018 Jérôme Duval <jerome.duval@gmail.com>

View: move BAffineTransform out of ViewSetStateInfo.

the size of BAffineTransform is architecture dependent, so we transmit
its contents in a standard array instead.

Change-Id: I907110742168846a869a48bb2d116cc5292ec7d0


# 7f9368ca 09-Dec-2015 looncraz <looncraz@looncraz.net>

Set*UIColor, etc.

The inseparable changes necessary to support live color updating across the
system in a sane, safe, and performant manner.

BView gains:

HasSystemColors()
HasDefaultColors()
AdoptSystemColors()
AdoptParentColors()
AdoptViewColor(BView*)
SetViewUIColor(color_which, float tint)
SetHighUIColor(...
SetLowUIColor(...
ViewUIColor(float* tint)
HighUIColor(...
LowUIColor(...
DelayedInvalidate()

BWindow gains a simple helper method:
IsOffscreenWindow()

BMessage gains:

AddColor()
FindColor()
GetColor()
HasColor() * allegedly this API is deprecated, but I implemented it anyway
ReplaceColor()
SetColor()

Previous private ColorTools methods are made public and moved into GraphicsDefs:

mix_color, blend_color, disable_color

These are fully compatible with BeOS dan0 R5.1 methods and are just code cleanup
of BeOS example code under the OpenTracker license.

In addition, four new colors are created:
B_LINK_TEXT_COLOR
B_LINK_HOVER_COLOR
B_LINK_ACTIVE_COLOR
B_LINK_VISITED_COLOR

These changes are documented in their proper user documentation files.

In addition, due to a history rewrite, B_FOLLOW_LEFT_TOP has been defined and
used in lieu of B_FOLLOW_TOP | B_FOLLOW_LEFT and is included in this commit.

On the app_server side, the following has changed:

Add DelayedMessage - a system by which messages can be sent at a scheduled time,
and can also be merged according to set rules. A single thread is used to service the
message queue and multiple recipients can be set for each message.
Desktop gains the ability to add message ports to a DelayedMessage so that
said messages can target either all applications or all windows, as needed.

Desktop maintains a BMessage which is used to queue up all pending color changes
and the delayed messaging system is used to enact these changes after a short
period of time has passed. This prevents abuse and allows the system to merge
repeated set_ui_color events into one event for client applications, improving
performance drastically.

In addition, B_COLORS_UPDATED is sent to the BApplication, which forwards the message
to each BWindow. This is done to improve performance over having the app_server
independently informing each window.

Decorator changes are live now, which required some reworking.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 6b56f7d2 14-Nov-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: add a few missing std::nothrow


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

app_server: add a cache for AlphaMasks

* If the same shape alpha mask is set again and again, we now keep
the rendered masks in a cache. On certain websites, WebKit sets
the same shape for clipping hundreds of times, which uses a lot
of time to render the masks.

* When a shape mask was generated, we put it into AlphaMaskCache.
The constructor for ShapeAlphaMask is made private and a factory
method is used for instantiation instead, which transparently
looks up in the cache whether a suitable mask was already generated
before (so the entire caching is encapsulated inside the AlphaMask
class).

* When taking a mask out of the cache, we still create a new
AlphaMask instance. However, the new instance will share the
mask bitmap with the previously generated instance (aside from
the rendering of their bitmap, AlphaMask instances are pretty
lightweight). Shape masks are only seen as identical when
their shape is the same, the inverse flag, and they have the
same parent mask.

* Cache is limited to a fixed size of currently 8 MiB, using a
simple random replacement scheme. An LRU scheme can be added in
the future if necessary. Counting of bytes for the cache size
includes parent masks of masks in the cache, even if the parent
itself is not cached. A reference counter for "indirect" cache
references keeps track of which masks are not part of the cache,
but still need to be added to the cache byte size.

* For now, only for ShapeAlphaMasks, other mask types can be added
as necessary.


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


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

app_server: rework AlphaMask, use bounds for mask pictures

* Refactor AlphaMask class to separate the mask from its source. This
allows use to not just a BPicture as source for a pixel alpha mask,
but also e.g. a BShape in the future (not yet implemented).

* For BPicture-based masks, use the PictureBoundingBoxPlayer to
determine the size of the resulting mask bitmap. The masks are now
drawn into bitmaps of this size (instead of the whole view size).

When alpha masks are stacked, their bounding rectangles intersect
(i.e. masks further up in the stack can never be larger than masks
lower in the stack). The bitmap of a mask always contains the state
of itself blended with all masks in the stack below it.

This also avoids frequent rerendering of the masks. They are now
independent of view size. When the view origin (in screen
coordinates) changes we only have to reattach the mask buffer,
without having to redraw it.

* The class UniformAlphaMask is used for simple masks with the same
alpha value in all pixels, it uses no mask bitmap at all.
Currently, it can only be used on its own and not be stacked
together with other mask types.


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

app_server: Drawing mode fixups

* TODO: squash commit before merge into master


# c77b945a 03-Aug-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: allow drawing mode changes in opaque layers

* For better performance, we allow doing drawing mode changes
(and thus, B_OP_COPY) again when inside an opaque layer which
has only other opaque layers below it in the layer stack.

As soon as the first non-opaque layer turns up in the stack, the
drawing mode will be locked to alpha composite mode, until this
layer stack is ended entirely.

This allows using B_OP_COPY in many cases as used by WebKit.

* In the long term it would be nice to get rid of the drawing-mode
lock altogether, however that would need some larger refactoring
work in Painter (i.e. remove the offsetting from renderer_region
again and instead implement an "exit-level transform" (support
for offsets is enough) in Painter which is applied after all other
transforms).


# edc0b5e9 22-Jul-2015 Julian Harnath <julian.harnath@rwth-aachen.de>

app_server: allow disabling affine transforms in DrawState

* New method DrawState::SetTransformEnabled allows to temporarily
disable all BAffineTransforms in the state stack (up to 'this').
Later, the same method can be used to reenable the transforms.

Needed for layers support: when drawing the finished layer bitmap
onto the view, the affine transforms must not be applied again --
they have already been applied while drawing the bitmap's contents.


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

app_server: add Squash method in DrawState

* New method DrawState::Squash() uses the combined scale, origin and
transform as the state's own scale, origin, transform.

This can be used when making copies of DrawStates which have
previous states below them in the state stack. The top of stack
DrawState can be copied, squashed and then used just like the
original one with the whole stack below it (except of course
when trying to pop off any earlier state).


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


# 24479670 17-Mar-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: store and restore fill rule...

...when sending the whole view state over the link.
Also inherit the fill rule when pushing states (DrawState
copy constructor). A somewhat sloppy oversight, I must add.


# eb431663 11-Mar-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

app_server & interface kit: support fill rules.

* BView gets SetFillRule/FillRule methods. The fill rule is part of the
view state.
* The B_NONZERO rule is the default. This is what we implemented before.
* The B_EVEN_ODD rule is the other common possibility for this, and
we need to support it to help WebKit to render properly.


# a4655126 26-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Fix applying current scale when font changes.

* The code path actually used when the client uses BView::SetFont()
is DrawState::ReadFontFromLink(), where it forgot to a) adopt the
original font size in fUnscaledFontSize and b) scale the font by the
current combined scale. Fixes remaining part of #10578.


# 897f5562 04-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

Remove transform again from drawing coord conversion


# a6db6bd4 04-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

Added WIP support for affine transformations to BViews.

Everything untested, but compiles, so it must work. The idea is to introduce
BAffineTransform additionally to the existing Origin and Scale properties of
BViews. One may use it in parallel or as an alternative. Painter in app_server
is not yet aware of the additional transformation. It is however already used
to transform drawing coordinates. It probably needs to work differently,
perhaps only in Painter and AGGTextRenderer.


# 77214b5a 03-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Implemented nested clipping paths

* The alpha mask is no longer stored with 75% more memory than needed,
resolving a TODO.
* AlphaMasks are now BReferenceables.
* AlphaMasks are transferred to a pushed DrawState.
* When an AlphaMask is set on a DrawState, it sets the previous state's
mask to the AlphaMask. That one now takes care of updating not only itself,
but the previous mask as well (which works recursively).
* In AlphaMask::Generate(), a combination happens with the previous state's
mask, which again works recursively in case the previous mask also needs
to be updated. This step is combined with extracting the alpha channel from
the UtilityBitmap used to play the ServerPicture.
* Fixed some out of bounds access to memory in the "outside" case in
agg_clipped_alpha_mask.h. This happened when the requested region was
both before and after where the mask has data.


# ad3318b3 01-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

DrawState: Coding style cleanup


# 215119a1 28-Jan-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Move AlphaMask management into DrawState.

* Give DrawState a real copy constructor, handle deriving in PushState().
(Although clipping region and alpha mask are not cloned, which is on the
other hand just what's needed for now.)
* Combining alpha masks from previous states is not yet handled.
* Remove SetAlphaMask() from DrawingEngine and Painter. It is now done in
SetDrawState().


# 3fed1a15 05-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Get app_server working on x86_64.

With this commit, app_server now compiles and runs at boot! Nothing
particularly interesting happens, just the blue background and a mouse
pointer. Remote backends are broken and not compiled in, see #8834.
Note that it won't be possible to build this quite yet, need to get
the FreeType package uploaded.


# 12349c7d 05-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Begun to use structs for the BView<->app_server communication. This makes
the protocoll less prone to errors, reduces possible points of failure and
most importantly, reduces the number of function calls to the link API.
I only know the numbers for StrokeLine(), which I tested via the Benchmark
test app. With this change, drawing random colored and positioned lines
actually doubled in speed. On the BView side, the calls to
ServerLink::Attach() only halfed, while on the app_server side, the number
of calls to ServerLink::Read() is now 1/4th. It will also be worth
investigating why the link stuff is so slow at all. I also optimized
BView::DrawString() a lot in this change, but I don't have any numbers
yet. Some other commands which used multiple Attach()/Read() calls were
also optimized, at least the most important ones. Begin/EndLineArray() was
also pretty bad on the app_server side.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29937 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e44cfce 29-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Make BView::PopState() (executed at least on every call to Draw()) a lot
cheaper by preventing to rebuild the clipping on the app_server side.
I think this was commented out, because user clipping was broken until
some point and I forgot to reenable it after I fixed it. At least I cannot
spot any regressions when running with this patch now would I expect to
see regressions, since DrawStates do not mess with the screen clipping,
unless they get a clipping region assigned when the (user) clipping changes
during the state's life time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29773 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42cf2756 02-Apr-2008 Stephan Aßmus <superstippi@gmx.de>

The scale of a state does not influence the origin. Only previous states
and their origin and scale influences the current state's origin, since
they can be regarded as within the parent state's coordinate system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24740 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d81827b 30-Mar-2008 Karsten Heimrich <host.haiku@gmx.de>

* push the states on the server instead on the client side
* DrawState::SetOrigin needs to take the view scaling into account
* set the orgin in BPrintJob, to be able to print more then one page properly

Note: This would make printing work on HAIKU as on BeOS, but still it does
not because of 1; BPortLink size limit and 2; because we can only print/ draw
the visible region of a view? I had to resize StyledEdit to a i.e 10000
to test and to be able to print the full syslog.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24682 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79ef179c 17-Mar-2008 Stephan Aßmus <superstippi@gmx.de>

A test app revealed some bugs with regards to client provided clipping regions:
* It is necessary to store the local origin and scale of a view state, at
least for the clipping region and especially because the scale affects the
clipping region. Ie origin and scale of one state affect the clipping region,
at the time the clipping is evaluated, ie
SetOrigin(...);
ConstrainClippingRegion(...);
is equivalent to
ConstrainClippingRegion(...);
SetOrigin(...);
The current client provided clipping region at the time of PushState()
always constrains the region of the new state. The previous region
and the current local clipping may have their own individual origin and
scale.
To support all this, I needed to store origin and scale of each state on
the stack, but I do cache the combined origin and scale. Caching only
the combined region is not possible though. So the new implementation
is slower than the previous, but more correct.
* Refactored "copy constructor" from DrawState, which is not really a copy
constructor anyways, made it private. It is only used by PushState().
* Removed some dead code from DrawState.

All this improves Firefox redraw issues a tiny bit, but does not fix them.
Either I am not covering Firefox needs with my test app, or the bug is
somewhere else. At least Haiku behaves like BeOS with regard to client
clipping regions and the state stack now...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24428 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f7e1df75 16-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* get rid of RGBColor usage where it is not needed, this simplified many things,
possibly making them a little faster too
* mess with decorator button size calculation to make the whole layout scale
more agreeable with the font size (no more fixed offsets/insets), but it
is work in progress
* DefaultDecorator no longer allocated the border color array, it is part of
the object now
* small memory footprint optimizations in ViewLayer, Decorator and WindowLayer


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1623ec92 17-Aug-2007 Michael Pfeiffer <michael.w.pfeiffer@gmail.com>

Bug fixes:
* origin is given in "outer" coordinate system therefore if there is a
previous state it has to be transformed. Please review if this is
required in OffsetOrigin() too.
* in Transform() we have to scale relative to the view origin not (0 /
0).

- optimized SetScale: saved one division


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21993 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aaa42c7e 08-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* added a way to get the unscaled pensize (ie that of the current draw state
of a view)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21852 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 10f6ed94 17-Dec-2006 Stephan Aßmus <superstippi@gmx.de>

* implemented "false bold" for text rendering. It is a new property
of BFont. You can BFont::SetFalseBoldWidth(float) a width on a
BFont object, and it will cause the glyph shapes to be run through
an AGG "contour converter" so that they become thicker or thinner.
IIRC, this is commonly referred to as "false bold". The "width" value
is the distance in pixels that the new glyph outline will be offset
from the original outline.

It would be nice if someone could look at my change to View.h with
regards to the B_FONT_ALL flag.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19547 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3e58cde6 19-May-2006 Stephan Aßmus <superstippi@gmx.de>

minor clean up

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17509 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f5659a76 11-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

Quick build fix, Stippi, can you review this?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16723 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d26af396 11-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

actually add the converted rects to the region

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16716 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e89843e 08-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

* when the client constrained the clipping on a view, the server used to
take an empty region as an indication to remove the clipping, but on R5,
this is actually valid... this patch fixes the problem
* the ViewState::clipping_region is now consistently used to memorize
the user defined clipping of the view state instead of being sometimes
used to cache the current view clipping


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16656 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b223f780 20-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

fixes origin and scale handling, it behaves mostly like R5 now (it is used for drawing only, yes not mouse coords or anything else). Also fixes offscreen layers clipping rebuilding when the user defined clipping is added or changed

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15040 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d2718b5d 13-Nov-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

we write family and style as an uint32, so we should read it as an uint32 too

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14906 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 41f78f78 10-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

the current clipping is the combined user defined clipping from all previous states

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14846 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 971ed3de 07-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

* origin in DrawState is now the summed up origin, when setting it,
use the origin from the previous state as a start
* this fixes scrolling again (minus redrawing too much stuff,
this is left for Adi :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14770 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c00fc4e3 06-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

default to B_MITER_JOIN too

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14727 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c2fd7b2 03-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed scale calculation. The scaling is still ignored for the drawing coordinations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14682 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aca4f50d 04-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Merged DrawData and LayerData to one class DrawState.
Removed that ambiguous second copy constructor and moved push state functionality
into a separate PushState() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14679 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 244796701b8c8768712cdaf6d1fb0690f2c05d08 17-Mar-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: store and restore fill rule...

...when sending the whole view state over the link.
Also inherit the fill rule when pushing states (DrawState
copy constructor). A somewhat sloppy oversight, I must add.


# eb431663264ef319e72b492801fb867b5d71910b 11-Mar-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

app_server & interface kit: support fill rules.

* BView gets SetFillRule/FillRule methods. The fill rule is part of the
view state.
* The B_NONZERO rule is the default. This is what we implemented before.
* The B_EVEN_ODD rule is the other common possibility for this, and
we need to support it to help WebKit to render properly.


# a4655126c91d22f8241d53e052bc975b8145ff28 26-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Fix applying current scale when font changes.

* The code path actually used when the client uses BView::SetFont()
is DrawState::ReadFontFromLink(), where it forgot to a) adopt the
original font size in fUnscaledFontSize and b) scale the font by the
current combined scale. Fixes remaining part of #10578.


# 897f5562f9dfb213805d8a84c7de3b668a1380ee 04-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

Remove transform again from drawing coord conversion


# a6db6bd40fe3492fd3104dba560f0e3ff61d388d 04-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

Added WIP support for affine transformations to BViews.

Everything untested, but compiles, so it must work. The idea is to introduce
BAffineTransform additionally to the existing Origin and Scale properties of
BViews. One may use it in parallel or as an alternative. Painter in app_server
is not yet aware of the additional transformation. It is however already used
to transform drawing coordinates. It probably needs to work differently,
perhaps only in Painter and AGGTextRenderer.


# 77214b5abc6721fed46b997425b716b05169eb10 03-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Implemented nested clipping paths

* The alpha mask is no longer stored with 75% more memory than needed,
resolving a TODO.
* AlphaMasks are now BReferenceables.
* AlphaMasks are transferred to a pushed DrawState.
* When an AlphaMask is set on a DrawState, it sets the previous state's
mask to the AlphaMask. That one now takes care of updating not only itself,
but the previous mask as well (which works recursively).
* In AlphaMask::Generate(), a combination happens with the previous state's
mask, which again works recursively in case the previous mask also needs
to be updated. This step is combined with extracting the alpha channel from
the UtilityBitmap used to play the ServerPicture.
* Fixed some out of bounds access to memory in the "outside" case in
agg_clipped_alpha_mask.h. This happened when the requested region was
both before and after where the mask has data.


# ad3318b33ddeb82da503236224bbf41c98fd9262 01-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

DrawState: Coding style cleanup


# 215119a1e73029a7165a1c01dfa3ceb4a90d44bf 28-Jan-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Move AlphaMask management into DrawState.

* Give DrawState a real copy constructor, handle deriving in PushState().
(Although clipping region and alpha mask are not cloned, which is on the
other hand just what's needed for now.)
* Combining alpha masks from previous states is not yet handled.
* Remove SetAlphaMask() from DrawingEngine and Painter. It is now done in
SetDrawState().


# 3fed1a15f58e8d6fe6b492f3b94bb3625ffeddbd 05-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Get app_server working on x86_64.

With this commit, app_server now compiles and runs at boot! Nothing
particularly interesting happens, just the blue background and a mouse
pointer. Remote backends are broken and not compiled in, see #8834.
Note that it won't be possible to build this quite yet, need to get
the FreeType package uploaded.


# 12349c7d3d445aa2bb4d737e5c7bcf135cca1d69 05-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Begun to use structs for the BView<->app_server communication. This makes
the protocoll less prone to errors, reduces possible points of failure and
most importantly, reduces the number of function calls to the link API.
I only know the numbers for StrokeLine(), which I tested via the Benchmark
test app. With this change, drawing random colored and positioned lines
actually doubled in speed. On the BView side, the calls to
ServerLink::Attach() only halfed, while on the app_server side, the number
of calls to ServerLink::Read() is now 1/4th. It will also be worth
investigating why the link stuff is so slow at all. I also optimized
BView::DrawString() a lot in this change, but I don't have any numbers
yet. Some other commands which used multiple Attach()/Read() calls were
also optimized, at least the most important ones. Begin/EndLineArray() was
also pretty bad on the app_server side.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29937 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e44cfce6671cbb0a5a1658fbb197899def3c73b 29-Mar-2009 Stephan Aßmus <superstippi@gmx.de>

Make BView::PopState() (executed at least on every call to Draw()) a lot
cheaper by preventing to rebuild the clipping on the app_server side.
I think this was commented out, because user clipping was broken until
some point and I forgot to reenable it after I fixed it. At least I cannot
spot any regressions when running with this patch now would I expect to
see regressions, since DrawStates do not mess with the screen clipping,
unless they get a clipping region assigned when the (user) clipping changes
during the state's life time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29773 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42cf275606b3618cce838a5939494fbd7493ee25 02-Apr-2008 Stephan Aßmus <superstippi@gmx.de>

The scale of a state does not influence the origin. Only previous states
and their origin and scale influences the current state's origin, since
they can be regarded as within the parent state's coordinate system.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24740 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d81827b2c7e74821b00e8ad546166a00dec1e4b 30-Mar-2008 Karsten Heimrich <host.haiku@gmx.de>

* push the states on the server instead on the client side
* DrawState::SetOrigin needs to take the view scaling into account
* set the orgin in BPrintJob, to be able to print more then one page properly

Note: This would make printing work on HAIKU as on BeOS, but still it does
not because of 1; BPortLink size limit and 2; because we can only print/ draw
the visible region of a view? I had to resize StyledEdit to a i.e 10000
to test and to be able to print the full syslog.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24682 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79ef179c52ff23c1338a34a95452114d51bffeda 17-Mar-2008 Stephan Aßmus <superstippi@gmx.de>

A test app revealed some bugs with regards to client provided clipping regions:
* It is necessary to store the local origin and scale of a view state, at
least for the clipping region and especially because the scale affects the
clipping region. Ie origin and scale of one state affect the clipping region,
at the time the clipping is evaluated, ie
SetOrigin(...);
ConstrainClippingRegion(...);
is equivalent to
ConstrainClippingRegion(...);
SetOrigin(...);
The current client provided clipping region at the time of PushState()
always constrains the region of the new state. The previous region
and the current local clipping may have their own individual origin and
scale.
To support all this, I needed to store origin and scale of each state on
the stack, but I do cache the combined origin and scale. Caching only
the combined region is not possible though. So the new implementation
is slower than the previous, but more correct.
* Refactored "copy constructor" from DrawState, which is not really a copy
constructor anyways, made it private. It is only used by PushState().
* Removed some dead code from DrawState.

All this improves Firefox redraw issues a tiny bit, but does not fix them.
Either I am not covering Firefox needs with my test app, or the bug is
somewhere else. At least Haiku behaves like BeOS with regard to client
clipping regions and the state stack now...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24428 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f7e1df75609966bdfdb4ed39edf26dd145d8221f 16-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* get rid of RGBColor usage where it is not needed, this simplified many things,
possibly making them a little faster too
* mess with decorator button size calculation to make the whole layout scale
more agreeable with the font size (no more fixed offsets/insets), but it
is work in progress
* DefaultDecorator no longer allocated the border color array, it is part of
the object now
* small memory footprint optimizations in ViewLayer, Decorator and WindowLayer


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1623ec928975ad3378d13f9944432dea7d04dbe5 17-Aug-2007 Michael Pfeiffer <michael.w.pfeiffer@gmail.com>

Bug fixes:
* origin is given in "outer" coordinate system therefore if there is a
previous state it has to be transformed. Please review if this is
required in OffsetOrigin() too.
* in Transform() we have to scale relative to the view origin not (0 /
0).

- optimized SetScale: saved one division


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21993 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aaa42c7e223b458bbf0e4a2ded7197d9234f76d8 08-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* added a way to get the unscaled pensize (ie that of the current draw state
of a view)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21852 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 10f6ed940bffa4153ff5511897bcc823b1f2d792 17-Dec-2006 Stephan Aßmus <superstippi@gmx.de>

* implemented "false bold" for text rendering. It is a new property
of BFont. You can BFont::SetFalseBoldWidth(float) a width on a
BFont object, and it will cause the glyph shapes to be run through
an AGG "contour converter" so that they become thicker or thinner.
IIRC, this is commonly referred to as "false bold". The "width" value
is the distance in pixels that the new glyph outline will be offset
from the original outline.

It would be nice if someone could look at my change to View.h with
regards to the B_FONT_ALL flag.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19547 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3e58cde6dce2f28cf3ec221eabb36c439532b80d 19-May-2006 Stephan Aßmus <superstippi@gmx.de>

minor clean up

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17509 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f5659a7615ec94d742c3e9898439871f2044c09d 11-Mar-2006 Axel Dörfler <axeld@pinc-software.de>

Quick build fix, Stippi, can you review this?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16723 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d26af39650e7d56c8d8941041d54259fcf81733e 11-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

actually add the converted rects to the region

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16716 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e89843efc34fa0df08f8986bc1db421e13422e7 08-Mar-2006 Stephan Aßmus <superstippi@gmx.de>

* when the client constrained the clipping on a view, the server used to
take an empty region as an indication to remove the clipping, but on R5,
this is actually valid... this patch fixes the problem
* the ViewState::clipping_region is now consistently used to memorize
the user defined clipping of the view state instead of being sometimes
used to cache the current view clipping


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16656 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b223f7804125d5a1cc0f397085125930a7a93a22 20-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

fixes origin and scale handling, it behaves mostly like R5 now (it is used for drawing only, yes not mouse coords or anything else). Also fixes offscreen layers clipping rebuilding when the user defined clipping is added or changed

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15040 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d2718b5d341fa5538b15301c0b26b211e094ffe5 13-Nov-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

we write family and style as an uint32, so we should read it as an uint32 too

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14906 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 41f78f788431dea860a5438fb66beaa3b486bd28 10-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

the current clipping is the combined user defined clipping from all previous states

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14846 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 971ed3de1e9903f6c997fb61a1b42e8bb55ea879 07-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

* origin in DrawState is now the summed up origin, when setting it,
use the origin from the previous state as a start
* this fixes scrolling again (minus redrawing too much stuff,
this is left for Adi :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14770 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c00fc4e31a8312537481a98fba1c0be6ba354e0b 06-Nov-2005 Stephan Aßmus <superstippi@gmx.de>

default to B_MITER_JOIN too

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14727 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c2fd7b2379219c253bed0a0ffd99aadba4303fa 03-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Fixed scale calculation. The scaling is still ignored for the drawing coordinations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14682 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aca4f50d1eefef8bf137cc16f5b707d223494377 04-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Merged DrawData and LayerData to one class DrawState.
Removed that ambiguous second copy constructor and moved push state functionality
into a separate PushState() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14679 a95241bf-73f2-0310-859d-f6bbb57e9c96