void MesaSoftwareRenderer::_Error(gl_context* ctx) { MesaSoftwareRenderer* mr = (MesaSoftwareRenderer*)ctx->DriverCtx; if (mr && mr->GLView()) mr->GLView()->ErrorCallback((unsigned long)ctx->ErrorValue); }
void MesaSoftwareRenderer::_Flush(GLcontext *ctx) { CALLED(); MesaSoftwareRenderer *mr = (MesaSoftwareRenderer *) ctx->DriverCtx; if ((mr->fOptions & BGL_DOUBLE) == 0) { mr->SwapBuffers(); } }
void MesaSoftwareRenderer::_Flush(gl_context* ctx) { CALLED(); MesaSoftwareRenderer* mr = (MesaSoftwareRenderer*)ctx->DriverCtx; if ((mr->fOptions & BGL_DOUBLE) == 0) { // TODO: SwapBuffers() can call _CopyToDirect(), which should // be always called with with the BGLView drawlocked. // This is not always the case if called from here. mr->SwapBuffers(); } }
void MesaSoftwareRenderer::_ClearFront(gl_context* ctx) { CALLED(); MesaSoftwareRenderer* mr = (MesaSoftwareRenderer*)ctx->DriverCtx; BGLView* bglview = mr->GLView(); assert(bglview); BBitmap* bitmap = mr->fBitmap; assert(bitmap); GLuint* start = (GLuint*)bitmap->Bits(); size_t pixelSize = 0; get_pixel_size_for(bitmap->ColorSpace(), &pixelSize, NULL, NULL); const GLuint* clearPixelPtr = (const GLuint*)mr->fClearColor; const GLuint clearPixel = B_LENDIAN_TO_HOST_INT32(*clearPixelPtr); int x = ctx->DrawBuffer->_Xmin; int y = ctx->DrawBuffer->_Ymin; uint32 width = ctx->DrawBuffer->_Xmax - x; uint32 height = ctx->DrawBuffer->_Ymax - y; GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->Height); if (all) { const int numPixels = mr->fWidth * mr->fHeight; if (clearPixel == 0) { memset(start, 0, numPixels * pixelSize); } else { for (int i = 0; i < numPixels; i++) { start[i] = clearPixel; } } } else { // XXX untested start += y * mr->fWidth + x; for (uint32 i = 0; i < height; i++) { for (uint32 j = 0; j < width; j++) { start[j] = clearPixel; } start += mr->fWidth; } } }