Apparently this is possible, but not available. It is necessary for using Azure canvas, but being able to fallback from hardware to software canvases. Fonts might be an issue, in particular, Skia does not support Direct Write fonts at the moment.
Created attachment 622538 [details] [diff] [review] patch
Could you explain a little about why it is necessary? Why couldn't we use an Azure-Thebes wrappers gfxContext or create a surface around underlying data?
The problem I'm solving is, if (for some reason) we cannot create a canvas with the desired backend, then we fallback to a different backend. This is currently done when a canvas is created, if creating an Azure canvas fails, then a Thebes canvas is created instead. We want to get rid of Thebes canvas and only use Azure. But if creating an Azure canvas with the preferred backend fails, we want to fallback to something, probably Thebes. This patch adds support for that by changing the way that the gfxPlatform provides a DrawTarget (which required some refactoring of the way in which gfxPlatforms record their backend preferences). I'm afraid I don't see where the wrappers you suggest help. Which part of this do you think can be replaced?
Bas, I think we discussed on IRC why we need CreateDrawTargetForBackend. At the time I thought it was a refactoring that could be easily eliminated, but I'm trying to do that now, and it does not seem so easy. It is only used in CreateOffscreenDrawTarget, but either the preferred or fallback draw targets could be Cairo, and we need to go down a separate path if that is so. So we would have a fair bit of undesirable code duplication if we inline CreateDrawTargetForBackend. So, I think it is necessary, or at least desirable.
Created attachment 624994 [details] [diff] [review] patch Added a comment to GfxPlatform.h
Comment on attachment 624994 [details] [diff] [review] patch Review of attachment 624994 [details] [diff] [review]: ----------------------------------------------------------------- I'm r+'ing this but with the very explicit mention that this -cannot- be landed yet until we have a place where Cairo-Azure canvas is being tested!
Created attachment 669448 [details] patch rebased, carrying r=Bas