mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 01:08:21 +00:00
Bug 468399. Use image surfaces on windows mobile for performance reasons. r=vlad
This commit is contained in:
parent
7fad8f76a1
commit
6cc200565f
@ -111,7 +111,11 @@ already_AddRefed<gfxASurface>
|
|||||||
gfxWindowsPlatform::CreateOffscreenSurface(const gfxIntSize& size,
|
gfxWindowsPlatform::CreateOffscreenSurface(const gfxIntSize& size,
|
||||||
gfxASurface::gfxImageFormat imageFormat)
|
gfxASurface::gfxImageFormat imageFormat)
|
||||||
{
|
{
|
||||||
|
#ifndef WINCE
|
||||||
gfxASurface *surf = new gfxWindowsSurface(size, imageFormat);
|
gfxASurface *surf = new gfxWindowsSurface(size, imageFormat);
|
||||||
|
#else
|
||||||
|
gfxASurface *surf = new gfxImageSurface(size, imageFormat);
|
||||||
|
#endif
|
||||||
NS_IF_ADDREF(surf);
|
NS_IF_ADDREF(surf);
|
||||||
return surf;
|
return surf;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,8 @@
|
|||||||
#include "prlog.h"
|
#include "prlog.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
|
|
||||||
|
#include "gfxImageSurface.h"
|
||||||
|
|
||||||
#ifdef WINCE
|
#ifdef WINCE
|
||||||
#include "aygshell.h"
|
#include "aygshell.h"
|
||||||
#include "imm.h"
|
#include "imm.h"
|
||||||
@ -6028,6 +6030,7 @@ PRBool nsWindow::OnPaint(HDC aDC)
|
|||||||
(PRInt32) mWnd);
|
(PRInt32) mWnd);
|
||||||
#endif // NS_DEBUG
|
#endif // NS_DEBUG
|
||||||
|
|
||||||
|
#ifndef WINCE
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
nsRefPtr<gfxASurface> targetSurface;
|
nsRefPtr<gfxASurface> targetSurface;
|
||||||
if (eTransparencyTransparent == mTransparencyMode) {
|
if (eTransparencyTransparent == mTransparencyMode) {
|
||||||
@ -6040,11 +6043,21 @@ PRBool nsWindow::OnPaint(HDC aDC)
|
|||||||
#else
|
#else
|
||||||
nsRefPtr<gfxASurface> targetSurface = new gfxWindowsSurface(hDC);
|
nsRefPtr<gfxASurface> targetSurface = new gfxWindowsSurface(hDC);
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
nsRefPtr<gfxImageSurface> targetSurface = new gfxImageSurface(gfxIntSize(ps.rcPaint.right - ps.rcPaint.left,
|
||||||
|
ps.rcPaint.bottom - ps.rcPaint.top),
|
||||||
|
gfxASurface::ImageFormatRGB24);
|
||||||
|
if (targetSurface && !targetSurface->CairoStatus()) {
|
||||||
|
targetSurface->SetDeviceOffset(gfxPoint(-ps.rcPaint.left, -ps.rcPaint.top));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
nsRefPtr<gfxContext> thebesContext = new gfxContext(targetSurface);
|
nsRefPtr<gfxContext> thebesContext = new gfxContext(targetSurface);
|
||||||
thebesContext->SetFlag(gfxContext::FLAG_DESTINED_FOR_SCREEN);
|
thebesContext->SetFlag(gfxContext::FLAG_DESTINED_FOR_SCREEN);
|
||||||
|
|
||||||
#if defined(MOZ_XUL) && !defined(WINCE)
|
#ifndef WINCE
|
||||||
|
#if defined(MOZ_XUL)
|
||||||
if (eTransparencyGlass == mTransparencyMode && nsUXThemeData::sHaveCompositor) {
|
if (eTransparencyGlass == mTransparencyMode && nsUXThemeData::sHaveCompositor) {
|
||||||
thebesContext->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
|
thebesContext->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
|
||||||
} else if (eTransparencyTransparent == mTransparencyMode) {
|
} else if (eTransparencyTransparent == mTransparencyMode) {
|
||||||
@ -6061,6 +6074,7 @@ PRBool nsWindow::OnPaint(HDC aDC)
|
|||||||
// If we're not doing translucency, then double buffer
|
// If we're not doing translucency, then double buffer
|
||||||
thebesContext->PushGroup(gfxASurface::CONTENT_COLOR);
|
thebesContext->PushGroup(gfxASurface::CONTENT_COLOR);
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* ifndef WINCE */
|
||||||
|
|
||||||
nsCOMPtr<nsIRenderingContext> rc;
|
nsCOMPtr<nsIRenderingContext> rc;
|
||||||
nsresult rv = mContext->CreateRenderingContextInstance (*getter_AddRefs(rc));
|
nsresult rv = mContext->CreateRenderingContextInstance (*getter_AddRefs(rc));
|
||||||
@ -6086,11 +6100,21 @@ PRBool nsWindow::OnPaint(HDC aDC)
|
|||||||
// that displayed on the screen.
|
// that displayed on the screen.
|
||||||
UpdateTranslucentWindow();
|
UpdateTranslucentWindow();
|
||||||
} else if (result) {
|
} else if (result) {
|
||||||
|
|
||||||
|
#ifndef WINCE
|
||||||
// Only update if DispatchWindowEvent returned TRUE; otherwise, nothing handled
|
// Only update if DispatchWindowEvent returned TRUE; otherwise, nothing handled
|
||||||
// this, and we'll just end up painting with black.
|
// this, and we'll just end up painting with black.
|
||||||
thebesContext->PopGroupToSource();
|
thebesContext->PopGroupToSource();
|
||||||
thebesContext->SetOperator(gfxContext::OPERATOR_SOURCE);
|
thebesContext->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||||
thebesContext->Paint();
|
thebesContext->Paint();
|
||||||
|
#else
|
||||||
|
nsRefPtr<gfxASurface> winSurface = new gfxWindowsSurface(hDC);
|
||||||
|
nsRefPtr<gfxContext> winCtx = new gfxContext(winSurface);
|
||||||
|
|
||||||
|
winCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||||
|
winCtx->SetSource(targetSurface);
|
||||||
|
winCtx->Paint();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user