We were allocating and re-allocating a view-sized buffer and then claiming it was 32x32. Cut that down to stop wastage. Also drop unused method.

This commit is contained in:
Kartikaya Gupta 2012-02-24 12:11:32 -05:00
parent 9969c98db4
commit 0c8abc000c
2 changed files with 1 additions and 25 deletions

View File

@ -823,18 +823,6 @@ nsWindow::GetLayerManager(PLayersChild*, LayersBackend, LayerManagerPersistence,
return mLayerManager;
}
gfxASurface*
nsWindow::GetThebesSurface()
{
/* This is really a dummy surface; this is only used when doing reflow, because
* we need a RenderingContext to measure text against.
*/
// XXX this really wants to return already_AddRefed, but this only really gets used
// on direct assignment to a gfxASurface
return new gfxImageSurface(gfxIntSize(5,5), gfxImageSurface::ImageFormatRGB24);
}
void
nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
{
@ -1183,16 +1171,7 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
event.region = tileRect;
#endif
static unsigned char *bits2 = NULL;
static gfxIntSize bitsSize(0, 0);
if (bitsSize.width != gAndroidBounds.width || bitsSize.height != gAndroidBounds.height) {
if (bits2) {
delete[] bits2;
}
bits2 = new unsigned char[gAndroidBounds.width * gAndroidBounds.height * 2];
bitsSize = gAndroidBounds;
}
static unsigned char *bits2 = new unsigned char[32 * 32 * 2];
nsRefPtr<gfxImageSurface> targetSurface =
new gfxImageSurface(bits2, gfxIntSize(32, 32), 32 * 2,
gfxASurface::ImageFormatRGB16_565);
@ -1217,8 +1196,6 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
return;
}
unsigned char *bits = NULL;
if (targetSurface->CairoStatus()) {
ALOG("### Failed to create a valid surface from the bitmap");
} else {

View File

@ -173,7 +173,6 @@ public:
LayersBackend aBackendHint = LayerManager::LAYERS_NONE,
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nsnull);
gfxASurface* GetThebesSurface();
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);