mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 863635. Make gfxPlatform smarter about when we can use Moz2D for content rendering r=Bas
This commit is contained in:
parent
c069c2b5fb
commit
4f491064ec
@ -3212,7 +3212,7 @@ CanvasRenderingContext2D::DrawWindow(nsIDOMWindow* window, double x,
|
||||
// save and restore it
|
||||
Matrix matrix = mTarget->GetTransform();
|
||||
nsRefPtr<gfxContext> thebes;
|
||||
if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
|
||||
if (gfxPlatform::GetPlatform()->SupportsAzureContentForDrawTarget(mTarget)) {
|
||||
thebes = new gfxContext(mTarget);
|
||||
} else {
|
||||
nsRefPtr<gfxASurface> drawSurf;
|
||||
|
@ -728,6 +728,16 @@ DataDrawTargetDestroy(void *aTarget)
|
||||
static_cast<DrawTarget*>(aTarget)->Release();
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatform::SupportsAzureContentForDrawTarget(DrawTarget* aTarget)
|
||||
{
|
||||
if (!aTarget) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (1 << aTarget->GetType()) & mContentBackendBitmask;
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatform::UseAcceleratedSkiaCanvas()
|
||||
{
|
||||
@ -1286,6 +1296,7 @@ gfxPlatform::InitBackendPrefs(uint32_t aCanvasBitmask, uint32_t aContentBitmask)
|
||||
}
|
||||
mFallbackCanvasBackend = GetCanvasBackendPref(aCanvasBitmask & ~(1 << mPreferredCanvasBackend));
|
||||
mContentBackend = GetContentBackendPref(aContentBitmask);
|
||||
mContentBackendBitmask = aContentBitmask;
|
||||
}
|
||||
|
||||
/* static */ BackendType
|
||||
|
@ -227,10 +227,23 @@ public:
|
||||
CreateDrawTargetForFBO(unsigned int aFBOID, mozilla::gl::GLContext* aGLContext,
|
||||
const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
||||
|
||||
/**
|
||||
* Returns true if we will render content using Azure using a gfxPlatform
|
||||
* provided DrawTarget.
|
||||
*/
|
||||
bool SupportsAzureContent() {
|
||||
return GetContentBackend() != mozilla::gfx::BACKEND_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if we should use Azure to render content with aTarget. For
|
||||
* example, it is possible that we are using Direct2D for rendering and thus
|
||||
* using Azure. But we want to render to a CairoDrawTarget, in which case
|
||||
* SupportsAzureContent will return true but SupportsAzureContentForDrawTarget
|
||||
* will return false.
|
||||
*/
|
||||
bool SupportsAzureContentForDrawTarget(mozilla::gfx::DrawTarget* aTarget);
|
||||
|
||||
virtual bool UseAcceleratedSkiaCanvas();
|
||||
|
||||
void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {
|
||||
@ -628,6 +641,8 @@ private:
|
||||
mozilla::gfx::BackendType mFallbackCanvasBackend;
|
||||
// The backend to use for content
|
||||
mozilla::gfx::BackendType mContentBackend;
|
||||
// Bitmask of backend types we can use to render content
|
||||
uint32_t mContentBackendBitmask;
|
||||
|
||||
mozilla::widget::GfxInfoCollector<gfxPlatform> mAzureCanvasBackendCollector;
|
||||
bool mWorkAroundDriverBugs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user