Opened 3 years ago

Closed 3 years ago

#17298 closed bug (fixed)

Images in WebPositive are one pixel smaller than they should be

Reported by: hgsfghs Owned by: pulkomandy
Priority: normal Milestone: R1/beta4
Component: Kits/Web Kit Version: R1/beta3
Keywords: Cc: nephele
Blocked By: Blocking:
Platform: All

Description

Images in WebPositive end up one pixel smaller in both directions.

It's particularly noticable with sites like http://toastytech.com/guis/, which use small images with icons on the sidebar, where the 1-pixel wide borders present on some these icons get truncated.

Thanks.

Change History (5)

comment:2 by waddlesplash, 3 years ago

Cc: nephele added

CC nephele, if you have some time, can you experiment with the arithmetic in that file and see if it fixes this problem (and potentially others)?

comment:3 by pulkomandy, 3 years ago

The images are not smaller. They are larger.

The rectangle where the image is drawn is 16x16px, which is the image size and is also forced by the CSS. However, it seems the image itself is slightly scaled up to 17x17px, and the last column of pixels is truncated.

The FloatRect/BRect conversions appear correct to me, the need for the +1/-1 is because BRect origin is in the middle of the first pixel, and as far as I know, FloatRect origin is at the top left of the first pixel. So there is a 0.5px difference on each side.

You can confirm this in BBitmap code, where the bytes per row is computed based on bounds.IntegerWidth() + 1 (so a width of 15 will result on allocating and drawing 16 pixels).

I can't find any documentation on FloatRect and how it is aligned to pixels, however. But if this was wrong, everything else using rectangles would also be off by one pixel? Surely this would result in a lot more glitches?

comment:4 by pulkomandy, 3 years ago

Status: newin-progress

comment:5 by pulkomandy, 3 years ago

Milestone: UnscheduledR1/beta4
Resolution: fixed
Status: in-progressclosed

Fixed in https://github.com/haiku/haikuwebkit/commit/3f92bc6ac8993dfe8fe749cc16a175c20b7a6b14

This will be part of the next haikuwebkit release.

Note: See TracTickets for help on using tickets.