xserver-multidpi/randr/rrtransform.c
Paulo Cesar Pereira de Andrade d6cbd4511e Export symbols defined in the sdk.
This is the biggest "visibility" patch. Instead of doing a "export"
symbol on demand, export everything in the sdk, so that if some module
fails due to an unresolved symbol, it is because it is using a symbol
not in the sdk.

  Most exported symbols shouldn't really be made visible, neither
advertised in the sdk, as they are only used by a single shared object.

  Symbols in the sdk (or referenced in sdk macros), but not defined
anywhere include:
XkbBuildCoreState()
XkbInitialMap
XkbXIUnsupported
XkbCheckActionVMods()
XkbSendCompatNotify()
XkbDDXFakePointerButton()
XkbDDXApplyConfig()
_XkbStrCaseCmp()
_XkbErrMessages[]
_XkbErrCode
_XkbErrLocation
_XkbErrData
XkbAccessXDetailText()
XkbNKNDetailMaskText()
XkbLookupGroupAndLevel()
XkbInitAtoms()
XkbGetOrderedDrawables()
XkbFreeOrderedDrawables()
XkbConvertXkbComponents()
XkbWriteXKBSemantics()
XkbWriteXKBLayout()
XkbWriteXKBKeymap()
XkbWriteXKBFile()
XkbWriteCFile()
XkbWriteXKMFile()
XkbWriteToServer()
XkbMergeFile()
XkmFindTOCEntry()
XkmReadFileSection()
XkmReadFileSectionName()
InitExtInput()
xf86CheckButton()
xf86SwitchCoreDevice()
RamDacSetGamma()
RamDacRestoreDACValues()
xf86Bpp
xf86ConfigPix24
xf86MouseCflags[]
xf86SupportedMouseTypes[]
xf86NumMouseTypes
xf86ChangeBusIndex()
xf86EntityEnter()
xf86EntityLeave()
xf86WrapperInit()
xf86RingBell()
xf86findOptionBoolean()
xf86debugListOptions()
LoadSubModuleLocal()
LoaderSymbolLocal()
getInt10Rec()
xf86CurrentScreen
xf86ReallocatePciResources()
xf86NewSerialNumber()
xf86RandRSetInitialMode()
fbCompositeSolidMask_nx1xn
fbCompositeSolidMask_nx8888x0565C
fbCompositeSolidMask_nx8888x8888C
fbCompositeSolidMask_nx8x0565
fbCompositeSolidMask_nx8x0888
fbCompositeSolidMask_nx8x8888
fbCompositeSrc_0565x0565
fbCompositeSrc_8888x0565
fbCompositeSrc_8888x0888
fbCompositeSrc_8888x8888
fbCompositeSrcAdd_1000x1000
fbCompositeSrcAdd_8000x8000
fbCompositeSrcAdd_8888x8888
fbGeneration
fbIn
fbOver
fbOver24
fbOverlayGeneration
fbRasterizeEdges
fbRestoreAreas
fbSaveAreas
composeFunctions
VBEBuildVbeModeList()
VBECalcVbeModeIndex()
TIramdac3030CalculateMNPForClock()
shadowBufPtr
shadowFindBuf()
miRRGetScreenInfo()
RRSetScreenConfig()
RRModePruneUnused()
PixmanImageFromPicture()
extern int miPointerGetMotionEvents()
miClipPicture()
miRasterizeTriangle()
fbPush1toN()
fbInitializeBackingStore()
ddxBeforeReset()
SetupSprite()
InitSprite()
DGADeliverEvent()

  SPECIAL CASES
o defined as _X_INTERNAL
	xf86NewInputDevice()
o defined as static
	fbGCPrivateKey
	fbOverlayScreenPrivateKey
	fbScreenPrivateKey
	fbWinPrivateKey
o defined in libXfont.so, but declared in xorg/dixfont.h
	GetGlyphs()
	QueryGlyphExtents()
	QueryTextExtents()
	ParseGlyphCachingMode()
	InitGlyphCaching()
	SetGlyphCachingMode()
2008-11-29 23:56:06 -02:00

261 lines
7.6 KiB
C

