## Display Device Driver Reference for OS/2

[prev][next][parent][TOC]

### SCA Definition

These areas track, as efficiently as possible, regions of the screen that are altered by display driver drawing routines. This tracking is done by using multiple rectangles to define the area, rather than the usual single bounding rectangle provided by traditional Presentation Manager bounding functions.

SCAs are maintained within the driver in an SCA data structure, defined in the new DCAF.H file. For details, refer to the SCA data structure in the Appendixes of the OS/2 Presentation Device Driver Reference. Instances of this structure are dynamically created and destroyed upon calls to GreOpenScreenChangeArea and GreCloseScreenChangeArea, respectively. For details, refer to these functions in the chapter of the OS/2 Presentation Device Driver Reference that discusses mandatory and simulated graphics engine functions.

A global variable, pStartSCA, points to the latest SCA instance created. If pStartSCA is null, there are no active SCAs. All SCA instances are linked together in a list using the pscaNext field of the SCA data structure. A null value in this field indicates the end of the list (the earliest created SCA). For example:

    Memory loc.

                  -------------------       pStartSCA = 250;

                  | pscaNext = 200  |

                  |                 |

                  |      4th SCA    |

       0x250      -------------------

                  -------------------

                  | pscaNext = 150  |

                  |                 |

                  |      3th SCA    |

       0x200      -------------------

                  -------------------

                  | pscaNext = 100  |

                  |                 |

                  |      2nd SCA    |

       0x150      -------------------

                  -------------------

                  | pscaNext = 0    |

                  |                 |

                  |      1st SCA    |

       0x100      -------------------

Each SCA instance can store multiple rectangles, up to MAX_SCA_RECTS (14), which define the area on the screen that has changed since the SCA was created or last queried. These rectangles are stored in the array arcl[]. The number of rectangles stored within the array is kept in the cRects field, which will never exceed MAX_SCA_RECTS. If cRects is zero, the SCA is a null area - the initial state.

The remaining field in the SCA data structure, aulRectSize[], is an array containing the sizes of the rectangles in arcl[]. This is not strictly necessary, because the sizes can be calculated on the fly using the dimensions in arcl[]. However, when accumulating a rectangle into a SCA, the size of each of the rectangles is frequently needed. Caching the rectangle sizes in this array saves having to recalculate the sizes every time, resulting in better performance.

The SCA data structure defines space for (MAX_SCA_RECTS+1) rectangles, but only MAX_SCA_RECTS are ever used to define the SCA. The extra rectangle is used to simplify the routine that accumulates rectangles into the SCA.