gdiplus: Implement GdipGetTextureTransform with test.
This commit is contained in:
parent
067a08efae
commit
48b8072518
|
@ -485,6 +485,7 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
|
|||
INT n_x, n_y, n_width, n_height, abs_height, stride, image_stride, i, bytespp;
|
||||
BOOL bm_is_selected;
|
||||
BYTE *dibits, *buff, *textbits;
|
||||
GpStatus status;
|
||||
|
||||
TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %p)\n", image, imageattr, x, y, width, height,
|
||||
texture);
|
||||
|
@ -577,6 +578,13 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
|
|||
*texture = GdipAlloc(sizeof(GpTexture));
|
||||
if (!*texture) return OutOfMemory;
|
||||
|
||||
if((status = GdipCreateMatrix(&(*texture)->transform)) != Ok){
|
||||
GdipFree(*texture);
|
||||
GdipFree(dibits);
|
||||
GdipFree(buff);
|
||||
return status;
|
||||
}
|
||||
|
||||
(*texture)->brush.lb.lbStyle = BS_DIBPATTERNPT;
|
||||
(*texture)->brush.lb.lbColor = DIB_RGB_COLORS;
|
||||
(*texture)->brush.lb.lbHatch = (ULONG_PTR)buff;
|
||||
|
@ -642,7 +650,10 @@ GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
|
|||
break;
|
||||
case BrushTypeSolidColor:
|
||||
case BrushTypeLinearGradient:
|
||||
break;
|
||||
case BrushTypeTextureFill:
|
||||
GdipDeleteMatrix(((GpTexture*)brush)->transform);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -872,6 +883,21 @@ GpStatus WINGDIPAPI GdipGetSolidFillColor(GpSolidFill *sf, ARGB *argb)
|
|||
return Ok;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* GdipGetTextureTransform [GDIPLUS.@]
|
||||
*/
|
||||
GpStatus WINGDIPAPI GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix)
|
||||
{
|
||||
TRACE("(%p, %p)\n", brush, matrix);
|
||||
|
||||
if(!brush || !matrix)
|
||||
return InvalidParameter;
|
||||
|
||||
memcpy(matrix, brush->transform, sizeof(GpMatrix));
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
|
||||
GDIPCONST REAL *blend, GDIPCONST REAL* positions, INT count)
|
||||
{
|
||||
|
|
|
@ -398,7 +398,7 @@
|
|||
@ stub GdipGetTextContrast
|
||||
@ stdcall GdipGetTextRenderingHint(ptr ptr)
|
||||
@ stub GdipGetTextureImage
|
||||
@ stub GdipGetTextureTransform
|
||||
@ stdcall GdipGetTextureTransform(ptr ptr)
|
||||
@ stub GdipGetTextureWrapMode
|
||||
@ stub GdipGetVisibleClipBounds
|
||||
@ stub GdipGetVisibleClipBoundsI
|
||||
|
|
|
@ -138,6 +138,7 @@ struct GpLineGradient{
|
|||
|
||||
struct GpTexture{
|
||||
GpBrush brush;
|
||||
GpMatrix *transform;
|
||||
};
|
||||
|
||||
struct GpPath{
|
||||
|
|
|
@ -169,6 +169,52 @@ static void test_getgamma(void)
|
|||
GdipDeleteBrush((GpBrush*)line);
|
||||
}
|
||||
|
||||
static void test_transform(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpTexture *texture;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpBitmap *bitmap;
|
||||
HDC hdc = GetDC(0);
|
||||
GpMatrix *m;
|
||||
BOOL res;
|
||||
|
||||
status = GdipCreateMatrix2(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, &m);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipCreateFromHDC(hdc, &graphics);
|
||||
expect(Ok, status);
|
||||
status = GdipCreateBitmapFromGraphics(1, 1, graphics, &bitmap);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipCreateTexture((GpImage*)bitmap, WrapModeTile, &texture);
|
||||
expect(Ok, status);
|
||||
|
||||
/* NULL */
|
||||
status = GdipGetTextureTransform(NULL, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
status = GdipGetTextureTransform(texture, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
/* default value - identity matrix */
|
||||
status = GdipGetTextureTransform(texture, m);
|
||||
expect(Ok, status);
|
||||
status = GdipIsMatrixIdentity(m, &res);
|
||||
expect(Ok, status);
|
||||
expect(TRUE, res);
|
||||
|
||||
status = GdipDeleteBrush((GpBrush*)texture);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipDeleteMatrix(m);
|
||||
expect(Ok, status);
|
||||
status = GdipDisposeImage((GpImage*)bitmap);
|
||||
expect(Ok, status);
|
||||
status = GdipDeleteGraphics(graphics);
|
||||
expect(Ok, status);
|
||||
ReleaseDC(0, hdc);
|
||||
}
|
||||
|
||||
START_TEST(brush)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -187,6 +233,7 @@ START_TEST(brush)
|
|||
test_getblend();
|
||||
test_getbounds();
|
||||
test_getgamma();
|
||||
test_transform();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue