зеркало из https://github.com/mozilla/gecko-dev.git
Bug 907011 - Expose cairo objects from gfxContext when using Azure/cairo. r=Bas
This commit is contained in:
Родитель
6cd20c1e43
Коммит
1bfd3d4370
|
@ -1026,6 +1026,9 @@ DrawTargetCairo::GetNativeSurface(NativeSurfaceType aType)
|
|||
if (aType == NATIVE_SURFACE_CAIRO_SURFACE) {
|
||||
return cairo_get_target(mContext);
|
||||
}
|
||||
if (aType == NATIVE_SURFACE_CAIRO_CONTEXT) {
|
||||
return mContext;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ enum NativeSurfaceType
|
|||
{
|
||||
NATIVE_SURFACE_D3D10_TEXTURE,
|
||||
NATIVE_SURFACE_CAIRO_SURFACE,
|
||||
NATIVE_SURFACE_CAIRO_CONTEXT,
|
||||
NATIVE_SURFACE_CGCONTEXT,
|
||||
NATIVE_SURFACE_CGCONTEXT_ACCELERATED
|
||||
};
|
||||
|
|
|
@ -138,7 +138,19 @@ gfxContext::~gfxContext()
|
|||
gfxASurface *
|
||||
gfxContext::OriginalSurface()
|
||||
{
|
||||
return mSurface;
|
||||
if (mCairo || mSurface) {
|
||||
return mSurface;
|
||||
}
|
||||
|
||||
if (mOriginalDT && mOriginalDT->GetType() == BACKEND_CAIRO) {
|
||||
cairo_surface_t *s =
|
||||
(cairo_surface_t*)mOriginalDT->GetNativeSurface(NATIVE_SURFACE_CAIRO_SURFACE);
|
||||
if (s) {
|
||||
mSurface = gfxASurface::Wrap(s);
|
||||
return mSurface;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
|
@ -157,6 +169,16 @@ gfxContext::CurrentSurface(gfxFloat *dx, gfxFloat *dy)
|
|||
cairo_surface_get_device_offset(s, dx, dy);
|
||||
return gfxASurface::Wrap(s);
|
||||
} else {
|
||||
if (mDT->GetType() == BACKEND_CAIRO) {
|
||||
cairo_surface_t *s =
|
||||
(cairo_surface_t*)mDT->GetNativeSurface(NATIVE_SURFACE_CAIRO_SURFACE);
|
||||
if (s) {
|
||||
if (dx && dy)
|
||||
cairo_surface_get_device_offset(s, dx, dy);
|
||||
return gfxASurface::Wrap(s);
|
||||
}
|
||||
}
|
||||
|
||||
if (dx && dy) {
|
||||
*dx = *dy = 0;
|
||||
}
|
||||
|
@ -172,6 +194,14 @@ gfxContext::GetCairo()
|
|||
return mCairo;
|
||||
}
|
||||
|
||||
if (mDT->GetType() == BACKEND_CAIRO) {
|
||||
cairo_t *ctx =
|
||||
(cairo_t*)mOriginalDT->GetNativeSurface(NATIVE_SURFACE_CAIRO_CONTEXT);
|
||||
if (ctx) {
|
||||
return ctx;
|
||||
}
|
||||
}
|
||||
|
||||
if (mRefCairo) {
|
||||
// Set transform!
|
||||
return mRefCairo;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "gfxWindowsSurface.h"
|
||||
#include "gfxAlphaRecovery.h"
|
||||
#include "gfxPattern.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
enum {
|
||||
RENDER_STATE_INIT,
|
||||
|
@ -182,7 +183,9 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
|
|||
bool
|
||||
gfxWindowsNativeDrawing::IsDoublePass()
|
||||
{
|
||||
if (!mContext->IsCairo()) {
|
||||
if (!mContext->IsCairo() &&
|
||||
(mContext->GetDrawTarget()->GetType() != mozilla::gfx::BACKEND_CAIRO ||
|
||||
mContext->GetDrawTarget()->IsDualDrawTarget())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче