void nsWindow::DoDraw(void) { if (!hal::GetScreenEnabled()) { gDrawRequest = true; return; } if (!gWindowToRedraw) { LOG(" no window to draw, bailing"); return; } StopBootAnimation(); nsIntRegion region = gWindowToRedraw->mDirtyRegion; gWindowToRedraw->mDirtyRegion.SetEmpty(); LayerManager* lm = gWindowToRedraw->GetLayerManager(); if (mozilla::layers::LAYERS_OPENGL == lm->GetBackendType()) { LayerManagerOGL* oglm = static_cast<LayerManagerOGL*>(lm); oglm->SetClippingRegion(region); oglm->SetWorldTransform(sRotationMatrix); if (nsIWidgetListener* listener = gWindowToRedraw->GetWidgetListener()) listener->PaintWindow(gWindowToRedraw, region, 0); } else if (mozilla::layers::LAYERS_BASIC == lm->GetBackendType()) { MOZ_ASSERT(sFramebufferOpen || sUsingOMTC); nsRefPtr<gfxASurface> targetSurface; if(sUsingOMTC) targetSurface = sOMTCSurface; else targetSurface = Framebuffer::BackBuffer(); { nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface); gfxUtils::PathFromRegion(ctx, region); ctx->Clip(); // No double-buffering needed. AutoLayerManagerSetup setupLayerManager( gWindowToRedraw, ctx, mozilla::layers::BUFFER_NONE, ScreenRotation(EffectiveScreenRotation())); if (nsIWidgetListener* listener = gWindowToRedraw->GetWidgetListener()) listener->PaintWindow(gWindowToRedraw, region, 0); } if (!sUsingOMTC) { targetSurface->Flush(); Framebuffer::Present(region); } } else { NS_RUNTIMEABORT("Unexpected layer manager type"); } }
void nsWindow::DoDraw(void) { if (!hal::GetScreenEnabled()) { gDrawRequest = true; return; } if (!gWindowToRedraw) { LOG(" no window to draw, bailing"); return; } nsPaintEvent event(true, NS_PAINT, gWindowToRedraw); event.region = gWindowToRedraw->mDirtyRegion; gWindowToRedraw->mDirtyRegion.SetEmpty(); LayerManager* lm = gWindowToRedraw->GetLayerManager(); if (LayerManager::LAYERS_OPENGL == lm->GetBackendType()) { LayerManagerOGL* oglm = static_cast<LayerManagerOGL*>(lm); oglm->SetClippingRegion(event.region); oglm->SetWorldTransform(sRotationMatrix); gWindowToRedraw->mEventCallback(&event); } else if (LayerManager::LAYERS_BASIC == lm->GetBackendType()) { MOZ_ASSERT(sFramebufferOpen || sUsingOMTC); nsRefPtr<gfxASurface> targetSurface; if(sUsingOMTC) targetSurface = sOMTCSurface; else targetSurface = Framebuffer::BackBuffer(); { nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface); gfxUtils::PathFromRegion(ctx, event.region); ctx->Clip(); // No double-buffering needed. AutoLayerManagerSetup setupLayerManager( gWindowToRedraw, ctx, BasicLayerManager::BUFFER_NONE); gWindowToRedraw->mEventCallback(&event); } if (!sUsingOMTC) { targetSurface->Flush(); Framebuffer::Present(event.region); } } else { NS_RUNTIMEABORT("Unexpected layer manager type"); } }