Re: Cullng drawing depending on visibility events



Just to follow up to myself with some further thoughts.

Define:

 Rv: Portion of window visible to the user
 Rs: Portion of window that the X server has maintained the contents for

For ultimate efficiency, GTK+ would really like to get
notification of both additions and subtractions to these
regions.

Then, you can use the following algorithm on the client
side; let:

  Ri - region that GTK+ will repaint on idle
  Rsi - "stored invalid region"

  R'v ,R's - client side representation of Rv and Rs

(Assume that the notifications are sent ordered so 
that Rv is always a proper subset of Rs)


gdk_window_invalidate_region (r)

  Add  Intersection(r, R'v) to Ri
  Add  Intersection(r, R's - R'v) to Rsi

Notification of addition of region 'r' to Rv:

  Add r to R'v
  Add Intersection(r,Rsi) to Ri
  Remove r from Rsi

Notification of removal of region 'r' from Rv:

  Remove r from R'v
  Add Intersection of (r,Ri) to Rsi
  Remove r from Ri

Notification of addition of region 'r' to Rs:

  Add r to R's
  Add r to Rsi

Notification of removal of region 'r' from Rs:

  Remove r from R's
  Remove r from Ri
  Remove r from Rsi

Idle repaint:

  Generate paint event for Ri, Clear Ri.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]