//----------------------------------------------------------------------------//
Size Direct3D9Renderer::getAdjustedSize(const Size& sz)
{
    Size s(sz);

    if (!d_supportNPOTTex)
    {
        s.d_width  = getSizeNextPOT(sz.d_width);
        s.d_height = getSizeNextPOT(sz.d_height);
    }
    if (!d_supportNonSquareTex)
        s.d_width = s.d_height =
                        ceguimax(s.d_width, s.d_height);

    return s;
}
Beispiel #2
0
void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
	//printf("setMouseCursor(%i, %i, scale %u)\n", hotspotX, hotspotY, cursorTargetScale);

	int texWidth = getSizeNextPOT(w);
	int texHeight = getSizeNextPOT(h);
	int bufferSize =  texWidth * texHeight * sizeof(int16);
	int16* mouseBuf = (int16*)malloc(bufferSize);
	memset(mouseBuf, 0, bufferSize);

	for (int x = 0; x < w; ++x) {
		for (int y = 0; y < h; ++y) {
			byte color = buf[y * w + x];
			if (color != keycolor)
				mouseBuf[y * texWidth + x] = _palette[color] | 0x1;
			else
				mouseBuf[y * texWidth + x] = 0x0;
		}
	}

	iPhone_setMouseCursor(mouseBuf, w, h);

	if (_mouseBuf != NULL && (_mouseWidth != w || _mouseHeight != h)) {
		free(_mouseBuf);
		_mouseBuf = NULL;
	}

	if (_mouseBuf == NULL)
		_mouseBuf = (byte *)malloc(w * h);

	_mouseWidth = w;
	_mouseHeight = h;

	_mouseHotspotX = hotspotX;
	_mouseHotspotY = hotspotY;

	_mouseKeyColour = (byte)keycolor;

	memcpy(_mouseBuf, buf, w * h);

	_mouseDirty = true;
}