resend patch 1/2: Gdiplus: Implement GdipBitmapGetHistogramSize.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-11-02 12:56:30 +03:00 committed by Alexandre Julliard
parent 86ec169712
commit 8de0275e48
5 changed files with 77 additions and 1 deletions

View File

@ -619,7 +619,7 @@
619 stdcall GdipBitmapCreateApplyEffect(ptr long ptr ptr ptr ptr long ptr ptr)
620 stdcall GdipBitmapApplyEffect(ptr ptr ptr long ptr ptr)
621 stub GdipBitmapGetHistogram
622 stub GdipBitmapGetHistogramSize
622 stdcall GdipBitmapGetHistogramSize(long ptr)
623 stdcall GdipBitmapConvertFormat(ptr long long long ptr float)
624 stdcall GdipImageSetAbort(ptr ptr)
625 stub GdipGraphicsSetAbort

View File

@ -5386,3 +5386,17 @@ GpStatus WINGDIPAPI GdipBitmapConvertFormat(GpBitmap *bitmap, PixelFormat format
FIXME("(%p, 0x%08x, %d, %d, %p, %f): stub\n", bitmap, format, dithertype, palettetype, palette, alphathreshold);
return NotImplemented;
}
/*****************************************************************************
* GdipBitmapGetHistogramSize [GDIPLUS.@]
*/
GpStatus WINGDIPAPI GdipBitmapGetHistogramSize(HistogramFormat format, UINT *num_of_entries)
{
TRACE("(%d, %p)\n", format, num_of_entries);
if (!num_of_entries)
return InvalidParameter;
*num_of_entries = 256;
return Ok;
}

View File

@ -30,6 +30,8 @@
#include "gdiplus.h"
#include "wine/test.h"
static GpStatus (WINAPI *pGdipBitmapGetHistogramSize)(HistogramFormat,UINT*);
#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (UINT)(expected), (UINT)(got))
#define expectf(expected, got) ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got))
@ -4785,8 +4787,51 @@ static void test_getadjustedpalette(void)
GdipDisposeImageAttributes(imageattributes);
}
static void test_histogramsize(void)
{
HistogramFormat test_formats[] =
{
HistogramFormatARGB,
HistogramFormatPARGB,
HistogramFormatRGB,
HistogramFormatGray,
HistogramFormatB,
HistogramFormatG,
HistogramFormatR,
HistogramFormatA,
};
GpStatus stat;
UINT num, i;
if (!pGdipBitmapGetHistogramSize)
{
win_skip("GdipBitmapGetHistogramSize is not supported\n");
return;
}
stat = pGdipBitmapGetHistogramSize(HistogramFormatARGB, NULL);
expect(InvalidParameter, stat);
stat = pGdipBitmapGetHistogramSize(0xff, NULL);
expect(InvalidParameter, stat);
num = 123;
stat = pGdipBitmapGetHistogramSize(10, &num);
expect(Ok, stat);
expect(256, num);
for (i = 0; i < sizeof(test_formats)/sizeof(test_formats[0]); i++)
{
num = 0;
stat = pGdipBitmapGetHistogramSize(test_formats[i], &num);
expect(Ok, stat);
expect(256, num);
}
}
START_TEST(image)
{
HMODULE mod = GetModuleHandleA("gdiplus.dll");
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
@ -4797,6 +4842,8 @@ START_TEST(image)
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
pGdipBitmapGetHistogramSize = (void*)GetProcAddress(mod, "GdipBitmapGetHistogramSize");
test_supported_encoders();
test_CloneBitmapArea();
test_ARGB_conversion();
@ -4843,6 +4890,7 @@ START_TEST(image)
test_dispose();
test_createeffect();
test_getadjustedpalette();
test_histogramsize();
GdiplusShutdown(gdiplusToken);
}

View File

@ -48,10 +48,23 @@ struct ColorMap
Color newColor;
};
enum HistogramFormat
{
HistogramFormatARGB,
HistogramFormatPARGB,
HistogramFormatRGB,
HistogramFormatGray,
HistogramFormatB,
HistogramFormatG,
HistogramFormatR,
HistogramFormatA,
};
#ifndef __cplusplus
typedef enum ColorAdjustType ColorAdjustType;
typedef enum ColorMatrixFlags ColorMatrixFlags;
typedef enum HistogramFormat HistogramFormat;
typedef struct ColorMatrix ColorMatrix;
typedef struct ColorMap ColorMap;

View File

@ -41,6 +41,7 @@ GpStatus WINGDIPAPI GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap*,REAL);
/* Bitmap */
GpStatus WINGDIPAPI GdipBitmapApplyEffect(GpBitmap*,CGpEffect*,RECT*,BOOL,VOID**,INT*);
GpStatus WINGDIPAPI GdipBitmapCreateApplyEffect(GpBitmap**,INT,CGpEffect*,RECT*,RECT*,GpBitmap**,BOOL,VOID**,INT*);
GpStatus WINGDIPAPI GdipBitmapGetHistogramSize(HistogramFormat,UINT*);
GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap*,INT,INT,ARGB*);
GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap*,GDIPCONST GpRect*,UINT,
PixelFormat,BitmapData*);