ReactOS 0.4.16-dev-753-g705a985
scaler.c File Reference
#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 22 of file scaler.c.

Typedef Documentation

◆ BitmapScaler

Function Documentation

◆ BitmapScaler_AddRef()

static ULONG WINAPI BitmapScaler_AddRef ( IWICBitmapScaler iface)
static

Definition at line 87 of file scaler.c.

88{
91
92 TRACE("(%p) refcount=%lu\n", iface, ref);
93
94 return ref;
95}
#define InterlockedIncrement
Definition: armddk.h:53
static BitmapScaler * impl_from_IWICBitmapScaler(IWICBitmapScaler *iface)
Definition: scaler.c:48
#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 166 of file scaler.c.

168{
170 TRACE("(%p,%p)\n", iface, pIPalette);
171
172 if (!pIPalette)
173 return E_INVALIDARG;
174
175 if (!This->source)
177
178 return IWICBitmapSource_CopyPalette(This->source, pIPalette);
179}
#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 206 of file scaler.c.

208{
210 HRESULT hr;
211 WICRect dest_rect;
212 WICRect src_rect_ul, src_rect_br, src_rect;
213 BYTE **src_rows;
214 BYTE *src_bits;
215 ULONG bytesperrow;
216 ULONG src_bytesperrow;
218 UINT y;
219
220 TRACE("(%p,%s,%u,%u,%p)\n", iface, debug_wic_rect(prc), cbStride, cbBufferSize, pbBuffer);
221
223
224 if (!This->source)
225 {
227 goto end;
228 }
229
230 if (prc)
231 dest_rect = *prc;
232 else
233 {
234 dest_rect.X = dest_rect.Y = 0;
235 dest_rect.Width = This->width;
236 dest_rect.Height = This->height;
237 }
238
239 if (dest_rect.X < 0 || dest_rect.Y < 0 ||
240 dest_rect.X+dest_rect.Width > This->width|| dest_rect.Y+dest_rect.Height > This->height)
241 {
243 goto end;
244 }
245
246 bytesperrow = ((This->bpp * dest_rect.Width)+7)/8;
247
248 if (cbStride < bytesperrow)
249 {
251 goto end;
252 }
253
254 if (cbStride * (dest_rect.Height - 1) + bytesperrow > cbBufferSize)
255 {
257 goto end;
258 }
259
260 /* MSDN recommends calling CopyPixels once for each scanline from top to
261 * bottom, and claims codecs optimize for this. Ideally, when called in this
262 * way, we should avoid requesting a scanline from the source more than
263 * once, by saving the data that will be useful for the next scanline after
264 * the call returns. The GetRequiredSourceRect/CopyScanline functions are
265 * designed to make it possible to do this in a generic way, but for now we
266 * just grab all the data we need in each call. */
267
268 This->fn_get_required_source_rect(This, dest_rect.X, dest_rect.Y, &src_rect_ul);
269 This->fn_get_required_source_rect(This, dest_rect.X+dest_rect.Width-1,
270 dest_rect.Y+dest_rect.Height-1, &src_rect_br);
271
272 src_rect.X = src_rect_ul.X;
273 src_rect.Y = src_rect_ul.Y;
274 src_rect.Width = src_rect_br.Width + src_rect_br.X - src_rect_ul.X;
275 src_rect.Height = src_rect_br.Height + src_rect_br.Y - src_rect_ul.Y;
276
277 src_bytesperrow = (src_rect.Width * This->bpp + 7)/8;
278 buffer_size = src_bytesperrow * src_rect.Height;
279
280 src_rows = malloc(sizeof(BYTE*) * src_rect.Height);
281 src_bits = malloc(buffer_size);
282
283 if (!src_rows || !src_bits)
284 {
285 free(src_rows);
286 free(src_bits);
288 goto end;
289 }
290
291 for (y=0; y<src_rect.Height; y++)
292 src_rows[y] = src_bits + y * src_bytesperrow;
293
294 hr = IWICBitmapSource_CopyPixels(This->source, &src_rect, src_bytesperrow,
295 buffer_size, src_bits);
296
297 if (SUCCEEDED(hr))
298 {
299 for (y=0; y < dest_rect.Height; y++)
300 {
301 This->fn_copy_scanline(This, dest_rect.X, dest_rect.Y+y, dest_rect.Width,
302 src_rows, src_rect.X, src_rect.Y, pbBuffer + cbStride * y);
303 }
304 }
305
306 free(src_rows);
307 free(src_bits);
308
309end:
311
312 return hr;
313}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
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
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
INT Height
Definition: wincodec.idl:335
INT Width
Definition: wincodec.idl:334
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 513 of file scaler.c.

