2 * Copyright 2014 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/port.h"
22 #include "d2d1_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(d2d
);
26 static inline struct d2d_bitmap
*impl_from_ID2D1Bitmap(ID2D1Bitmap
*iface
)
28 return CONTAINING_RECORD(iface
, struct d2d_bitmap
, ID2D1Bitmap_iface
);
31 static HRESULT STDMETHODCALLTYPE
d2d_bitmap_QueryInterface(ID2D1Bitmap
*iface
, REFIID iid
, void **out
)
33 TRACE("iface %p, iid %s, out %p.\n", iface
, debugstr_guid(iid
), out
);
35 if (IsEqualGUID(iid
, &IID_ID2D1Bitmap
)
36 || IsEqualGUID(iid
, &IID_ID2D1Resource
)
37 || IsEqualGUID(iid
, &IID_IUnknown
))
39 ID2D1Bitmap_AddRef(iface
);
44 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
50 static ULONG STDMETHODCALLTYPE
d2d_bitmap_AddRef(ID2D1Bitmap
*iface
)
52 struct d2d_bitmap
*bitmap
= impl_from_ID2D1Bitmap(iface
);
53 ULONG refcount
= InterlockedIncrement(&bitmap
->refcount
);
55 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
60 static ULONG STDMETHODCALLTYPE
d2d_bitmap_Release(ID2D1Bitmap
*iface
)
62 struct d2d_bitmap
*bitmap
= impl_from_ID2D1Bitmap(iface
);
63 ULONG refcount
= InterlockedDecrement(&bitmap
->refcount
);
65 TRACE("%p increasing refcount to %u.\n", iface
, refcount
);
68 HeapFree(GetProcessHeap(), 0, bitmap
);
73 static void STDMETHODCALLTYPE
d2d_bitmap_GetFactory(ID2D1Bitmap
*iface
, ID2D1Factory
**factory
)
75 FIXME("iface %p, factory %p stub!\n", iface
, factory
);
80 static D2D1_SIZE_F
* STDMETHODCALLTYPE
d2d_bitmap_GetSize(ID2D1Bitmap
*iface
, D2D1_SIZE_F
*size
)
82 FIXME("iface %p, size %p stub!\n", iface
, size
);
89 static D2D1_SIZE_U
* STDMETHODCALLTYPE
d2d_bitmap_GetPixelSize(ID2D1Bitmap
*iface
, D2D1_SIZE_U
*pixel_size
)
91 FIXME("iface %p, pixel_size %p stub!\n", iface
, pixel_size
);
93 pixel_size
->width
= 0;
94 pixel_size
->height
= 0;
98 static D2D1_PIXEL_FORMAT
* STDMETHODCALLTYPE
d2d_bitmap_GetPixelFormat(ID2D1Bitmap
*iface
, D2D1_PIXEL_FORMAT
*format
)
100 FIXME("iface %p stub!\n", iface
);
102 format
->format
= DXGI_FORMAT_UNKNOWN
;
103 format
->alphaMode
= D2D1_ALPHA_MODE_UNKNOWN
;
107 static void STDMETHODCALLTYPE
d2d_bitmap_GetDpi(ID2D1Bitmap
*iface
, float *dpi_x
, float *dpi_y
)
109 FIXME("iface %p, dpi_x %p, dpi_y %p stub!\n", iface
, dpi_x
, dpi_y
);
115 static HRESULT STDMETHODCALLTYPE
d2d_bitmap_CopyFromBitmap(ID2D1Bitmap
*iface
,
116 const D2D1_POINT_2U
*dst_point
, ID2D1Bitmap
*bitmap
, const D2D1_RECT_U
*src_rect
)
118 FIXME("iface %p, dst_point %p, bitmap %p, src_rect %p stub!\n", iface
, dst_point
, bitmap
, src_rect
);
123 static HRESULT STDMETHODCALLTYPE
d2d_bitmap_CopyFromRenderTarget(ID2D1Bitmap
*iface
,
124 const D2D1_POINT_2U
*dst_point
, ID2D1RenderTarget
*render_target
, const D2D1_RECT_U
*src_rect
)
126 FIXME("iface %p, dst_point %p, render_target %p, src_rect %p stub!\n", iface
, dst_point
, render_target
, src_rect
);
131 static HRESULT STDMETHODCALLTYPE
d2d_bitmap_CopyFromMemory(ID2D1Bitmap
*iface
,
132 const D2D1_RECT_U
*dst_rect
, const void *src_data
, UINT32 pitch
)
134 FIXME("iface %p, dst_rect %p, src_data %p, pitch %u stub!\n", iface
, dst_rect
, src_data
, pitch
);
139 static const struct ID2D1BitmapVtbl d2d_bitmap_vtbl
=
141 d2d_bitmap_QueryInterface
,
144 d2d_bitmap_GetFactory
,
146 d2d_bitmap_GetPixelSize
,
147 d2d_bitmap_GetPixelFormat
,
149 d2d_bitmap_CopyFromBitmap
,
150 d2d_bitmap_CopyFromRenderTarget
,
151 d2d_bitmap_CopyFromMemory
,
154 void d2d_bitmap_init(struct d2d_bitmap
*bitmap
, D2D1_SIZE_U size
, const void *src_data
,
155 UINT32 pitch
, const D2D1_BITMAP_PROPERTIES
*desc
)
157 FIXME("Ignoring bitmap properties.\n");
159 bitmap
->ID2D1Bitmap_iface
.lpVtbl
= &d2d_bitmap_vtbl
;
160 bitmap
->refcount
= 1;