summaryrefslogtreecommitdiff
path: root/src/sna/sna_display_fake.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-25 11:26:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-25 11:44:10 +0100
commitc1dbbe69ada3323a82ebd672e9ef47a0d95911c9 (patch)
tree91be77a1ea378170d0e8f815854b5fce653df333 /src/sna/sna_display_fake.c
parent097c2567939f2063749acf0bc768df7bb002d535 (diff)
sna: Make SetScreenPixmap do as it says
Make sna_set_screen_pixmap() a little more complete and remove the assertion that the caller manages sna->front. This should make the function easier to reuse. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_display_fake.c')
-rw-r--r--src/sna/sna_display_fake.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/sna/sna_display_fake.c b/src/sna/sna_display_fake.c
index 113c44ac..6231eb52 100644
--- a/src/sna/sna_display_fake.c
+++ b/src/sna/sna_display_fake.c
@@ -202,9 +202,8 @@ sna_output_fake(struct sna *sna)
static Bool
sna_mode_resize(ScrnInfoPtr scrn, int width, int height)
{
- struct sna *sna = to_sna(scrn);
ScreenPtr screen = scrn->pScreen;
- PixmapPtr old_front, new_front;
+ PixmapPtr new_front;
DBG(("%s (%d, %d) -> (%d, %d)\n", __FUNCTION__,
scrn->virtualX, scrn->virtualY,
@@ -213,28 +212,27 @@ sna_mode_resize(ScrnInfoPtr scrn, int width, int height)
if (scrn->virtualX == width && scrn->virtualY == height)
return TRUE;
- assert(sna->front);
- assert(screen->GetScreenPixmap(screen) == sna->front);
+ assert(to_sna_from_screen(screen)->front);
+ assert(screen->GetScreenPixmap(screen) == to_sna_from_screen(screen)->front);
DBG(("%s: creating new framebuffer %dx%d\n",
__FUNCTION__, width, height));
- old_front = sna->front;
new_front = screen->CreatePixmap(screen,
width, height, scrn->depth,
- SNA_CREATE_FB);
+ 0);
if (!new_front)
return FALSE;
- sna->front = new_front;
scrn->virtualX = width;
scrn->virtualY = height;
scrn->displayWidth = width;
- screen->SetScreenPixmap(sna->front);
- assert(screen->GetScreenPixmap(screen) == sna->front);
+ screen->SetScreenPixmap(new_front);
+ assert(screen->GetScreenPixmap(screen) == new_front);
+ assert(to_sna_from_screen(screen)->front == new_front);
- screen->DestroyPixmap(old_front);
+ screen->DestroyPixmap(new_front);
return TRUE;
}