514{
516
517 This = malloc(sizeof(BitmapScaler));
518 if (!This) return E_OUTOFMEMORY;
519
520 This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl;
521 This->IMILBitmapScaler_iface.lpVtbl = &IMILBitmapScaler_Vtbl;
522 This->ref = 1;
523 This->source = NULL;
524 This->width = 0;
525 This->height = 0;
526 This->src_width = 0;
527 This->src_height = 0;
528 This->mode = 0;
529 This->bpp = 0;
530#ifdef __REACTOS__
532#else
534#endif
535 This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BitmapScaler.lock");
536
537 *scaler = &This->IWICBitmapScaler_iface;
538
539 return S_OK;
540}
#define NULL
Definition: types.h:112
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
Definition: sync.c:107
#define S_OK
Definition: intsafe.h:52
static const IWICBitmapScalerVtbl BitmapScaler_Vtbl
Definition: scaler.c:381
static const IMILBitmapScalerVtbl IMILBitmapScaler_Vtbl
Definition: scaler.c:500
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1118

Referenced by ImagingFactory_CreateBitmapScaler().

◆ BitmapScaler_GetPixelFormat()

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

Definition at line 133 of file scaler.c.

135{
137 TRACE("(%p,%p)\n", iface, pPixelFormat);
138
139 if (!pPixelFormat)
140 return E_INVALIDARG;
141
142 if (!This->source)
143 {
144 memcpy(pPixelFormat, &GUID_WICPixelFormatDontCare, sizeof(*pPixelFormat));
145 return S_OK;
146 }
147
148 return IWICBitmapSource_GetPixelFormat(This->source, pPixelFormat);
149}
#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 151 of file scaler.c.

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

◆ BitmapScaler_GetSize()

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

Definition at line 115 of file scaler.c.

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

◆ BitmapScaler_Initialize()

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

Definition at line 315 of file scaler.c.

318{
320 HRESULT hr;
321 GUID src_pixelformat;
322
323 TRACE("(%p,%p,%u,%u,%u)\n", iface, pISource, uiWidth, uiHeight, mode);
324
325 if (!pISource || !uiWidth || !uiHeight)
326 return E_INVALIDARG;
327
329
330 if (This->source)
331 {
333 goto end;
334 }
335
336 This->width = uiWidth;
337 This->height = uiHeight;
338 This->mode = mode;
339
340 hr = IWICBitmapSource_GetSize(pISource, &This->src_width, &This->src_height);
341
342 if (SUCCEEDED(hr))
343 hr = IWICBitmapSource_GetPixelFormat(pISource, &src_pixelformat);
344
345 if (SUCCEEDED(hr))
346 {
347 hr = get_pixelformat_bpp(&src_pixelformat, &This->bpp);
348 }
349
350 if (SUCCEEDED(hr))
351 {
352 switch (mode)
353 {
354 default:
355 FIXME("unsupported mode %i\n", mode);
356 /* fall-through */
358 if ((This->bpp % 8) == 0)
359 {
360 IWICBitmapSource_AddRef(pISource);
361 This->source = pISource;
362 }
363 else
364 {
365 hr = WICConvertBitmapSource(&GUID_WICPixelFormat32bppBGRA,
366 pISource, &This->source);
367 This->bpp = 32;
368 }
369 This->fn_get_required_source_rect = NearestNeighbor_GetRequiredSourceRect;
370 This->fn_copy_scanline = NearestNeighbor_CopyScanline;
371 break;
372 }
373 }
374
375end:
377
378 return hr;
379}
#define FIXME(fmt,...)
Definition: precomp.h:53
HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst)
Definition: info.c:2437
HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
Definition: main.c:62
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:189
static void NearestNeighbor_GetRequiredSourceRect(BitmapScaler *This, UINT x, UINT y, WICRect *src_rect)
Definition: scaler.c:181
@ WICBitmapInterpolationModeNearestNeighbor
Definition: wincodec.idl:78
#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 58 of file scaler.c.

