ReactOS 0.4.16-dev-297-gc569aee
scaler.c File Reference
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodecs_private.h"
#include "wine/debug.h"
Include dependency graph for scaler.c:

Go to the source code of this file.

Classes

struct  BitmapScaler
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct BitmapScaler BitmapScaler
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wincodecs)
 
static BitmapScalerimpl_from_IWICBitmapScaler (IWICBitmapScaler *iface)
 
static BitmapScalerimpl_from_IMILBitmapScaler (IMILBitmapScaler *iface)
 
static HRESULT WINAPI BitmapScaler_QueryInterface (IWICBitmapScaler *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI BitmapScaler_AddRef (IWICBitmapScaler *iface)
 
static ULONG WINAPI BitmapScaler_Release (IWICBitmapScaler *iface)
 
static HRESULT WINAPI BitmapScaler_GetSize (IWICBitmapScaler *iface, UINT *puiWidth, UINT *puiHeight)
 
static HRESULT WINAPI BitmapScaler_GetPixelFormat (IWICBitmapScaler *iface, WICPixelFormatGUID *pPixelFormat)
 
static HRESULT WINAPI BitmapScaler_GetResolution (IWICBitmapScaler *iface, double *pDpiX, double *pDpiY)
 
static HRESULT WINAPI BitmapScaler_CopyPalette (IWICBitmapScaler *iface, IWICPalette *pIPalette)
 
static void NearestNeighbor_GetRequiredSourceRect (BitmapScaler *This, UINT x, UINT y, WICRect *src_rect)
 
static void NearestNeighbor_CopyScanline (BitmapScaler *This, UINT dst_x, UINT dst_y, UINT dst_width, BYTE **src_data, UINT src_data_x, UINT src_data_y, BYTE *pbBuffer)
 
static HRESULT WINAPI BitmapScaler_CopyPixels (IWICBitmapScaler *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
 
static HRESULT WINAPI BitmapScaler_Initialize (IWICBitmapScaler *iface, IWICBitmapSource *pISource, UINT uiWidth, UINT uiHeight, WICBitmapInterpolationMode mode)
 
static HRESULT WINAPI IMILBitmapScaler_QueryInterface (IMILBitmapScaler *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI IMILBitmapScaler_AddRef (IMILBitmapScaler *iface)
 
static ULONG WINAPI IMILBitmapScaler_Release (IMILBitmapScaler *iface)
 
static HRESULT WINAPI IMILBitmapScaler_GetSize (IMILBitmapScaler *iface, UINT *width, UINT *height)
 
static HRESULT WINAPI IMILBitmapScaler_GetPixelFormat (IMILBitmapScaler *iface, int *format)
 
static HRESULT WINAPI IMILBitmapScaler_GetResolution (IMILBitmapScaler *iface, double *dpix, double *dpiy)
 
static HRESULT WINAPI IMILBitmapScaler_CopyPalette (IMILBitmapScaler *iface, IWICPalette *palette)
 
static HRESULT WINAPI IMILBitmapScaler_CopyPixels (IMILBitmapScaler *iface, const WICRect *rc, UINT stride, UINT size, BYTE *buffer)
 
static HRESULT WINAPI IMILBitmapScaler_unknown1 (IMILBitmapScaler *iface, void **ppv)
 
static HRESULT WINAPI IMILBitmapScaler_Initialize (IMILBitmapScaler *iface, IMILBitmapSource *mil_source, UINT width, UINT height, WICBitmapInterpolationMode mode)
 
HRESULT BitmapScaler_Create (IWICBitmapScaler **scaler)
 

Variables

static const IWICBitmapScalerVtbl BitmapScaler_Vtbl
 
static const IMILBitmapScalerVtbl IMILBitmapScaler_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file scaler.c.

Typedef Documentation

◆ BitmapScaler

Function Documentation

◆ BitmapScaler_AddRef()

static ULONG WINAPI BitmapScaler_AddRef ( IWICBitmapScaler iface)
static

Definition at line 89 of file scaler.c.

90{
93
94 TRACE("(%p) refcount=%u\n", iface, ref);
95
96 return ref;
97}
#define InterlockedIncrement
Definition: armddk.h:53
static BitmapScaler * impl_from_IWICBitmapScaler(IWICBitmapScaler *iface)
Definition: scaler.c:50
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ BitmapScaler_CopyPalette()

static HRESULT WINAPI BitmapScaler_CopyPalette ( IWICBitmapScaler iface,
IWICPalette pIPalette 
)
static

Definition at line 168 of file scaler.c.

170{
172 TRACE("(%p,%p)\n", iface, pIPalette);
173
174 if (!pIPalette)
175 return E_INVALIDARG;
176
177 if (!This->source)
179
180 return IWICBitmapSource_CopyPalette(This->source, pIPalette);
181}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define WINCODEC_ERR_PALETTEUNAVAILABLE
Definition: winerror.h:3292

◆ BitmapScaler_CopyPixels()

static HRESULT WINAPI BitmapScaler_CopyPixels ( IWICBitmapScaler iface,
const WICRect prc,
UINT  cbStride,
UINT  cbBufferSize,
BYTE pbBuffer 
)
static

Definition at line 208 of file scaler.c.

210{
212 HRESULT hr;
213 WICRect dest_rect;
214 WICRect src_rect_ul, src_rect_br, src_rect;
215 BYTE **src_rows;
216 BYTE *src_bits;
217 ULONG bytesperrow;
218 ULONG src_bytesperrow;
220 UINT y;
221
222 TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
223
225
226 if (!This->source)
227 {
229 goto end;
230 }
231
232 if (prc)
233 dest_rect = *prc;
234 else
235 {
236 dest_rect.X = dest_rect.Y = 0;
237 dest_rect.Width = This->width;
238 dest_rect.Height = This->height;
239 }
240
241 if (dest_rect.X < 0 || dest_rect.Y < 0 ||
242 dest_rect.X+dest_rect.Width > This->width|| dest_rect.Y+dest_rect.Height > This->height)
243 {
245 goto end;
246 }
247
248 bytesperrow = ((This->bpp * dest_rect.Width)+7)/8;
249
250 if (cbStride < bytesperrow)
251 {
253 goto end;
254 }
255
256 if ((cbStride * dest_rect.Height) > cbBufferSize)
257 {
259 goto end;
260 }
261
262 /* MSDN recommends calling CopyPixels once for each scanline from top to
263 * bottom, and claims codecs optimize for this. Ideally, when called in this
264 * way, we should avoid requesting a scanline from the source more than
265 * once, by saving the data that will be useful for the next scanline after
266 * the call returns. The GetRequiredSourceRect/CopyScanline functions are
267 * designed to make it possible to do this in a generic way, but for now we
268 * just grab all the data we need in each call. */
269
270 This->fn_get_required_source_rect(This, dest_rect.X, dest_rect.Y, &src_rect_ul);
271 This->fn_get_required_source_rect(This, dest_rect.X+dest_rect.Width-1,
272 dest_rect.Y+dest_rect.Height-1, &src_rect_br);
273
274 src_rect.X = src_rect_ul.X;
275 src_rect.Y = src_rect_ul.Y;
276 src_rect.Width = src_rect_br.Width + src_rect_br.X - src_rect_ul.X;
277 src_rect.Height = src_rect_br.Height + src_rect_br.Y - src_rect_ul.Y;
278
279 src_bytesperrow = (src_rect.Width * This->bpp + 7)/8;
280 buffer_size = src_bytesperrow * src_rect.Height;
281
282 src_rows = HeapAlloc(GetProcessHeap(), 0, sizeof(BYTE*) * src_rect.Height);
283 src_bits = HeapAlloc(GetProcessHeap(), 0, buffer_size);
284
285 if (!src_rows || !src_bits)
286 {
287 HeapFree(GetProcessHeap(), 0, src_rows);
288 HeapFree(GetProcessHeap(), 0, src_bits);
290 goto end;
291 }
292
293 for (y=0; y<src_rect.Height; y++)
294 src_rows[y] = src_bits + y * src_bytesperrow;
295
296 hr = IWICBitmapSource_CopyPixels(This->source, &src_rect, src_bytesperrow,
297 buffer_size, src_bits);
298
299 if (SUCCEEDED(hr))
300 {
301 for (y=0; y < dest_rect.Height; y++)
302 {
303 This->fn_copy_scanline(This, dest_rect.X, dest_rect.Y+y, dest_rect.Width,
304 src_rows, src_rect.X, src_rect.Y, pbBuffer + cbStride * y);
305 }
306 }
307
308 HeapFree(GetProcessHeap(), 0, src_rows);
309 HeapFree(GetProcessHeap(), 0, src_bits);
310
311end:
313
314 return hr;
315}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
#define SUCCEEDED(hr)
Definition: intsafe.h:50
unsigned int UINT
Definition: ndis.h:50
_Out_ LPRECT prc
Definition: ntgdi.h:1658
HRESULT hr
Definition: shlfolder.c:183
INT Height
Definition: wincodec.idl:301
INT Width
Definition: wincodec.idl:300
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static const char * debug_wic_rect(const WICRect *rect)
#define WINCODEC_ERR_NOTINITIALIZED
Definition: winerror.h:3285
unsigned char BYTE
Definition: xxhash.c:193

◆ BitmapScaler_Create()

HRESULT BitmapScaler_Create ( IWICBitmapScaler **  scaler)

Definition at line 515 of file scaler.c.

516{
518
519 This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapScaler));
520 if (!This) return E_OUTOFMEMORY;
521
522 This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl;
523 This->IMILBitmapScaler_iface.lpVtbl = &IMILBitmapScaler_Vtbl;
524 This->ref = 1;
525 This->source = NULL;
526 This->width = 0;
527 This->height = 0;
528 This->src_width = 0;
529 This->src_height = 0;
530 This->mode = 0;
531 This->bpp = 0;
533 This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BitmapScaler.lock");
534
535 *scaler = &This->IWICBitmapScaler_iface;
536
537 return S_OK;
538}
#define NULL
Definition: types.h:112
#define S_OK
Definition: intsafe.h:52
static const IWICBitmapScalerVtbl BitmapScaler_Vtbl
Definition: scaler.c:383
static const IMILBitmapScalerVtbl IMILBitmapScaler_Vtbl
Definition: scaler.c:502
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76

Referenced by ImagingFactory_CreateBitmapScaler().

◆ BitmapScaler_GetPixelFormat()

static HRESULT WINAPI BitmapScaler_GetPixelFormat ( IWICBitmapScaler iface,
WICPixelFormatGUID pPixelFormat 
)
static

Definition at line 135 of file scaler.c.

137{
139 TRACE("(%p,%p)\n", iface, pPixelFormat);
140
141 if (!pPixelFormat)
142 return E_INVALIDARG;
143
144 if (!This->source)
145 {
146 memcpy(pPixelFormat, &GUID_WICPixelFormatDontCare, sizeof(*pPixelFormat));
147 return S_OK;
148 }
149
150 return IWICBitmapSource_GetPixelFormat(This->source, pPixelFormat);
151}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ BitmapScaler_GetResolution()

static HRESULT WINAPI BitmapScaler_GetResolution ( IWICBitmapScaler iface,
double pDpiX,
double pDpiY 
)
static

Definition at line 153 of file scaler.c.

155{
157 TRACE("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
158
159 if (!This->source)
161
162 if (!pDpiX || !pDpiY)
163 return E_INVALIDARG;
164
165 return IWICBitmapSource_GetResolution(This->source, pDpiX, pDpiY);
166}

◆ BitmapScaler_GetSize()

static HRESULT WINAPI BitmapScaler_GetSize ( IWICBitmapScaler iface,
UINT puiWidth,
UINT puiHeight 
)
static

Definition at line 117 of file scaler.c.

119{
121 TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
122
123 if (!This->source)
125
126 if (!puiWidth || !puiHeight)
127 return E_INVALIDARG;
128
129 *puiWidth = This->width;
130 *puiHeight = This->height;
131
132 return S_OK;
133}

◆ BitmapScaler_Initialize()

static HRESULT WINAPI BitmapScaler_Initialize ( IWICBitmapScaler iface,
IWICBitmapSource pISource,
UINT  uiWidth,
UINT  uiHeight,
WICBitmapInterpolationMode  mode 
)
static

Definition at line 317 of file scaler.c.

320{
322 HRESULT hr;
323 GUID src_pixelformat;
324
325 TRACE("(%p,%p,%u,%u,%u)\n", iface, pISource, uiWidth, uiHeight, mode);
326
327 if (!pISource || !uiWidth || !uiHeight)
328 return E_INVALIDARG;
329
331
332 if (This->source)
333 {
335 goto end;
336 }
337
338 This->width = uiWidth;
339 This->height = uiHeight;
340 This->mode = mode;
341
342 hr = IWICBitmapSource_GetSize(pISource, &This->src_width, &This->src_height);
343
344 if (SUCCEEDED(hr))
345 hr = IWICBitmapSource_GetPixelFormat(pISource, &src_pixelformat);
346
347 if (SUCCEEDED(hr))
348 {
349 hr = get_pixelformat_bpp(&src_pixelformat, &This->bpp);
350 }
351
352 if (SUCCEEDED(hr))
353 {
354 switch (mode)
355 {
356 default:
357 FIXME("unsupported mode %i\n", mode);
358 /* fall-through */
360 if ((This->bpp % 8) == 0)
361 {
362 IWICBitmapSource_AddRef(pISource);
363 This->source = pISource;
364 }
365 else
366 {
367 hr = WICConvertBitmapSource(&GUID_WICPixelFormat32bppBGRA,
368 pISource, &This->source);
369 This->bpp = 32;
370 }
371 This->fn_get_required_source_rect = NearestNeighbor_GetRequiredSourceRect;
372 This->fn_copy_scanline = NearestNeighbor_CopyScanline;
373 break;
374 }
375 }
376
377end:
379
380 return hr;
381}
#define FIXME(fmt,...)
Definition: precomp.h:53
HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst)
Definition: info.c:2474
HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
Definition: main.c:252
GLenum mode
Definition: glext.h:6217
static void NearestNeighbor_CopyScanline(BitmapScaler *This, UINT dst_x, UINT dst_y, UINT dst_width, BYTE **src_data, UINT src_data_x, UINT src_data_y, BYTE *pbBuffer)
Definition: scaler.c:191
static void NearestNeighbor_GetRequiredSourceRect(BitmapScaler *This, UINT x, UINT y, WICRect *src_rect)
Definition: scaler.c:183
@ WICBitmapInterpolationModeNearestNeighbor
Definition: wincodec.idl:77
#define WINCODEC_ERR_WRONGSTATE
Definition: winerror.h:3281

◆ BitmapScaler_QueryInterface()

static HRESULT WINAPI BitmapScaler_QueryInterface ( IWICBitmapScaler iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 60 of file scaler.c.

62{
64 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
65
66 if (!ppv) return E_INVALIDARG;
67
68 if (IsEqualIID(&IID_IUnknown, iid) ||
69 IsEqualIID(&IID_IWICBitmapSource, iid) ||
70 IsEqualIID(&IID_IWICBitmapScaler, iid))
71 {
72 *ppv = &This->IWICBitmapScaler_iface;
73 }
74 else if (IsEqualIID(&IID_IMILBitmapScaler, iid))
75 {
76 *ppv = &This->IMILBitmapScaler_iface;
77 }
78 else
79 {
80 FIXME("unknown interface %s\n", debugstr_guid(iid));
81 *ppv = NULL;
82 return E_NOINTERFACE;
83 }
84
85 IUnknown_AddRef((IUnknown*)*ppv);
86 return S_OK;
87}
const GUID IID_IUnknown
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ BitmapScaler_Release()

static ULONG WINAPI BitmapScaler_Release ( IWICBitmapScaler iface)
static

Definition at line 99 of file scaler.c.

100{
103
104 TRACE("(%p) refcount=%u\n", iface, ref);
105
106 if (ref == 0)
107 {
108 This->lock.DebugInfo->Spare[0] = 0;
110 if (This->source) IWICBitmapSource_Release(This->source);
112 }
113
114 return ref;
115}
#define InterlockedDecrement
Definition: armddk.h:52
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

◆ IMILBitmapScaler_AddRef()

static ULONG WINAPI IMILBitmapScaler_AddRef ( IMILBitmapScaler *  iface)
static

Definition at line 403 of file scaler.c.

404{
406 return IWICBitmapScaler_AddRef(&This->IWICBitmapScaler_iface);
407}
static BitmapScaler * impl_from_IMILBitmapScaler(IMILBitmapScaler *iface)
Definition: scaler.c:55

◆ IMILBitmapScaler_CopyPalette()

static HRESULT WINAPI IMILBitmapScaler_CopyPalette ( IMILBitmapScaler *  iface,
IWICPalette palette 
)
static

Definition at line 454 of file scaler.c.

456{
458
459 TRACE("(%p,%p)\n", iface, palette);
460
461 if (!This->source)
463
464 return IWICBitmapScaler_CopyPalette(&This->IWICBitmapScaler_iface, palette);
465}
static HPALETTE palette
Definition: clipboard.c:1345

◆ IMILBitmapScaler_CopyPixels()

static HRESULT WINAPI IMILBitmapScaler_CopyPixels ( IMILBitmapScaler *  iface,
const WICRect rc,
UINT  stride,
UINT  size,
BYTE buffer 
)
static

Definition at line 467 of file scaler.c.

469{
471 TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, size, buffer);
472 return IWICBitmapScaler_CopyPixels(&This->IWICBitmapScaler_iface, rc, stride, size, buffer);
473}
GLsizeiptr size
Definition: glext.h:5919
GLsizei stride
Definition: glext.h:5848
GLuint buffer
Definition: glext.h:5915

◆ IMILBitmapScaler_GetPixelFormat()

static HRESULT WINAPI IMILBitmapScaler_GetPixelFormat ( IMILBitmapScaler *  iface,
int format 
)
static

Definition at line 423 of file scaler.c.

425{
427 IMILBitmapSource *source;
428 HRESULT hr;
429
430 TRACE("(%p,%p)\n", iface, format);
431
432 if (!format) return E_INVALIDARG;
433
434 if (!This->source)
436
437 hr = IWICBitmapSource_QueryInterface(This->source, &IID_IMILBitmapSource, (void **)&source);
438 if (hr == S_OK)
439 {
440 hr = source->lpVtbl->GetPixelFormat(source, format);
441 source->lpVtbl->Release(source);
442 }
443 return hr;
444}
Definition: format.c:58

◆ IMILBitmapScaler_GetResolution()

static HRESULT WINAPI IMILBitmapScaler_GetResolution ( IMILBitmapScaler *  iface,
double dpix,
double dpiy 
)
static

Definition at line 446 of file scaler.c.

448{
450 TRACE("(%p,%p,%p)\n", iface, dpix, dpiy);
451 return IWICBitmapScaler_GetResolution(&This->IWICBitmapScaler_iface, dpix, dpiy);
452}

◆ IMILBitmapScaler_GetSize()

static HRESULT WINAPI IMILBitmapScaler_GetSize ( IMILBitmapScaler *  iface,
UINT width,
UINT height 
)
static

Definition at line 415 of file scaler.c.

417{
419 TRACE("(%p,%p,%p)\n", iface, width, height);
420 return IWICBitmapScaler_GetSize(&This->IWICBitmapScaler_iface, width, height);
421}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546

◆ IMILBitmapScaler_Initialize()

static HRESULT WINAPI IMILBitmapScaler_Initialize ( IMILBitmapScaler *  iface,
IMILBitmapSource *  mil_source,
UINT  width,
UINT  height,
WICBitmapInterpolationMode  mode 
)
static

Definition at line 481 of file scaler.c.

484{
486 IWICBitmapSource *wic_source;
487 HRESULT hr;
488
489 TRACE("(%p,%p,%u,%u,%u)\n", iface, mil_source, width, height, mode);
490
491 if (!mil_source) return E_INVALIDARG;
492
493 hr = mil_source->lpVtbl->QueryInterface(mil_source, &IID_IWICBitmapSource, (void **)&wic_source);
494 if (hr == S_OK)
495 {
496 hr = IWICBitmapScaler_Initialize(&This->IWICBitmapScaler_iface, wic_source, width, height, mode);
497 IWICBitmapSource_Release(wic_source);
498 }
499 return hr;
500}
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)

