google-chromepluginsgraphicsfirebreathwindowless

Chrome plugin window image inverted


We are working on a video player plugin with FireBreath. It has a windowless mode, and in Chrome on Windows it produces a very strange effect.

Whenever we try to paint in the hdc the pixels appear either in the right colour or inverted, depending of the value of the most significant bit in any of the 3 channels.

This means that in full colour depth on average half of the pixels appear inverted, while the other half is fine. It is the same both when displaying a video frame using StretchDIBits(), and when just filling with solid colours with FillRect(). The SetStretchBltMode() is set to COLORONCOLOR.

We could not find a solution so far, our temporary hack is to convert the colours to half the depth and set all the most significant bits to 1, but it's obviously a bad solution for the waste of CPU effort and losing half the colour depth.


Solution

  • Yeah, Chrome has a weird bug that way. The easiest fix is to set your background color to black behind the window; there is a whole thread on this on the firebreath-dev group.

    EDIT: bug might actually not be the right term, on reflection; it has an interesting implementation that way =]