/*
* Copyright © 2007 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include "randrstr.h"
#include "rrtransform.h"
_X_EXPORT void
RRTransformInit (RRTransformPtr transform)
{
pixman_transform_init_identity (&transform->transform);
pixman_f_transform_init_identity (&transform->f_transform);
pixman_f_transform_init_identity (&transform->f_inverse);
transform->filter = NULL;
transform->params = NULL;
transform->nparams = 0;
}
_X_EXPORT void
RRTransformFini (RRTransformPtr transform)
{
if (transform->params)
xfree (transform->params);
}
_X_EXPORT Bool
RRTransformEqual (RRTransformPtr a, RRTransformPtr b)
{
if (a && pixman_transform_is_identity (&a->transform))
a = NULL;
if (b && pixman_transform_is_identity (&b->transform))
b = NULL;
if (a == NULL && b == NULL)
return TRUE;
if (a == NULL || b == NULL)
return FALSE;
if (memcmp (&a->transform, &b->transform, sizeof (a->transform)) != 0)
return FALSE;
if (a->filter != b->filter)
return FALSE;
if (a->nparams != b->nparams)
return FALSE;
if (memcmp (a->params, b->params, a->nparams * sizeof (xFixed)) != 0)
return FALSE;
return TRUE;
}
_X_EXPORT Bool
RRTransformSetFilter (RRTransformPtr dst,
PictFilterPtr filter,
xFixed *params,
int nparams,
int width,
int height)
{
xFixed *new_params;
if (nparams)
{
new_params = xalloc (nparams * sizeof (xFixed));
if (!new_params)
return FALSE;
memcpy (new_params, params, nparams * sizeof (xFixed));
}
else
new_params = NULL;
if (dst->params)
xfree (dst->params);
dst->filter = filter;
dst->params = new_params;
dst->nparams = nparams;
dst->width = width;
dst->height = height;
return TRUE;
}
_X_EXPORT Bool
RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
{
if (src && pixman_transform_is_identity (&src->transform))
src = NULL;
if (src)
{
if (!RRTransformSetFilter (dst, src->filter,
src->params, src->nparams, src->width, src->height))
return FALSE;
dst->transform = src->transform;
dst->f_transform = src->f_transform;
dst->f_inverse = src->f_inverse;
}
else
{
if (!RRTransformSetFilter (dst, NULL, NULL, 0, 0, 0))
return FALSE;
pixman_transform_init_identity (&dst->transform);
pixman_f_transform_init_identity (&dst->f_transform);
pixman_f_transform_init_identity (&dst->f_inverse);
}
return TRUE;
}
#define F(x) IntToxFixed(x)
/*
* Compute the complete transformation matrix including
* client-specified transform, rotation/reflection values and the crtc
* offset.
*
* Return TRUE if the resulting transform is not a simple translation.
*/
_X_EXPORT Bool
RRTransformCompute (int x,
int y,
int width,
int height,
Rotation rotation,
RRTransformPtr rr_transform,
PictTransformPtr transform,
struct pixman_f_transform *f_transform,
struct pixman_f_transform *f_inverse)
{
PictTransform t_transform, inverse;
struct pixman_f_transform tf_transform, tf_inverse;
if (!transform) transform = &t_transform;
if (!f_transform) f_transform = &tf_transform;
if (!f_inverse) f_inverse = &tf_inverse;
pixman_transform_init_identity (transform);
pixman_transform_init_identity (&inverse);
pixman_f_transform_init_identity (f_transform);
pixman_f_transform_init_identity (f_inverse);
if (rotation != RR_Rotate_0)
{
double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy;
double f_scale_x, f_scale_y, f_scale_dx, f_scale_dy;
xFixed rot_cos, rot_sin, rot_dx, rot_dy;
xFixed scale_x, scale_y, scale_dx, scale_dy;
/* rotation */
switch (rotation & 0xf) {
default:
case RR_Rotate_0:
f_rot_cos = 1; f_rot_sin = 0;
f_rot_dx = 0; f_rot_dy = 0;
rot_cos = F ( 1); rot_sin = F ( 0);
rot_dx = F ( 0); rot_dy = F ( 0);
break;
case RR_Rotate_90:
f_rot_cos = 0; f_rot_sin = 1;
f_rot_dx = height; f_rot_dy = 0;
rot_cos = F ( 0); rot_sin = F ( 1);
rot_dx = F ( height); rot_dy = F (0);
break;
case RR_Rotate_180:
f_rot_cos = -1; f_rot_sin = 0;
f_rot_dx = width; f_rot_dy = height;
rot_cos = F (-1); rot_sin = F ( 0);
rot_dx = F (width); rot_dy = F ( height);
break;
case RR_Rotate_270:
f_rot_cos = 0; f_rot_sin = -1;
f_rot_dx = 0; f_rot_dy = width;
rot_cos = F ( 0); rot_sin = F (-1);
rot_dx = F ( 0); rot_dy = F ( width);
break;
}
pixman_transform_rotate (transform, &inverse, rot_cos, rot_sin);
pixman_transform_translate (transform, &inverse, rot_dx, rot_dy);
pixman_f_transform_rotate (f_transform, f_inverse, f_rot_cos, f_rot_sin);
pixman_f_transform_translate (f_transform, f_inverse, f_rot_dx, f_rot_dy);
/* reflection */
f_scale_x = 1;
f_scale_dx = 0;
f_scale_y = 1;
f_scale_dy = 0;
scale_x = F (1);
scale_dx = 0;
scale_y = F (1);
scale_dy = 0;
if (rotation & RR_Reflect_X)
{
f_scale_x = -1;
scale_x = F(-1);
if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
f_scale_dx = width;
scale_dx = F(width);
} else {
f_scale_dx = height;
scale_dx = F(height);
}
}
if (rotation & RR_Reflect_Y)
{
f_scale_y = -1;
scale_y = F(-1);
if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
f_scale_dy = height;
scale_dy = F(height);
} else {
f_scale_dy = width;
scale_dy = F(width);
}
}
pixman_transform_scale (transform, &inverse, scale_x, scale_y);
pixman_f_transform_scale (f_transform, f_inverse, f_scale_x, f_scale_y);
pixman_transform_translate (transform, &inverse, scale_dx, scale_dy);
pixman_f_transform_translate (f_transform, f_inverse, f_scale_dx, f_scale_dy);
}
#ifdef RANDR_12_INTERFACE
if (rr_transform)
{
pixman_transform_multiply (transform, transform, &rr_transform->transform);
pixman_f_transform_multiply (f_transform, f_transform, &rr_transform->f_transform);
pixman_f_transform_multiply (f_inverse, &rr_transform->f_inverse, f_inverse);
}
#endif
/*
* Compute the class of the resulting transform
*/
if (pixman_transform_is_identity (transform))
{
pixman_transform_init_translate (transform, F ( x), F ( y));
pixman_f_transform_init_translate (f_transform, F( x), F( y));
pixman_f_transform_init_translate (f_inverse, F(-x), F(-y));
return FALSE;
}
else
{
pixman_transform_translate (&inverse, transform, x, y);
pixman_f_transform_translate (f_inverse, f_transform, x, y);
return TRUE;
}
}