◆ IMILBitmapScaler_QueryInterface()

static HRESULT WINAPI IMILBitmapScaler_QueryInterface ( IMILBitmapScaler *  iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 395 of file scaler.c.

397{
399 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
400 return IWICBitmapScaler_QueryInterface(&This->IWICBitmapScaler_iface, iid, ppv);
401}

◆ IMILBitmapScaler_Release()

static ULONG WINAPI IMILBitmapScaler_Release ( IMILBitmapScaler *  iface)
static

Definition at line 409 of file scaler.c.

410{
412 return IWICBitmapScaler_Release(&This->IWICBitmapScaler_iface);
413}

◆ IMILBitmapScaler_unknown1()

static HRESULT WINAPI IMILBitmapScaler_unknown1 ( IMILBitmapScaler *  iface,
void **  ppv 
)
static

Definition at line 475 of file scaler.c.

476{
477 TRACE("(%p,%p)\n", iface, ppv);
478 return E_NOINTERFACE;
479}

◆ impl_from_IMILBitmapScaler()

static BitmapScaler * impl_from_IMILBitmapScaler ( IMILBitmapScaler *  iface)
inlinestatic

◆ impl_from_IWICBitmapScaler()

◆ NearestNeighbor_CopyScanline()

static void NearestNeighbor_CopyScanline ( BitmapScaler This,
UINT  dst_x,
UINT  dst_y,
UINT  dst_width,
BYTE **  src_data,
UINT  src_data_x,
UINT  src_data_y,
BYTE pbBuffer 
)
static

Definition at line 191 of file scaler.c.

194{
195 UINT i;
196 UINT bytesperpixel = This->bpp/8;
197 UINT src_x, src_y;
198
199 src_y = dst_y * This->src_height / This->height - src_data_y;
200
201 for (i=0; i<dst_width; i++)
202 {
203 src_x = (dst_x + i) * This->src_width / This->width - src_data_x;
204 memcpy(pbBuffer + bytesperpixel * i, src_data[src_y] + bytesperpixel * src_x, bytesperpixel);
205 }
206}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by BitmapScaler_Initialize().

◆ NearestNeighbor_GetRequiredSourceRect()

static void NearestNeighbor_GetRequiredSourceRect ( BitmapScaler This,
UINT  x,
UINT  y,
WICRect src_rect 
)
static

Definition at line 183 of file scaler.c.

185{
186 src_rect->X = x * This->src_width / This->width;
187 src_rect->Y = y * This->src_height / This->height;
188 src_rect->Width = src_rect->Height = 1;
189}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548

Referenced by BitmapScaler_Initialize().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wincodecs  )

