当前位置: 首页>>代码示例>>C++>>正文


C++ AttributeValue::Render方法代码示例

本文整理汇总了C++中AttributeValue::Render方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeValue::Render方法的具体用法?C++ AttributeValue::Render怎么用?C++ AttributeValue::Render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AttributeValue的用法示例。


在下文中一共展示了AttributeValue::Render方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Copy

BOOL RenderStack::Copy(const RenderStack *Other, RenderRegion *pRegion)
{
	ERROR3IF(Other == NULL || pRegion == NULL, "Illegal NULL params");

// WEBSTER - markn 15/8/97
// This has bee taken out of Webster builds as it can cause fatal access violations with Paper render regions.
// It is new path processor code that not's totally bug-free, and as path processors are not used in Webster,
// it can be safely taken out.
#ifndef WEBSTER
	// Make sure all attributes are properly popped && deinitialised, so that any used
	// PathProcessors are correctly removed, etc
	// (Note: This doesn't deinit the DEFAULT attributes, which we hope will never use
	// PathProcessors - this should be OK, because the places where this is called from
	// (at present) always make sure all PathProcessors are properly cleaned up too)
	CleanUpBeforeDestruct(pRegion);
#endif // WEBSTER

	// Make sure we have an empty stack to work with
	if (TheStack!=NULL)
	{
		// Empty the current stack before copying the new one onto it
		// For every item in the stack, check to see if it is 'temporary'.  If it is,
		// we can't use it in our stack - we must take a copy.
		for (UINT32 i=0; i<Top; i++)
		{
			// Get rid of all the temp attrs in the stack
			if (TheStack[i].Temporary)
			{
				// Delete this tempory attr.
				CC_ASSERT_VALID(TheStack[i].pAttrValue);
				delete TheStack[i].pAttrValue;
			}
		}

		// then get rid of the stack itself
		CCFree(TheStack);
		TheStack=NULL;

		ContextLevel = 0;
		StackLimit = 0;
		Top = 0;
	}

	// Sanity check
	ENSURE(TheStack == NULL,"RenderStack::Copy called on a non-empty stack");

#if FALSE
	// Jason (7/3/97)
	// Copying the stack like this is rampant. We must render all the attributes across onto
	// the new stack, so that they are properly stacked and initialised
/*
	// Copy stack variables
	ContextLevel = Other->ContextLevel;
	StackLimit = Other->StackLimit;
	Top = Other->Top;

	// The other stack may be empty, which will often be the case when merging as it may
	// not have started rendering yet.
	if (Other->TheStack == NULL)
	{
		// Just to be on the safe side
		TheStack = NULL;

		// We're done.
		return TRUE;
	}

	// Allocate the same amount of memory for the stack
	TheStack = (AttributeRec *) CCMalloc(StackLimit * ITEM_SIZE);
	if (TheStack == NULL)
		return FALSE;

	// Copy the other render region's stack data into this new stack
	memcpy(TheStack, Other->TheStack, StackLimit * ITEM_SIZE);

	// For every item in the stack, check to see if it is 'temporary'.  If it is,
	// we can't use it in our stack - we must take a copy.
	for (UINT32 i = 0; i < Top; i++)
	{
		if (TheStack[i].Temporary)
		{
			// Get the runtime class info on this object
			CCRuntimeClass *pCCRuntimeClass = TheStack[i].pAttrValue->GetRuntimeClass();
	
			// Create another object of the same type
			AttributeValue *pNewAttr = (AttributeValue *) pCCRuntimeClass->CreateObject();

			if (pNewAttr == NULL)
			{
				// Failed to create object - quit with error, but first ensure that this
				// stack is limited to the items copied so far. Otherwise the destructor
				// will attempt to delete objects that belong to the other stack.
				Top = i;
				return FALSE;
			}

			// Object created ok - get the object to copy its contents across.
			pNewAttr->SimpleCopy(TheStack[i].pAttrValue);

			// Put it in the stack
//.........这里部分代码省略.........
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:101,代码来源:rndstack.cpp

示例2: ProcessPath

void PathProcessorStrokeVector::ProcessPath(Path *pPath,
											RenderRegion *pRender,
											PathShape ShapePath)
{
	PORTNOTETRACE("other","PathProcessorStrokeVector::ProcessPath - do nothing");
#ifndef EXCLUDE_FROM_XARALX
	ERROR3IF(pPath == NULL || pRender == NULL, "Illegal NULL Params");

	// Get the RenderRegion SubRenderContext and see if we're returning part-way through a background render
	VectorStrokeSubRenderContext *pSubRenderContext = (VectorStrokeSubRenderContext *)pRender->GetSubRenderState();
	if (pSubRenderContext != NULL && !IS_A(pSubRenderContext, VectorStrokeSubRenderContext))
	{
		// We can't use the sub render context, because it's not ours!
		pSubRenderContext = NULL;
	}

	// --- If we don't have a valid stroke definition, then get the base class to render
	// the stroke as a simple flat-filled stroke.
	StrokeDefinition *pStrokeDef = StrokeComponent::FindStroke(StrokeID);
	if (pStrokeDef == NULL)
	{
		PathProcessorStroke::ProcessPath(pPath, pRender);
		return;
	}

	// --- See if we have to create a new SubRenderContext, or if we can use the one passed in.
	// We always store all relevant variables in a SubRenderContext object so that we can easily
	// return control to the RenderRegion without having to copy lots of local values in/out.
	const BOOL CreateSubRenderContext = (pSubRenderContext == NULL);
	if (CreateSubRenderContext)
	{
		pSubRenderContext = new VectorStrokeSubRenderContext;
		if (pSubRenderContext == NULL)
		{
			pRender->DrawPath(pPath, this, ShapePath);
			return;
		}

		// --- If the provided path is not stroked, then we'll just pass it straight through
		// We also don't touch it if we're doing EOR rendering, or click hit detection
		if (!pPath->IsStroked || pRender->DrawingMode != DM_COPYPEN || pRender->IsHitDetect())
		{
			delete pSubRenderContext;
			pRender->DrawPath(pPath, this, ShapePath);
			return;
		}

		// --- If the quality is set low, or if the current stroke attribute is not our "parent"
		// attribute (so we're not the "current" stroker) then strokes are just rendered as centrelines
		// BLOCK
		{
			QualityAttribute *pQuality = (QualityAttribute *) pRender->GetCurrentAttribute(ATTR_QUALITY);
			StrokeTypeAttrValue *pTypeAttr = (StrokeTypeAttrValue *) pRender->GetCurrentAttribute(ATTR_STROKETYPE);

			if ((pQuality != NULL && pQuality->QualityValue.GetLineQuality() != Quality::FullLine) ||
				(pTypeAttr != NULL && pTypeAttr != GetParentAttr()))
			{
				delete pSubRenderContext;
				pRender->DrawPath(pPath, this, ShapePath);
				return;
			}
		}

		// --- We don't expect the input path to be stroked AND filled on entry
		ERROR3IF(pPath->IsFilled, "PathProcessor expected RenderRegion to handle IsFilled case");

		// --- Get the current line width & Join Style from the render region
		// BLOCK
		{
			LineWidthAttribute *pWidthAttr = (LineWidthAttribute *) pRender->GetCurrentAttribute(ATTR_LINEWIDTH);
			if (pWidthAttr != NULL)
				pSubRenderContext->LineWidth = pWidthAttr->LineWidth;

			JoinTypeAttribute *pJoinAttr = (JoinTypeAttribute *) pRender->GetCurrentAttribute(ATTR_JOINTYPE);
			if (pJoinAttr != NULL)
				pSubRenderContext->JoinStyle = pJoinAttr->JoinType;
		}
	}

	// --- Create a new path to be rendered in place of the provided path
	// Note that I use a large allocation size so that reallocation need not be done
	// frequently, which also helps reduce memory fragmentation.
	Path *pOutput = new Path;
	if (pOutput == NULL)
	{
		if (!pRender->IsSubRenderStateLocked())
			pRender->SetSubRenderState(NULL);
		delete pSubRenderContext;
		pRender->DrawPath(pPath, this, ShapePath);
		return;
	}

	pOutput->Initialise(128, 128);


	// --- Find our Variable Width function
	if (CreateSubRenderContext)
	{
		// --- Get the variable line width descriptor from the render region
		VariableWidthAttrValue *pVarWidthAttr = (VariableWidthAttrValue *) pRender->GetCurrentAttribute(ATTR_VARWIDTH);
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:xara-xtreme,代码行数:101,代码来源:ppvecstr.cpp


注:本文中的AttributeValue::Render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。