Performance Optimization: Do not create a writeable GC on every

instantiation of a rendering context.  Re-use the old one.
This commit is contained in:
spider%netscape.com 1998-07-16 22:02:36 +00:00
Родитель 329f22d194
Коммит bd87c6c4f2
1 изменённых файлов: 2 добавлений и 14 удалений

Просмотреть файл

@ -126,10 +126,6 @@ nsRenderingContextUnix :: ~nsRenderingContextUnix()
// Destroy the front buffer and it's GC if one was allocated for it
if (nsnull != mFrontBuffer) {
if (mFrontBuffer != mRenderingSurface) {
::XFreeGC(mFrontBuffer->display,
mFrontBuffer->gc);
}
delete mFrontBuffer;
}
@ -233,14 +229,6 @@ nsresult nsRenderingContextUnix :: CommonInit()
nsresult nsRenderingContextUnix :: SelectOffScreenDrawingSurface(nsDrawingSurface aSurface)
{
if (mFrontBuffer == mRenderingSurface) {
XGCValues values;
mFrontBuffer->gc = ::XCreateGC(mRenderingSurface->display,
mRenderingSurface->drawable,
nsnull, &values);
}
mRenderingSurface = (nsDrawingSurfaceUnix *) aSurface;
return NS_OK;
}
@ -675,7 +663,7 @@ nsDrawingSurface nsRenderingContextUnix :: CreateDrawingSurface(nsRect *aBounds)
surface->drawable = p ;
surface->display = mRenderingSurface->display;
surface->gc = mFrontBuffer->gc;
surface->gc = mRenderingSurface->gc;
surface->visual = mRenderingSurface->visual;
surface->depth = mRenderingSurface->depth;
@ -1062,7 +1050,7 @@ nsresult nsRenderingContextUnix :: CopyOffScreenBits(nsRect &aBounds)
::XCopyArea(mRenderingSurface->display,
mRenderingSurface->drawable,
mFrontBuffer->drawable,
mFrontBuffer->gc,
mRenderingSurface->gc,
0,0, aBounds.width, aBounds.height, 0,0);
return NS_OK;