Variable Documentation

◆ BitmapScaler_Vtbl

const IWICBitmapScalerVtbl BitmapScaler_Vtbl
static
Initial value:
= {
}
static HRESULT WINAPI BitmapScaler_GetPixelFormat(IWICBitmapScaler *iface, WICPixelFormatGUID *pPixelFormat)
Definition: scaler.c:135
static ULONG WINAPI BitmapScaler_Release(IWICBitmapScaler *iface)
Definition: scaler.c:99
static HRESULT WINAPI BitmapScaler_QueryInterface(IWICBitmapScaler *iface, REFIID iid, void **ppv)
Definition: scaler.c:60
static HRESULT WINAPI BitmapScaler_CopyPalette(IWICBitmapScaler *iface, IWICPalette *pIPalette)
Definition: scaler.c:168
static ULONG WINAPI BitmapScaler_AddRef(IWICBitmapScaler *iface)
Definition: scaler.c:89
static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
Definition: scaler.c:208
static HRESULT WINAPI BitmapScaler_Initialize(IWICBitmapScaler *iface, IWICBitmapSource *pISource, UINT uiWidth, UINT uiHeight, WICBitmapInterpolationMode mode)
Definition: scaler.c:317
static HRESULT WINAPI BitmapScaler_GetSize(IWICBitmapScaler *iface, UINT *puiWidth, UINT *puiHeight)
Definition: scaler.c:117
static HRESULT WINAPI BitmapScaler_GetResolution(IWICBitmapScaler *iface, double *pDpiX, double *pDpiY)
Definition: scaler.c:153

