зеркало из https://github.com/mozilla/pjs.git
b=480088; use a single cached data block for painting with image surfaces on Windows CE; r=stuart
This commit is contained in:
Родитель
a795d22323
Коммит
5999eaa825
|
@ -169,6 +169,11 @@
|
|||
// out to the bounding-box if there are more
|
||||
#define MAX_RECTS_IN_REGION 100
|
||||
|
||||
#ifdef PAINT_USE_IMAGE_SURFACE
|
||||
static nsAutoPtr<PRUint8> gSharedSurfaceData;
|
||||
static gfxIntSize gSharedSurfaceSize;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WinCE helpers
|
||||
*/
|
||||
|
@ -6075,10 +6080,37 @@ PRBool nsWindow::OnPaint(HDC aDC)
|
|||
targetSurface = new gfxWindowsSurface(hDC);
|
||||
}
|
||||
#elif defined(PAINT_USE_IMAGE_SURFACE)
|
||||
if (!gSharedSurfaceData) {
|
||||
gSharedSurfaceSize.height = GetSystemMetrics(SM_CYSCREEN);
|
||||
gSharedSurfaceSize.width = GetSystemMetrics(SM_CXSCREEN);
|
||||
gSharedSurfaceData = (PRUint8*) malloc(gSharedSurfaceSize.width * gSharedSurfaceSize.height * 4);
|
||||
}
|
||||
|
||||
gfxIntSize surfaceSize(ps.rcPaint.right - ps.rcPaint.left,
|
||||
ps.rcPaint.bottom - ps.rcPaint.top);
|
||||
nsRefPtr<gfxImageSurface> targetSurface = new gfxImageSurface(surfaceSize,
|
||||
gfxASurface::ImageFormatRGB24);
|
||||
|
||||
nsRefPtr<gfxImageSurface> targetSurface;
|
||||
|
||||
if (!gSharedSurfaceData ||
|
||||
surfaceSize.width > gSharedSurfaceSize.width ||
|
||||
surfaceSize.height > gSharedSurfaceSize.height)
|
||||
{
|
||||
#ifdef DEBUG_vladimir
|
||||
RETAILMSG(1, (L"OnPaint: Paint area bigger than screen! Screen %dx%d, surface %dx%d, HWND %p\r\n", gSharedSurfaceSize.width, gSharedSurfaceSize.height, surfaceSize.width, surfaceSize.height, mWnd));
|
||||
#endif
|
||||
|
||||
// allocate a new oversize surface; hopefully this will just be a one-time thing,
|
||||
// and we should really fix whatever's doing it!
|
||||
targetSurface = new gfxImageSurface(surfaceSize, gfxASurface::ImageFormatRGB24);
|
||||
} else {
|
||||
// don't use the shared surface directly; instead, create a new one
|
||||
// that just reuses its buffer.
|
||||
targetSurface = new gfxImageSurface(gSharedSurfaceData.get(),
|
||||
surfaceSize,
|
||||
surfaceSize.width * 4,
|
||||
gfxASurface::ImageFormatRGB24);
|
||||
}
|
||||
|
||||
if (targetSurface && !targetSurface->CairoStatus()) {
|
||||
targetSurface->SetDeviceOffset(gfxPoint(-ps.rcPaint.left, -ps.rcPaint.top));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче