void CBarGraphEditor::OnPaint() { ASSERT(m_pBackDC != NULL); CPaintDC dc(this); DrawBackground(m_pBackDC, m_iLevels, false, 0); DrawRange(m_pBackDC, m_iLevels, 0); // Return now if no sequence is selected if (!m_pSequence) { PaintBuffer(m_pBackDC, &dc); return; } // Draw items int Count = m_pSequence->GetItemCount(); if (!Count) { PaintBuffer(m_pBackDC, &dc); return; } int StepWidth = GetItemWidth(); int StepHeight = m_GraphRect.Height() / m_iLevels; if (m_iHighlightedValue > 0 && m_iHighlightedItem >= 0 && m_iHighlightedItem < Count) { int x = m_GraphRect.left + m_iHighlightedItem * StepWidth + 1; int y = m_GraphRect.top + StepHeight * (m_iLevels - m_iHighlightedValue); int w = StepWidth; int h = StepHeight * m_iHighlightedValue; DrawShadowRect(m_pBackDC, x, y, w, h); } // Draw items for (int i = 0; i < Count; i++) { int x = m_GraphRect.left + i * StepWidth + 1; int y = m_GraphRect.top + StepHeight * (m_iLevels - m_pSequence->GetItem(i)); int w = StepWidth; int h = StepHeight * m_pSequence->GetItem(i); if (m_iCurrentPlayPos == i) DrawPlayRect(m_pBackDC, x, y, w, h); else if ((m_iHighlightedItem == i) && (m_pSequence->GetItem(i) >= m_iHighlightedValue) && !IsEditLine()) DrawCursorRect(m_pBackDC, x, y, w, h); else DrawRect(m_pBackDC, x, y, w, h); } DrawLoopPoint(m_pBackDC, StepWidth); DrawReleasePoint(m_pBackDC, StepWidth); DrawLine(m_pBackDC); PaintBuffer(m_pBackDC, &dc); }
LRESULT TaskSortFieldSelector::WndProc(unsigned int msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_ERASEBKGND: return OnEraseBackground(wParam); case WM_KEYDOWN: if(wParam == VK_ESCAPE) { ShowWindow(m_hwnd, SW_HIDE); } break; case WM_CREATE: OnCreate(); break; case WM_MOUSEMOVE: OnMouseMove(wParam, lParam); break; case WM_MOUSELEAVE: if(hilite > -1) { hilite = -1; InvalidateRect(m_hwnd, NULL, FALSE); } m_bTrackMouse = false; break; case WM_LBUTTONDOWN: OnMouseLDown(wParam, lParam); break; case WM_LBUTTONUP: OnMouseLUp(wParam, lParam); break; case WM_SHOWWINDOW: OnShow(wParam, lParam); break; case WM_PRINTCLIENT: { RECT r = { 0, 0, 0, 0 }; GetClientRect(m_hwnd, &r); PaintBuffer(m_hwnd, reinterpret_cast<HDC>(wParam), r.right, r.bottom); } break; /* case WM_VSCROLL: OnScroll(wParam, lParam); break; case WM_SIZE: OnSize(); break; case WM_DESTROY: OnDestroy(); break; case WM_CLOSE: if(m_ref > 2)break; */ default: return DefWindowProc(m_hwnd, msg, wParam, lParam); } return 0; }
void ClientThebesLayer::PaintThebes() { PROFILER_LABEL("ClientThebesLayer", "PaintThebes"); NS_ASSERTION(ClientManager()->InDrawing(), "Can only draw in drawing phase"); //TODO: This is going to copy back pixels that we might end up // drawing over anyway. It would be nice if we could avoid // this duplication. mContentClient->SyncFrontBufferToBackBuffer(); bool canUseOpaqueSurface = CanUseOpaqueSurface(); ContentType contentType = canUseOpaqueSurface ? GFX_CONTENT_COLOR : GFX_CONTENT_COLOR_ALPHA; { uint32_t flags = 0; #ifndef MOZ_WIDGET_ANDROID if (ClientManager()->CompositorMightResample()) { flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE; } if (!(flags & ThebesLayerBuffer::PAINT_WILL_RESAMPLE)) { if (MayResample()) { flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE; } } #endif PaintState state = mContentClient->BeginPaintBuffer(this, contentType, flags); mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate); if (state.mContext) { // The area that became invalid and is visible needs to be repainted // (this could be the whole visible area if our buffer switched // from RGB to RGBA, because we might need to repaint with // subpixel AA) state.mRegionToInvalidate.And(state.mRegionToInvalidate, GetEffectiveVisibleRegion()); nsIntRegion extendedDrawRegion = state.mRegionToDraw; SetAntialiasingFlags(this, state.mContext); PaintBuffer(state.mContext, state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate, state.mDidSelfCopy, state.mClip); MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this)); Mutated(); } else { // It's possible that state.mRegionToInvalidate is nonempty here, // if we are shrinking the valid region to nothing. So use mRegionToDraw // instead. NS_WARN_IF_FALSE(state.mRegionToDraw.IsEmpty(), "No context when we have something to draw, resource exhaustion?"); } } }
void ClientThebesLayer::PaintThebes() { PROFILER_LABEL("ClientThebesLayer", "PaintThebes"); NS_ASSERTION(ClientManager()->InDrawing(), "Can only draw in drawing phase"); { mContentClient->PrepareFrame(); uint32_t flags = 0; #ifndef MOZ_WIDGET_ANDROID if (ClientManager()->CompositorMightResample()) { flags |= RotatedContentBuffer::PAINT_WILL_RESAMPLE; } if (!(flags & RotatedContentBuffer::PAINT_WILL_RESAMPLE)) { if (MayResample()) { flags |= RotatedContentBuffer::PAINT_WILL_RESAMPLE; } } #endif PaintState state = mContentClient->BeginPaintBuffer(this, flags); mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate); if (DrawTarget* target = mContentClient->BorrowDrawTargetForPainting(this, state)) { // The area that became invalid and is visible needs to be repainted // (this could be the whole visible area if our buffer switched // from RGB to RGBA, because we might need to repaint with // subpixel AA) state.mRegionToInvalidate.And(state.mRegionToInvalidate, GetEffectiveVisibleRegion()); SetAntialiasingFlags(this, target); nsRefPtr<gfxContext> ctx = gfxContext::ContextForDrawTarget(target); PaintBuffer(ctx, state.mRegionToDraw, state.mRegionToDraw, state.mRegionToInvalidate, state.mDidSelfCopy, state.mClip); MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this)); Mutated(); ctx = nullptr; mContentClient->ReturnDrawTargetToBuffer(target); } else { // It's possible that state.mRegionToInvalidate is nonempty here, // if we are shrinking the valid region to nothing. So use mRegionToDraw // instead. NS_WARN_IF_FALSE(state.mRegionToDraw.IsEmpty(), "No context when we have something to draw, resource exhaustion?"); } } }
void CPlayerDisplay::Paint (CG16bitImage &Dest) // Paint // // Paints the display { if (m_bInvalid) { PaintBuffer(); m_bInvalid = false; } Dest.Blt(0, 0, RectWidth(m_rcRect), RectHeight(m_rcRect), m_Buffer, m_rcRect.left, m_rcRect.top); }
void CBufferedWnd::Paint() { RECT rc; GetClientRect(m_hwnd, &rc); if(GetUpdateRect(m_hwnd, NULL, FALSE)) { HDC dc = NULL; PAINTSTRUCT ps; ZeroMemory(&ps, sizeof(PAINTSTRUCT)); dc = BeginPaint(m_hwnd, &ps); if(!dc)return; if(!IsRectEmpty(&ps.rcPaint)) { int width = rc.right - rc.left; int height = rc.bottom - rc.top; if(m_pBuffer && (m_pBuffer->width != width || m_pBuffer->height != height)) { delete m_pBuffer; m_pBuffer = NULL; } if(!m_pBuffer) { m_pBuffer = new ImgBuffer(dc, width, height); } HDC dc2 = CreateCompatibleDC(dc); HGDIOBJ old = SelectObject(dc2, m_pBuffer->m_hBitmap); PaintBuffer(m_hwnd, dc2, width, height); GdiFlush(); BitBlt(dc, 0, 0, width, height, dc2, 0, 0, SRCCOPY); SelectObject(dc2, old); DeleteDC(dc2); } EndPaint(m_hwnd, &ps); } }
void BasicThebesLayer::PaintThebes(gfxContext* aContext, Layer* aMaskLayer, LayerManager::DrawThebesLayerCallback aCallback, void* aCallbackData, ReadbackProcessor* aReadback) { PROFILER_LABEL("BasicThebesLayer", "PaintThebes"); NS_ASSERTION(BasicManager()->InDrawing(), "Can only draw in drawing phase"); nsRefPtr<gfxASurface> targetSurface = aContext->CurrentSurface(); if (!mContentClient) { // we pass a null pointer for the Forwarder argument, which means // this will not have a ContentHost on the other side. mContentClient = new ContentClientBasic(nullptr, BasicManager()); } nsTArray<ReadbackProcessor::Update> readbackUpdates; if (aReadback && UsedForReadback()) { aReadback->GetThebesLayerUpdates(this, &readbackUpdates); } //TODO: This is going to copy back pixels that we might end up // drawing over anyway. It would be nice if we could avoid // this duplication. mContentClient->SyncFrontBufferToBackBuffer(); bool canUseOpaqueSurface = CanUseOpaqueSurface(); ContentType contentType = canUseOpaqueSurface ? gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA; float opacity = GetEffectiveOpacity(); if (!BasicManager()->IsRetained()) { NS_ASSERTION(readbackUpdates.IsEmpty(), "Can't do readback for non-retained layer"); mValidRegion.SetEmpty(); mContentClient->Clear(); nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion(), aContext); RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds()); if (!toDraw.IsEmpty() && !IsHidden()) { if (!aCallback) { BasicManager()->SetTransactionIncomplete(); return; } aContext->Save(); bool needsClipToVisibleRegion = GetClipToVisibleRegion(); bool needsGroup = opacity != 1.0 || GetOperator() != gfxContext::OPERATOR_OVER || aMaskLayer; nsRefPtr<gfxContext> groupContext; if (needsGroup) { groupContext = BasicManager()->PushGroupForLayer(aContext, this, toDraw, &needsClipToVisibleRegion); if (GetOperator() != gfxContext::OPERATOR_OVER) { needsClipToVisibleRegion = true; } } else { groupContext = aContext; } SetAntialiasingFlags(this, groupContext); aCallback(this, groupContext, toDraw, CLIP_NONE, nsIntRegion(), aCallbackData); if (needsGroup) { BasicManager()->PopGroupToSourceWithCachedSurface(aContext, groupContext); if (needsClipToVisibleRegion) { gfxUtils::ClipToRegion(aContext, toDraw); } AutoSetOperator setOperator(aContext, GetOperator()); PaintWithMask(aContext, opacity, aMaskLayer); } aContext->Restore(); } RenderTraceInvalidateEnd(this, "FFFF00"); return; } { uint32_t flags = 0; #ifndef MOZ_WIDGET_ANDROID if (BasicManager()->CompositorMightResample()) { flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE; } if (!(flags & ThebesLayerBuffer::PAINT_WILL_RESAMPLE)) { if (MayResample()) { flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE; } } #endif if (mDrawAtomically) { flags |= ThebesLayerBuffer::PAINT_NO_ROTATION; } PaintState state = mContentClient->BeginPaintBuffer(this, contentType, flags); mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate); if (state.mContext) { // The area that became invalid and is visible needs to be repainted // (this could be the whole visible area if our buffer switched // from RGB to RGBA, because we might need to repaint with // subpixel AA) state.mRegionToInvalidate.And(state.mRegionToInvalidate, GetEffectiveVisibleRegion()); nsIntRegion extendedDrawRegion = state.mRegionToDraw; SetAntialiasingFlags(this, state.mContext); RenderTraceInvalidateStart(this, "FFFF00", state.mRegionToDraw.GetBounds()); PaintBuffer(state.mContext, state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate, state.mDidSelfCopy, state.mClip, aCallback, aCallbackData); MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this)); Mutated(); RenderTraceInvalidateEnd(this, "FFFF00"); } else { // It's possible that state.mRegionToInvalidate is nonempty here, // if we are shrinking the valid region to nothing. So use mRegionToDraw // instead. NS_WARN_IF_FALSE(state.mRegionToDraw.IsEmpty(), "No context when we have something to draw, resource exhaustion?"); } } if (BasicManager()->IsTransactionIncomplete()) return; gfxRect clipExtents; clipExtents = aContext->GetClipExtents(); // Pull out the mask surface and transform here, because the mask // is internal to basic layers AutoMaskData mask; gfxASurface* maskSurface = nullptr; const gfxMatrix* maskTransform = nullptr; if (GetMaskData(aMaskLayer, &mask)) { maskSurface = mask.GetSurface(); maskTransform = &mask.GetTransform(); } if (!IsHidden() && !clipExtents.IsEmpty()) { AutoSetOperator setOperator(aContext, GetOperator()); mContentClient->DrawTo(this, aContext, opacity, maskSurface, maskTransform); } for (uint32_t i = 0; i < readbackUpdates.Length(); ++i) { ReadbackProcessor::Update& update = readbackUpdates[i]; nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset(); nsRefPtr<gfxContext> ctx = update.mLayer->GetSink()->BeginUpdate(update.mUpdateRect + offset, update.mSequenceCounter); if (ctx) { NS_ASSERTION(opacity == 1.0, "Should only read back opaque layers"); ctx->Translate(gfxPoint(offset.x, offset.y)); mContentClient->DrawTo(this, ctx, 1.0, maskSurface, maskTransform); update.mLayer->GetSink()->EndUpdate(ctx, update.mUpdateRect + offset); } } }
void CArpeggioGraphEditor::OnPaint() { ASSERT(m_pBackDC != NULL); CPaintDC dc(this); DrawBackground(m_pBackDC, ITEMS, true, m_pSequence->GetSetting() & ARP_SETTING_FIXED ? 2 - m_iScrollOffset : -m_iScrollOffset); DrawRange(m_pBackDC, m_iScrollOffset + 10, m_iScrollOffset - 10); // Return now if no sequence is selected if (!m_pSequence) { PaintBuffer(m_pBackDC, &dc); return; } // Draw items int Count = m_pSequence->GetItemCount(); if (!Count) { PaintBuffer(m_pBackDC, &dc); return; } int StepWidth = GetItemWidth(); int StepHeight = m_GraphRect.Height() / ITEMS; // One last line m_pBackDC->FillSolidRect(m_GraphRect.left + 1, m_GraphRect.top + 20 * StepHeight, m_GraphRect.Width() - 2, 1, COLOR_LINES); if (m_iHighlightedItem >= 0 && m_iHighlightedItem < Count) { int item = (ITEMS / 2) - m_iHighlightedValue + m_iScrollOffset; if (m_pSequence->GetSetting() == ARP_SETTING_FIXED) item += (ITEMS / 2); if (item >= 0 && item <= 20) { int x = m_GraphRect.left + m_iHighlightedItem * StepWidth + 1; int y = m_GraphRect.top + StepHeight * item + 1; int w = StepWidth; int h = StepHeight - 1; DrawShadowRect(m_pBackDC, x, y, w, h); } } // Draw items for (int i = 0; i < Count; i++) { int item = (ITEMS / 2) - m_pSequence->GetItem(i) + m_iScrollOffset; if (m_pSequence->GetSetting() == ARP_SETTING_FIXED) item += (ITEMS / 2); if (item >= 0 && item <= 20) { int x = m_GraphRect.left + i * StepWidth + 1; int y = m_GraphRect.top + StepHeight * item; int w = StepWidth; int h = StepHeight; if (m_iCurrentPlayPos == i) DrawPlayRect(m_pBackDC, x, y, w, h); else if (m_iHighlightedItem == i && (m_pSequence->GetItem(i) == m_iHighlightedValue) && !IsEditLine()) DrawCursorRect(m_pBackDC, x, y, w, h); else DrawRect(m_pBackDC, x, y, w, h); } } DrawLoopPoint(m_pBackDC, StepWidth); DrawReleasePoint(m_pBackDC, StepWidth); DrawLine(m_pBackDC); PaintBuffer(m_pBackDC, &dc); }
void CNoiseEditor::OnPaint() { ASSERT(m_pBackDC != NULL); CPaintDC dc(this); DrawBackground(m_pBackDC, m_iItems, false, 0); DrawRange(m_pBackDC, m_iItems, 0); // Return now if no sequence is selected if (!m_pSequence) { PaintBuffer(m_pBackDC, &dc); return; } // Draw items int Count = m_pSequence->GetItemCount(); if (!Count) { PaintBuffer(m_pBackDC, &dc); return; } int StepWidth = GetItemWidth(); int StepHeight = m_GraphRect.Height() / m_iItems; // Draw items for (int i = 0; i < Count; i++) { // Draw noise frequency int item = m_pSequence->GetItem(i) & 0x1F; int x = m_GraphRect.left + i * StepWidth + 1; int y = m_GraphRect.top + StepHeight * (m_iItems - item); int w = StepWidth; int h = StepHeight;//* item; if (m_iCurrentPlayPos == i) DrawPlayRect(m_pBackDC, x, y, w, h); else DrawRect(m_pBackDC, x, y, w, h); // Draw switches item = m_pSequence->GetItem(i); int Offset = h * 36 - 1; if (item & S5B_MODE_SQUARE) { static const COLORREF BUTTON_COL = COMBINE(0, 160, 160); int y = Offset; int h = 9; m_pBackDC->FillSolidRect(x, y, w, h, BUTTON_COL); m_pBackDC->Draw3dRect(x, y, w, h, BLEND(BUTTON_COL, 0xFFFFFF, 80), BLEND(BUTTON_COL, 0x000000, 80)); } else { static const COLORREF BUTTON_COL = COMBINE(50, 50, 50); int y = Offset; int h = 9; m_pBackDC->FillSolidRect(x, y, w, h, BUTTON_COL); m_pBackDC->Draw3dRect(x, y, w, h, BLEND(BUTTON_COL, 0xFFFFFF, 80), BLEND(BUTTON_COL, 0x000000, 80)); } if (item & S5B_MODE_NOISE) { static const COLORREF BUTTON_COL = COMBINE(160, 0, 160); int y = Offset + 11; int h = 9; m_pBackDC->FillSolidRect(x, y, w, h, BUTTON_COL); m_pBackDC->Draw3dRect(x, y, w, h, BLEND(BUTTON_COL, 0xFFFFFF, 80), BLEND(BUTTON_COL, 0x000000, 80)); } else { static const COLORREF BUTTON_COL = COMBINE(50, 50, 50); int y = Offset + 11; int h = 9; m_pBackDC->FillSolidRect(x, y, w, h, BUTTON_COL); m_pBackDC->Draw3dRect(x, y, w, h, BLEND(BUTTON_COL, 0xFFFFFF, 80), BLEND(BUTTON_COL, 0x000000, 80)); } } DrawLoopPoint(m_pBackDC, StepWidth); DrawReleasePoint(m_pBackDC, StepWidth); DrawLine(m_pBackDC); PaintBuffer(m_pBackDC, &dc); }
void CPitchGraphEditor::OnPaint() { ASSERT(m_pBackDC != NULL); CPaintDC dc(this); DrawBackground(m_pBackDC, 0, false, 0); DrawRange(m_pBackDC, 127, -128); m_pBackDC->FillSolidRect(m_GraphRect.left, m_GraphRect.top + m_GraphRect.Height() / 2, m_GraphRect.Width(), 1, COLOR_LINES); // Return now if no sequence is selected if (!m_pSequence) { PaintBuffer(m_pBackDC, &dc); return; } // Draw items int Count = m_pSequence->GetItemCount(); if (!Count) { PaintBuffer(m_pBackDC, &dc); return; } int StepWidth = GetItemWidth(); int StepHeight = m_GraphRect.Height() / ITEMS; // One last line m_pBackDC->FillSolidRect(m_GraphRect.left + 1, m_GraphRect.top + 20 * StepHeight, m_GraphRect.Width() - 2, 1, COLOR_LINES); if (m_iHighlightedItem != -1) { int x = m_GraphRect.left + m_iHighlightedItem * StepWidth + 1; int y = m_GraphRect.top + m_GraphRect.Height() / 2; int w = StepWidth; int h = -(m_iHighlightedValue * m_GraphRect.Height()) / 255 ; DrawShadowRect(m_pBackDC, x, y, w, h); } int Value = m_pSequence->GetItem(m_iHighlightedItem); bool bHighlight = !IsEditLine(); if (m_iHighlightedValue > 0) { if (m_iHighlightedValue > Value || Value < 0) { bHighlight = false; } } else { if (m_iHighlightedValue < Value || Value > 0) { bHighlight = false; } } // Draw items for (int i = 0; i < Count; i++) { int item = m_pSequence->GetItem(i); int x = m_GraphRect.left + i * StepWidth + 1; int y = m_GraphRect.top + m_GraphRect.Height() / 2; int w = StepWidth; int h = -(item * m_GraphRect.Height()) / 255 ; if (h < 0) { y += h; h = -h; } if (m_iCurrentPlayPos == i) DrawPlayRect(m_pBackDC, x, y, w, h); else if (m_iHighlightedItem == i && bHighlight) DrawCursorRect(m_pBackDC, x, y, w, h); else DrawRect(m_pBackDC, x, y, w, h); } DrawLoopPoint(m_pBackDC, StepWidth); DrawReleasePoint(m_pBackDC, StepWidth); DrawLine(m_pBackDC); PaintBuffer(m_pBackDC, &dc); }
void BasicThebesLayer::Validate(LayerManager::DrawThebesLayerCallback aCallback, void* aCallbackData) { if (!mContentClient) { // This client will have a null Forwarder, which means it will not have // a ContentHost on the other side. mContentClient = new ContentClientBasic(); } if (!BasicManager()->IsRetained()) { return; } uint32_t flags = 0; #ifndef MOZ_WIDGET_ANDROID if (BasicManager()->CompositorMightResample()) { flags |= RotatedContentBuffer::PAINT_WILL_RESAMPLE; } if (!(flags & RotatedContentBuffer::PAINT_WILL_RESAMPLE)) { if (MayResample()) { flags |= RotatedContentBuffer::PAINT_WILL_RESAMPLE; } } #endif if (mDrawAtomically) { flags |= RotatedContentBuffer::PAINT_NO_ROTATION; } PaintState state = mContentClient->BeginPaintBuffer(this, flags); mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate); if (DrawTarget* target = mContentClient->BorrowDrawTargetForPainting(state)) { // The area that became invalid and is visible needs to be repainted // (this could be the whole visible area if our buffer switched // from RGB to RGBA, because we might need to repaint with // subpixel AA) state.mRegionToInvalidate.And(state.mRegionToInvalidate, GetEffectiveVisibleRegion()); SetAntialiasingFlags(this, target); RenderTraceInvalidateStart(this, "FFFF00", state.mRegionToDraw.GetBounds()); nsRefPtr<gfxContext> ctx = gfxContext::ContextForDrawTarget(target); PaintBuffer(ctx, state.mRegionToDraw, state.mRegionToDraw, state.mRegionToInvalidate, state.mDidSelfCopy, state.mClip, aCallback, aCallbackData); MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this)); Mutated(); ctx = nullptr; mContentClient->ReturnDrawTargetToBuffer(target); RenderTraceInvalidateEnd(this, "FFFF00"); } else { // It's possible that state.mRegionToInvalidate is nonempty here, // if we are shrinking the valid region to nothing. So use mRegionToDraw // instead. NS_WARN_IF_FALSE(state.mRegionToDraw.IsEmpty(), "No context when we have something to draw, resource exhaustion?"); } }