Definition at line 383 of file scaler.c.

Referenced by BitmapScaler_Create().

◆ IMILBitmapScaler_Vtbl

const IMILBitmapScalerVtbl IMILBitmapScaler_Vtbl
static
Initial value:
= {
}
static ULONG WINAPI IMILBitmapScaler_AddRef(IMILBitmapScaler *iface)
Definition: scaler.c:403
static HRESULT WINAPI IMILBitmapScaler_GetPixelFormat(IMILBitmapScaler *iface, int *format)
Definition: scaler.c:423
static ULONG WINAPI IMILBitmapScaler_Release(IMILBitmapScaler *iface)
Definition: scaler.c:409
static HRESULT WINAPI IMILBitmapScaler_CopyPixels(IMILBitmapScaler *iface, const WICRect *rc, UINT stride, UINT size, BYTE *buffer)
Definition: scaler.c:467
static HRESULT WINAPI IMILBitmapScaler_unknown1(IMILBitmapScaler *iface, void **ppv)
Definition: scaler.c:475
static HRESULT WINAPI IMILBitmapScaler_CopyPalette(IMILBitmapScaler *iface, IWICPalette *palette)
Definition: scaler.c:454
static HRESULT WINAPI IMILBitmapScaler_QueryInterface(IMILBitmapScaler *iface, REFIID iid, void **ppv)
Definition: scaler.c:395
static HRESULT WINAPI IMILBitmapScaler_Initialize(IMILBitmapScaler *iface, IMILBitmapSource *mil_source, UINT width, UINT height, WICBitmapInterpolationMode mode)
Definition: scaler.c:481
static HRESULT WINAPI IMILBitmapScaler_GetResolution(IMILBitmapScaler *iface, double *dpix, double *dpiy)
Definition: scaler.c:446
static HRESULT WINAPI IMILBitmapScaler_GetSize(IMILBitmapScaler *iface, UINT *width, UINT *height)
Definition: scaler.c:415

Definition at line 502 of file scaler.c.

Referenced by BitmapScaler_Create().