Figure out why converting a gfxImageSurface to a DataSourceSurface using GetSourceSurfaceForSurface changes the pixel data

NEW
Unassigned

Status

()

defect
5 years ago
5 years ago

People

(Reporter: jwatt, Unassigned)

Tracking

29 Branch
x86
Windows 7
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Reporter

Description

5 years ago
In bug 975900 I discovered that when you convert a gfxImageSurface to a DataSourceSurface using GetSourceSurfaceForSurface it can change the pixel data so that it does not match the original gfxImageSurface. That's bad and we need to figure out why and fix the issue.

This may block the final conversion of imgIContainer::GetFrame to Moz2D (bug 950372) since image\test\unit\test_imgtools.js and toolkit\components\places\tests\favicons\test_favicons_conversions.js test for an exact pixel match.
Reporter

Comment 1

5 years ago
This is only an issue on Windows.
Reporter

Comment 2

5 years ago
In bug 975900 the issue occurred with test 3, "test encoding an unscaled JPEG":

http://mxr.mozilla.org/mozilla-central/source/image/test/unit/test_imgtools.js?rev=649a09e4524&mark=184-184,191-191#179

In other words for this test things go wrong under the GetFirstImageFrame call in imgTools::EncodeImage:

http://mxr.mozilla.org/mozilla-central/source/image/src/imgTools.cpp?rev=649a09e4524&mark=164-164#158
Reporter

Comment 3

5 years ago
This debugging code adds some code to check the result of the current method of getting the pixel data with the (broken) GetSourceSurfaceForSurface method we'd prefer to use. With it you can run:

  ./mach xpcshell-test image/test/unit/test_imgtools.js

and get a debugger attached just before the bad GetFirstImageFrame call (start stepping the second time it's hit).
Reporter

Comment 4

5 years ago
For the broken test there are 4096 pixels; 3573 pixels are the same and 523 pixels are different.
Reporter

Comment 5

5 years ago
Oh, and enabling the |#if 0| code gets things working, so this is only an issue if passing nullptr to GetSourceSurfaceForSurface so that it uses a screen reference (platform native) draw target.
You need to log in before you can comment on or make changes to this bug.