Nikolay Sivov : resend patch 1/2: Gdiplus: Implement GdipBitmapGetHistogramSize.
Alexandre Julliard
julliard at winehq.org
Thu Nov 3 14:26:20 CDT 2016
Module: wine
Branch: master
Commit: 8de0275e48d9b64adc6c29f2df347b94e2cb1ce8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8de0275e48d9b64adc6c29f2df347b94e2cb1ce8
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Nov 2 12:56:30 2016 +0300
resend patch 1/2: Gdiplus: Implement GdipBitmapGetHistogramSize.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdiplus/gdiplus.spec | 2 +-
dlls/gdiplus/image.c | 14 +++++++++++++
dlls/gdiplus/tests/image.c | 48 ++++++++++++++++++++++++++++++++++++++++++++
include/gdipluscolormatrix.h | 13 ++++++++++++
include/gdiplusflat.h | 1 +
5 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index db0a49a..92251a7 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -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
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 74fad29..672b2e5 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -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;
+}
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 8c123b9..baf5c3b 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -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);
}
diff --git a/include/gdipluscolormatrix.h b/include/gdipluscolormatrix.h
index fbf1b2a..44016ff 100644
--- a/include/gdipluscolormatrix.h
+++ b/include/gdipluscolormatrix.h
@@ -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;
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index c6f16c4..824b460 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -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*);
More information about the wine-cvs
mailing list