Confirmed users
699
edits
| Line 36: | Line 36: | ||
== drawWindow Example == | == drawWindow Example == | ||
Protocol | |||
sync protocol PDrawWindow { | sync protocol PDrawWindow { | ||
child: | child: | ||
Init(-w +r Shmem front, | |||
-r-w +r+w Shmem back); | |||
parent: | parent: | ||
sync | sync Drew(-r +r Shmem curFront, | ||
-r-w +r+w Shmem curBack, | -r-w +r+w Shmem curBack, | ||
DirtyRects[] dirty, | DirtyRects[] dirty, | ||
...) | ...) | ||
returns (-r-w +r+w Shmem newBack, | returns (-r-w +r+w Shmem newBack, | ||
-w +r Shmem newFront); | -w +r Shmem newFront, | ||
...); | |||
}; | }; | ||
| Line 55: | Line 58: | ||
chrome content | chrome content | ||
----------------------------------------- --------------------------- | ----------------------------------------- --------------------------- | ||
front = AllocShmem() | // --- Init sequence --- | ||
// front: rw rights | |||
front = AllocShmem() [recv ShmemCreated()] | |||
// front: rw rights // front: no rights | |||
back = AllocShmem() [recv ShmemCreated()] | back = AllocShmem() [recv ShmemCreated()] | ||
// back: rw rights | // back: rw rights // back: no rights | ||
// draw default background into |front| | // draw default background into |front| | ||
SendInit(front, back) | SendInit(front, back) recv Init(front, back) | ||
// front: r | // front: r, w reserved // front: r | ||
// back: no rights // back: rw | // back: no rights // back: rw | ||
// --- Steady state ---- | |||
// draw stuff | |||
SentDrew(front, back, | |||
&back, &front, | |||
dirtyRects) | |||
// front: no rights | |||
// back: no rights | |||
recv SendDrew(front, back, ...) | |||
// front: r, w reserved | |||
// back: rw | |||
swap(front, back) | |||
reply Drew(back, front) | |||
// front: r, w reserved | |||
// back: no rights | |||
recv ReplyDrew(back, front) | |||
// render |front| to screen // back: rw | |||
// front: r | |||
// blit |front| changes into |back| using dirtyRects | |||
// draw stuff, repeat | |||