Commit d984a836 authored by Ulf Hermann's avatar Ulf Hermann

Timeline: Encode the "stretched" property in "a" rather than "id"

The way it was before, we couldn't have negative ids.

Change-Id: I2ac07295b18020fc1a9357e15739bbf2601d20b6
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Ulf Hermann's avatarUlf Hermann <ulf.hermann@qt.io>
parent 4f9b4b14
......@@ -143,10 +143,8 @@ float OpaqueColoredPoint2DWithSize::top() const
void OpaqueColoredPoint2DWithSize::update(float nr, float ny)
{
if (id > -1)
id = -2;
else
--id;
if (a <= MaximumDirection)
a += MaximumDirection;
y += ny;
w = nr - x;
......@@ -154,13 +152,13 @@ void OpaqueColoredPoint2DWithSize::update(float nr, float ny)
OpaqueColoredPoint2DWithSize::Direction OpaqueColoredPoint2DWithSize::direction() const
{
return static_cast<Direction>(a);
return static_cast<Direction>(a > MaximumDirection ? a - MaximumDirection : a);
}
void OpaqueColoredPoint2DWithSize::setCommon(const OpaqueColoredPoint2DWithSize *master)
{
a = 255;
if (master->id < 0) {
if (master->a > MaximumDirection) {
id = std::numeric_limits<float>::lowest();
r = g = b = 128;
} else {
......
......@@ -59,7 +59,8 @@ public:
enum Direction {
InvalidDirection,
TopToBottom,
BottomToTop
BottomToTop,
MaximumDirection
};
void set(float nx, float ny, float nw, float nh, float nid, uchar nr, uchar ng, uchar nb,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment