void AdobeSurfacePrivate::clear( const QRect & area ) { #ifndef USE_PIXMAP int stride = image_.bytesPerLine(); #else qDebug("AdobeSurfacePrivate::clear %d", image_.qwsBytesPerLine()); int stride = image_.qwsBytesPerLine(); #endif int bytes_per_pixel = image_.depth() / 8; if (bytes_per_pixel < 1) { bytes_per_pixel = 1; } // get the overlap area to prevent out-of-bounding accessing QRect actual_area = image_.rect().intersect( area ); #ifndef USE_PIXMAP const uchar * buf = image_.bits(); #else const uchar * buf = image_.qwsBits(); #endif unsigned char * data = (uchar*)buf + stride * actual_area.top() + bytes_per_pixel * actual_area.left(); for ( int y = actual_area.top(); y < actual_area.bottom(); ++y ) { memset( data, 255, actual_area.width() * bytes_per_pixel ); data = (uchar*)buf + stride * (y + 1) + bytes_per_pixel * actual_area.left(); } }
unsigned char* AdobeSurfacePrivate::checkOut( int xMin, int yMin, int xMax, int yMax, size_t * stride ) { #ifndef USE_PIXMAP *stride = image_.bytesPerLine(); #else *stride = image_.qwsBytesPerLine(); #endif int bytes_per_pixel = image_.depth() / 8; if (bytes_per_pixel < 1) { bytes_per_pixel = 1; } #ifndef USE_PIXMAP const uchar * buf = image_.bits(); #else const uchar * buf = image_.qwsBits(); #endif return (uchar*)buf + (*stride) * yMin + bytes_per_pixel * xMin; }