60{
62 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
63
64 if (!ppv) return E_INVALIDARG;
65
66 if (IsEqualIID(&IID_IUnknown, iid) ||
67 IsEqualIID(&IID_IWICBitmapSource, iid) ||
68 IsEqualIID(&IID_IWICBitmapScaler, iid))
69 {
70 *ppv = &This->IWICBitmapScaler_iface;
71 }
72 else if (IsEqualIID(&IID_IMILBitmapScaler, iid))
73 {
74 *ppv = &This->IMILBitmapScaler_iface;
75 }
76 else
77 {
78 FIXME("unknown interface %s\n", debugstr_guid(iid));
79 *ppv = NULL;
80 return E_NOINTERFACE;
81 }
82
83 IUnknown_AddRef((IUnknown*)*ppv);
84 return S_OK;
85}
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
IID IID_IMILBitmapScaler
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ BitmapScaler_Release()

static ULONG WINAPI BitmapScaler_Release ( IWICBitmapScaler iface)
static

Definition at line 97 of file scaler.c.

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

◆ IMILBitmapScaler_AddRef()

static ULONG WINAPI IMILBitmapScaler_AddRef ( IMILBitmapScaler *  iface)
static

Definition at line 401 of file scaler.c.

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

◆ IMILBitmapScaler_CopyPalette()

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

Definition at line 452 of file scaler.c.

454{
456
457 TRACE("(%p,%p)\n", iface, palette);
458
459 if (!This->source)
461
462 return IWICBitmapScaler_CopyPalette(&This->IWICBitmapScaler_iface, palette);
463}
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 465 of file scaler.c.

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

◆ IMILBitmapScaler_GetPixelFormat()

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

Definition at line 421 of file scaler.c.

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

◆ IMILBitmapScaler_GetResolution()

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

Definition at line 444 of file scaler.c.

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

◆ IMILBitmapScaler_GetSize()

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

Definition at line 413 of file scaler.c.

415{
417 TRACE("(%p,%p,%p)\n", iface, width, height);
418 return IWICBitmapScaler_GetSize(&This->IWICBitmapScaler_iface, width, height);
419}
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 479 of file scaler.c.

482{
484 IWICBitmapSource *wic_source;
485 HRESULT hr;
486
487 TRACE("(%p,%p,%u,%u,%u)\n", iface, mil_source, width, height, mode);
488
489 if (!mil_source) return E_INVALIDARG;
490
491 hr = mil_source->lpVtbl->QueryInterface(mil_source, &IID_IWICBitmapSource, (void **)&wic_source);
492 if (hr == S_OK)
493 {
494 hr = IWICBitmapScaler_Initialize(&This->IWICBitmapScaler_iface, wic_source, width, height, mode);
495 IWICBitmapSource_Release(wic_source);
496 }
497 return hr;
498}
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 393 of file scaler.c.

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

◆ IMILBitmapScaler_Release()

static ULONG WINAPI IMILBitmapScaler_Release ( IMILBitmapScaler *  iface)
static

