Example #1
0
	grect WinRT::rotateViewport(grect viewport)
	{
		static int w = 0;
		static int h = 0;
		if (w == 0 || h == 0)
		{
			gvec2 resolution = april::getSystemInfo().displayResolution;
			w = hround(resolution.x);
			h = hround(resolution.y);
			CHECK_SWAP(w, h);
		}
		int rotation = WinRT::getScreenRotation();
		if (rotation == 90)
		{
			hswap(viewport.x, viewport.y);
			hswap(viewport.w, viewport.h);
			viewport.x = w - (viewport.x + viewport.w);
		}
		else if (rotation == 180)
		{
			viewport.x = w - (viewport.x + viewport.w);
			viewport.y = h - (viewport.y + viewport.h);
		}
		else if (rotation == 270)
		{
			hswap(viewport.x, viewport.y);
			hswap(viewport.w, viewport.h);
			viewport.y = h - (viewport.y + viewport.h);
		}
		return viewport;
	}
Example #2
0
	int Buffer::calcInputSize(int size)
	{
		return hround((float)size * this->getSamplingRate() * this->getChannels() * this->getBitsPerSample() /
			((float)xal::manager->getSamplingRate() * xal::manager->getChannels() * xal::manager->getBitsPerSample()));
	}