Ejemplo n.º 1
0
void Sprite::Invalidate()
{
	// 0指针访问 不挂是因为x64系统一个bug 记得打开调试中的Win32异常断点
	HostWindow *wnd = GetHostWindow();
	if (wnd)
	{
		RECT rc;
		Gdiplus::RectF rf = GetAbsRect();
		rc.left = (LONG)(rf.GetLeft() - 0.5f);
		rc.top = (LONG)(rf.GetTop() - 0.5f);  // TODO FIXME 这个值是试出来的 不知其所以然
		rc.right = (LONG)(rf.GetRight() + 1.5f); // 缩小窗口TabCtrl会有拖影 这里改成2 就可以消除拖影现象
		rc.bottom = (LONG)(rf.GetBottom() + 1.5f); // 很诡异 可能是因为GdiPlus认为x取大的 width也取大的
		::InvalidateRect(wnd->GetHWND(), &rc, TRUE);
	}
}
Ejemplo n.º 2
0
void VGraphicPath::_ComputeBounds()
{
	if (fComputeBoundsAccurate)
	{
		if (fPathMin == GP_BOUNDS_MIN_DEFAULT
			||
			fPathMax == GP_BOUNDS_MAX_DEFAULT)
			fBounds = VRect(0,0,0,0);
		else
			fBounds.SetCoords(	(GReal)fPathMin.x, 
								(GReal)fPathMin.y, 
								(GReal)(fPathMax.x-fPathMin.x), 
								(GReal)(fPathMax.y-fPathMin.y));
	}
	else
	{
#if ENABLE_D2D
		if (fPathD2D != NULL)
		{
			if (fGeomSink == NULL)
			{
				D2D1_RECT_F bounds;
				fPathD2D->GetBounds( NULL, &bounds);
				fBounds.SetCoords( bounds.left, bounds.top, bounds.right-bounds.left, bounds.bottom-bounds.top);
				return;
			}
		}
#endif

#if !GRAPHIC_MIXED_GDIPLUS_D2D
		if (!VWinD2DGraphicContext::IsAvailable())
		{
#endif
			Gdiplus::RectF bounds;
			fPath->GetBounds( &bounds);
			fBounds = VRect ( bounds.GetLeft(), bounds.GetTop(), bounds.GetRight()-bounds.GetLeft(), bounds.GetBottom()-bounds.GetTop());
#if !GRAPHIC_MIXED_GDIPLUS_D2D
		}
#endif
	}
}
Ejemplo n.º 3
0
void CPHTMLIFrameElement::PlaceControls(HWND hWndParent, CHTMFlowBlockContext* /*pC*/)
{
	ASSERT(0);
#if 0
	CLHTMLIFrameElement* pElement = static_cast<CLHTMLIFrameElement*>(m_pNode);

	if (m_pBox)
	{
		Gdiplus::RectF rcf = m_pBox->GetAbsInnerRect();

		CRect rc((int)rcf.X, (int)rcf.Y, (int)rcf.GetRight(), (int)rcf.GetBottom());

		if (pElement->m_pFrameContent == NULL)
		{
			CComObject<CLHTMLFrameContent>::CreateInstance(&pElement->m_pFrameContent);
			pElement->m_pFrameContent->AddRef();

			// TODO
			CPElement* pParent = this;
			while (pParent)
			{
				CComQIPtr<IOleInPlaceFrame> frame = static_cast<ILViewNode*>(pParent);
				if (frame)
				{
					pElement->m_pFrameContent->m_pInPlaceFrame = frame;
					break;
				}
				pParent = pParent->m_parent;
			}

			pElement->m_pFrameContent->m_hWnd = hWndParent;

			pElement->Load();
		}

		if (pElement->m_pFrameContent)
		{
			if (pElement->m_pFrameContent->m_spOleObject)
			{
				if (pElement->m_pFrameContent->m_pViewSite == NULL)
				{
#if 0
					pElement->m_pFrameContent->m_spOleObject->DoVerb(OLEIVERB_SHOW, NULL, pElement->m_pFrameContent, 0, hWndParent, &rc);
#endif
				}
				else
				{
					pElement->m_pFrameContent->m_pViewSite->SetRect(rc);
				}
			}
		}
	}

	if (pElement->m_pFrameContent)
	{
		if (pElement->m_pFrameContent->m_pViewSite)
		{
			ASSERT(pElement->m_pFrameContent->m_pViewSite->m_pIOleDocView);

			BOOL bShow = m_pBox != NULL;
			pElement->m_pFrameContent->m_pViewSite->m_pIOleDocView->Show(bShow);
		}
	}
#endif
}