Definition at line 407 of file scaler.c.

408{
410 return IWICBitmapScaler_Release(&This->IWICBitmapScaler_iface);
411}

◆ IMILBitmapScaler_unknown1()

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

Definition at line 473 of file scaler.c.

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

◆ 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 189 of file scaler.c.

192{
193 UINT i;
194 UINT bytesperpixel = This->bpp/8;
195 UINT src_x, src_y;
196
197 src_y = dst_y * This->src_height / This->height - src_data_y;
198
199 for (i=0; i<dst_width; i++)
200 {
201 src_x = (dst_x + i) * This->src_width / This->width - src_data_x;
202 memcpy(pbBuffer + bytesperpixel * i, src_data[src_y] + bytesperpixel * src_x, bytesperpixel);
203 }
204}
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 181 of file scaler.c.

183{
184 src_rect->X = x * This->src_width / This->width;
185 src_rect->Y = y * This->src_height / This->height;
186 src_rect->Width = src_rect->Height = 1;
187}
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:133
static ULONG WINAPI BitmapScaler_Release(IWICBitmapScaler *iface)
Definition: scaler.c:97
static HRESULT WINAPI BitmapScaler_QueryInterface(IWICBitmapScaler *iface, REFIID iid, void **ppv)
Definition: scaler.c:58
static HRESULT WINAPI BitmapScaler_CopyPalette(IWICBitmapScaler *iface, IWICPalette *pIPalette)
Definition: scaler.c:166
static ULONG WINAPI BitmapScaler_AddRef(IWICBitmapScaler *iface)
Definition: scaler.c:87
static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
Definition: scaler.c:206
static HRESULT WINAPI BitmapScaler_Initialize(IWICBitmapScaler *iface, IWICBitmapSource *pISource, UINT uiWidth, UINT uiHeight, WICBitmapInterpolationMode mode)
Definition: scaler.c:315
static HRESULT WINAPI BitmapScaler_GetSize(IWICBitmapScaler *iface, UINT *puiWidth, UINT *puiHeight)
Definition: scaler.c:115
static HRESULT WINAPI BitmapScaler_GetResolution(IWICBitmapScaler *iface, double *pDpiX, double *pDpiY)
Definition: scaler.c:151

Definition at line 381 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:401
static HRESULT WINAPI IMILBitmapScaler_GetPixelFormat(IMILBitmapScaler *iface, int *format)
Definition: scaler.c:421
static ULONG WINAPI IMILBitmapScaler_Release(IMILBitmapScaler *iface)
Definition: scaler.c:407
static HRESULT WINAPI IMILBitmapScaler_CopyPixels(IMILBitmapScaler *iface, const WICRect *rc, UINT stride, UINT size, BYTE *buffer)
Definition: scaler.c:465
static HRESULT WINAPI IMILBitmapScaler_unknown1(IMILBitmapScaler *iface, void **ppv)
Definition: scaler.c:473
static HRESULT WINAPI IMILBitmapScaler_CopyPalette(IMILBitmapScaler *iface, IWICPalette *palette)
Definition: scaler.c:452
static HRESULT WINAPI IMILBitmapScaler_QueryInterface(IMILBitmapScaler *iface, REFIID iid, void **ppv)
Definition: scaler.c:393
static HRESULT WINAPI IMILBitmapScaler_Initialize(IMILBitmapScaler *iface, IMILBitmapSource *mil_source, UINT width, UINT height, WICBitmapInterpolationMode mode)
Definition: scaler.c:479
static HRESULT WINAPI IMILBitmapScaler_GetResolution(IMILBitmapScaler *iface, double *dpix, double *dpiy)
Definition: scaler.c:444
static HRESULT WINAPI IMILBitmapScaler_GetSize(IMILBitmapScaler *iface, UINT *width, UINT *height)
Definition: scaler.c:413

Definition at line 500 of file scaler.c.

Referenced by BitmapScaler_Create().