Closed
Bug 898993
Opened 11 years ago
Closed 11 years ago
the creation of thumbnail size is not compatible to hdpi device
Categories
(Firefox OS Graveyard :: Gaia::Video, defect)
Tracking
(blocking-b2g:hd+, b2g-v1.1hd fixed)
People
(Reporter: johnhu, Assigned: johnhu)
Details
Attachments
(3 files)
The thumbnail size is calculated with 210 * window.innerWidth / 320 and 120 * window.innerWidth / 320. When we use HDPI device (1.5x), the width/height may not be sufficient. It should multiply window.devicePixelRatio to create more sharpened image
Assignee | ||
Updated•11 years ago
|
blocking-b2g: --- → hd?
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → johu
Assignee | ||
Comment 1•11 years ago
|
||
The original implementation about scale ratio may be incorrect.First, It uses window.innerWidth / 320 to calculate the ratio. But in HDPI device, the window.innerWidth is still 320 (css pixel), but the real device pixel is 480. Second, this implementation doesn't take care about orientation of device. When the creation of thumbnail executing, it uses pre-calculated width and height based on scale ratio to create thumbnail. So, the thumbnail will always be 210x120, if it is in portrait mode. If it is in landscape mode, thumbnail will always be 315x180. But in css, it is configured as 21rem x 12rem and centered in the container. So, the thumbnail created in landscape mode will be cropped. This doesn't make sense. This patch uses devicePixelRatio to calculate the scale ratio. When user uses non-hdpi device, this value is 1 and the thumbnail will be 210x120. When user uses hdpi device, this value is 1.5 and the thumbnail will be 315x180. In css, I configured it as 100% in background-size which makes thumbnail to scale to full size of its container which is 21rem x 12rem. The attachments are single preview image and its screenshot.
Attachment #782500 -
Flags: review?(rexboy)
Attachment #782500 -
Flags: review?(dflanagan)
Assignee | ||
Comment 2•11 years ago
|
||
Assignee | ||
Comment 3•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #782501 -
Attachment description: device-screen-shot.png → device screenshot after patched
Comment 4•11 years ago
|
||
Comment on attachment 782500 [details]
use devicePixelRatio to get the correct image size
I'm OK with this patch.
Thanks for your work!
Attachment #782500 -
Flags: review?(rexboy) → review+
Comment 6•11 years ago
|
||
Comment on attachment 782500 [details]
use devicePixelRatio to get the correct image size
This is a nice simple patch. Thanks for explaining it clearly. I get confused with the high dpi stuff. Also, nice catch about the bug when the video app is launched in landscape mode!
I have one very minor nit on github, and suggest that you test this patch on a high dpi device with a very small video, like a video recorded as an MMS attachment. If the video is smaller than the thumbnail size, does it do the right thing?
Attachment #782500 -
Flags: review?(dflanagan) → review+
Updated•11 years ago
|
Flags: needinfo?(johu)
Assignee | ||
Comment 7•11 years ago
|
||
merged to master: https://github.com/mozilla-b2g/gaia/commit/49b1f68b0e2152557bb7c2defb2a5f9d7a0648c6
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: needinfo?(johu)
Resolution: --- → FIXED
Updated•11 years ago
|
status-b2g-v1.1hd:
--- → affected
Keywords: checkin-needed
Assignee | ||
Comment 9•11 years ago
|
||
merged to v1.1.0hd: https://github.com/mozilla-b2g/gaia/commit/9036cbea337897593779cb053ae285acc3201e43
You need to log in
before you can comment on or make changes to this bug.
Description
•