зеркало из https://github.com/mozilla/gecko-dev.git
adding support for GetThebesSurface() on windows so that we can remove a lot of code.
This commit is contained in:
Родитель
9f582b1de5
Коммит
fd4a3f5471
|
@ -260,6 +260,7 @@ NS_IMETHODIMP
|
|||
nsThebesDeviceContext::CreateRenderingContext(nsIView *aView,
|
||||
nsIRenderingContext *&aContext)
|
||||
{
|
||||
// This is currently only called by the caret code
|
||||
NS_ENSURE_ARG_POINTER(aView);
|
||||
NS_PRECONDITION(aView->HasWidget(), "View has no widget!");
|
||||
|
||||
|
@ -302,8 +303,6 @@ nsThebesDeviceContext::CreateRenderingContext(nsIWidget *aWidget,
|
|||
nsRefPtr<gfxASurface> surface(aWidget->GetThebesSurface());
|
||||
if (surface)
|
||||
rv = pContext->Init(this, surface);
|
||||
else
|
||||
rv = pContext->Init(this, aWidget);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aContext = pContext;
|
||||
NS_ADDREF(aContext);
|
||||
|
|
|
@ -75,16 +75,8 @@ nsThebesDrawingSurface::~nsThebesDrawingSurface()
|
|||
// destroy this before any other bits are destroyed,
|
||||
// in case they depend on them
|
||||
mSurface = nsnull;
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (mWidget)
|
||||
mWidget->FreeNativeData(mNativeWidget, NS_NATIVE_GRAPHIC);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_GTK2
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsThebesDrawingSurface::Init(nsThebesDeviceContext *aDC, gfxASurface *aSurface)
|
||||
{
|
||||
|
@ -141,40 +133,15 @@ nsThebesDrawingSurface::Init(nsThebesDeviceContext *aDC, PRUint32 aWidth, PRUint
|
|||
nsresult
|
||||
nsThebesDrawingSurface::Init (nsThebesDeviceContext *aDC, nsIWidget *aWidget)
|
||||
{
|
||||
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsThebesDrawingSurface::Init aDC %p aWidget %p\n", this, aDC, aWidget));
|
||||
|
||||
#ifdef MOZ_ENABLE_GTK2
|
||||
mNativeWidget = aWidget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
#elif XP_WIN
|
||||
mWidget = aWidget; // hold a pointer to this.. not a reference.. because we have to free the dc...
|
||||
mNativeWidget = aWidget->GetNativeData(NS_NATIVE_GRAPHIC);
|
||||
#else
|
||||
#error Write me!
|
||||
#endif
|
||||
|
||||
Init(aDC, mNativeWidget);
|
||||
|
||||
return NS_OK;
|
||||
NS_ERROR("Should never be called.");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsThebesDrawingSurface::Init (nsThebesDeviceContext *aDC, nsNativeWidget aWidget)
|
||||
{
|
||||
mDC = aDC;
|
||||
mNativeWidget = aWidget;
|
||||
mWidth = 0;
|
||||
mHeight = 0;
|
||||
|
||||
#ifdef MOZ_ENABLE_GTK2
|
||||
NS_ERROR("Should never be called.");
|
||||
#elif XP_WIN
|
||||
HDC nativeDC = (HDC)aWidget;
|
||||
mSurface = new gfxWindowsSurface(nativeDC);
|
||||
#else
|
||||
#error write me
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_GTK2
|
||||
|
|
|
@ -139,22 +139,8 @@ nsThebesRenderingContext::Init(nsIDeviceContext* aContext, nsIWidget *aWidget)
|
|||
NS_IMETHODIMP
|
||||
nsThebesRenderingContext::Init(nsIDeviceContext* aContext, nsIDrawingSurface *aSurface)
|
||||
{
|
||||
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::Init ctx %p ds %p\n", this, aContext, aSurface));
|
||||
|
||||
nsThebesDrawingSurface *cds = (nsThebesDrawingSurface *) aSurface;
|
||||
|
||||
mDeviceContext = aContext;
|
||||
mWidget = nsnull;
|
||||
|
||||
mLocalDrawingSurface = (nsThebesDrawingSurface *) cds;
|
||||
mDrawingSurface = mLocalDrawingSurface;
|
||||
|
||||
mThebes = new gfxContext(mLocalDrawingSurface->GetThebesSurface());
|
||||
|
||||
//mThebes->SetColor(gfxRGBA(1.0, 1.0, 1.0, 1.0));
|
||||
//mThebes->Paint();
|
||||
|
||||
return (CommonInit());
|
||||
NS_ERROR("Should never be called.");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче