Exemplo n.º 1
0
void OSScreenManager::blitFrom(SurfaceNum surfaceNum, const Rect *rect, CVideoSurface *src, int v) {
	// Get the dest surface
	CVideoSurface *destSurface = _frontRenderSurface;
	if (surfaceNum < -1)
		return;
	if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size())
		destSurface = _backSurfaces[surfaceNum]._surface;
	if (!destSurface->hasSurface())
		return;

	if (!rect->isEmpty())
		destSurface->blitFrom(Point(rect->left, rect->top), src, rect);
}
Exemplo n.º 2
0
void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src,
		const Point *destPos, const Rect *srcRect) {
	// Get the dest surface
	CVideoSurface *destSurface = _frontRenderSurface;
	if (surfaceNum < -1)
		return;
	if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size())
		destSurface = _backSurfaces[surfaceNum]._surface;
	if (!destSurface->hasSurface())
		return;

	Point destPoint = destPos ? *destPos : Point(0, 0);
	Rect srcBounds = srcRect ? *srcRect : Rect(0, 0, src->getWidth(), src->getHeight());
	Rect *bounds = &srcBounds;
	Rect rect2;

	Rect surfaceBounds = (surfaceNum == SURFACE_PRIMARY) ? _frontSurfaceBounds :
		_backSurfaces[surfaceNum]._bounds;

	if (!surfaceBounds.isEmpty()) {
		// Perform clipping to the bounds of the back surface
		rect2 = srcBounds;
		rect2.translate(-srcBounds.left, -srcBounds.top);
		rect2.translate(destPoint.x, destPoint.y);
		rect2.constrain(surfaceBounds);

		rect2.translate(-destPoint.x, -destPoint.y);
		rect2.translate(srcBounds.left, srcBounds.top);

		if (rect2.isEmpty())
			return;

		destPoint.x += rect2.left - srcBounds.left;
		destPoint.y += rect2.top - srcBounds.top;
		bounds = &rect2;
	}

	if (!bounds->isEmpty())
		destSurface->blitFrom(destPoint, src, bounds);
}