[Webkit-unassigned] [Bug 28122] [Haiku] Adding some simple graphic files (IntPoint, =?UTF-8?Q?=20IntRect=E2=80=A6?=)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Aug 9 09:50:10 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28122





--- Comment #4 from Maxime Simon <simon.maxime at gmail.com>  2009-08-09 09:50:09 PDT ---
(In reply to comment #2)
> (From update of attachment 34407 [details])
> What does the color struct look like?  Could you just use a COMPILE_ASSERT to
> assert identical layout with the WebCore:RGBA32 type and not need to call
> make_color, etc?

Indeed rgb_color is a struct of { red, green, blue, alpha } like
WebCore::RGBA32, So I should change this.

> Why are the +1 needed for one way conversion:
>  38     , m_size(rect.Width() + 1, rect.Height() + 1)
> 
> and -1 is not needed the other way:
>  44     return BRect(BPoint(x(), y()), BSize(width(), height()));

I assume that the +1/-1 are from the previous port and are what was done in the
Syllable port. But I'm pretty sure they aren't necessary.

> It seems if BPoint is a float point you don't want to have it implicitly
> constructed.
>  IntPoint::IntPoint(const BPoint& point)
>  37     : m_x(static_cast<int>(point.x))
>  38     , m_y(static_cast<int>(point.y))
>  39 {
>  40 }
> 
> See how CGPoint is handled.

In CGPoint they used a static_cast as I did. :D

> I think you need to double-check how
> you do the B* to Float*/Int* conversions.  Since it seems that B* are all
> floating-point values, you can follow exactly what the CG* types do, since
> those are all floating point values.

I know that both BRect and BSize have IntegerWidth() and IntegerHeight()
methods, but BPoint needs a cast to int.
That's what I used, but I will check again, and at least remove the +1/-1.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list