Example #1
0
ZDC_Off::ZDC_Off(const ZDC& inOther, bool inForceOffscreen)
:	ZDC(inOther)
	{
	// Initially, we copy all settings from inOther, then we attempt to
	// create a new offscreen canvas.
	if (inForceOffscreen || !fCanvas->IsOffScreen())
		{
		ZRect canvasClipRect = this->GetClip().Bounds() + this->GetOrigin();
		ZRef<ZDCCanvas> offCanvas;
		try
			{
			// We allow the offscreen creation to fail if inForceOffscreen is false.
			offCanvas = fCanvas->CreateOffScreen(canvasClipRect);
			}
		catch (...)
			{
			if (inForceOffscreen)
				throw;
			}
		if (offCanvas && offCanvas->IsOffScreen())
			{
			fCanvas = offCanvas;
			this->ZeroChangeCounts();
			fState.fOriginComp = canvasClipRect.TopLeft();
			this->SetOrigin(inOther.GetOrigin());
			this->SetPatternOrigin(inOther.GetPatternOrigin());
			this->SetClip(inOther.GetClip());
			}
		}
	}
Example #2
0
ZDC_Off::ZDC_Off(const ZDC& inOther, ZPoint inDimensions, ZDCPixmapNS::EFormatEfficient iFormat)
:	ZDC(inOther)
	{
	ZRef<ZDCCanvas> offCanvas = fCanvas->CreateOffScreen(inDimensions, iFormat);
	if (offCanvas && offCanvas->IsOffScreen())
		{
		fCanvas = offCanvas;
		this->ZeroChangeCounts();
		fState.fClip = ZRect(inDimensions);
		fState.fOrigin = ZPoint::sZero;
		fState.fPatternOrigin = ZPoint::sZero;
		fState.fClipOrigin = ZPoint::sZero;
		fState.fOriginComp = ZPoint::sZero;
		}
	}