d2d1: Also bind the pixel shader and blend state in d2d_brush_bind_resources().
[wine.git] / dlls / d2d1 / d2d1_private.h
blob91ebd9fbe2a21596567381a88fb251de76f11bf2
1 /*
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
19 #ifndef __WINE_D2D1_PRIVATE_H
20 #define __WINE_D2D1_PRIVATE_H
22 #include "wine/debug.h"
24 #include <assert.h>
25 #include <limits.h>
26 #define COBJMACROS
27 #include "d2d1.h"
28 #ifdef D2D1_INIT_GUID
29 #include "initguid.h"
30 #endif
31 #include "dwrite.h"
33 enum d2d_brush_type
35 D2D_BRUSH_TYPE_SOLID,
36 D2D_BRUSH_TYPE_LINEAR,
37 D2D_BRUSH_TYPE_BITMAP,
40 struct d2d_clip_stack
42 D2D1_RECT_F *stack;
43 unsigned int size;
44 unsigned int count;
47 struct d2d_d3d_render_target
49 ID2D1RenderTarget ID2D1RenderTarget_iface;
50 IDWriteTextRenderer IDWriteTextRenderer_iface;
51 LONG refcount;
53 ID2D1Factory *factory;
54 ID3D10Device *device;
55 ID3D10RenderTargetView *view;
56 ID3D10StateBlock *stateblock;
57 ID3D10InputLayout *il;
58 unsigned int vb_stride;
59 ID3D10Buffer *vb;
60 ID3D10VertexShader *vs;
61 ID3D10RasterizerState *rs;
62 ID3D10BlendState *bs;
64 ID3D10PixelShader *rect_solid_ps;
65 ID3D10PixelShader *rect_bitmap_ps;
67 D2D1_DRAWING_STATE_DESCRIPTION drawing_state;
68 IDWriteRenderingParams *text_rendering_params;
70 D2D1_SIZE_U pixel_size;
71 struct d2d_clip_stack clip_stack;
72 float dpi_x;
73 float dpi_y;
76 HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, ID2D1Factory *factory,
77 IDXGISurface *surface, const D2D1_RENDER_TARGET_PROPERTIES *desc) DECLSPEC_HIDDEN;
79 struct d2d_wic_render_target
81 ID2D1RenderTarget ID2D1RenderTarget_iface;
82 LONG refcount;
84 IDXGISurface *dxgi_surface;
85 ID2D1RenderTarget *dxgi_target;
86 ID3D10Texture2D *readback_texture;
87 IWICBitmap *bitmap;
89 unsigned int width;
90 unsigned int height;
91 unsigned int bpp;
94 HRESULT d2d_wic_render_target_init(struct d2d_wic_render_target *render_target, ID2D1Factory *factory,
95 IWICBitmap *bitmap, const D2D1_RENDER_TARGET_PROPERTIES *desc) DECLSPEC_HIDDEN;
97 struct d2d_gradient
99 ID2D1GradientStopCollection ID2D1GradientStopCollection_iface;
100 LONG refcount;
102 D2D1_GRADIENT_STOP *stops;
103 UINT32 stop_count;
106 HRESULT d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_target,
107 const D2D1_GRADIENT_STOP *stops, UINT32 stop_count, D2D1_GAMMA gamma,
108 D2D1_EXTEND_MODE extend_mode) DECLSPEC_HIDDEN;
110 struct d2d_brush
112 ID2D1Brush ID2D1Brush_iface;
113 LONG refcount;
115 float opacity;
116 D2D1_MATRIX_3X2_F transform;
118 enum d2d_brush_type type;
119 union
121 struct
123 D2D1_COLOR_F color;
124 } solid;
125 struct
127 struct d2d_bitmap *bitmap;
128 D2D1_EXTEND_MODE extend_mode_x;
129 D2D1_EXTEND_MODE extend_mode_y;
130 D2D1_BITMAP_INTERPOLATION_MODE interpolation_mode;
131 ID3D10SamplerState *sampler_state;
132 } bitmap;
133 } u;
136 void d2d_solid_color_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_target,
137 const D2D1_COLOR_F *color, const D2D1_BRUSH_PROPERTIES *desc) DECLSPEC_HIDDEN;
138 void d2d_linear_gradient_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_target,
139 const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc,
140 ID2D1GradientStopCollection *gradient) DECLSPEC_HIDDEN;
141 HRESULT d2d_bitmap_brush_init(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target,
142 ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmap_brush_desc,
143 const D2D1_BRUSH_PROPERTIES *brush_desc) DECLSPEC_HIDDEN;
144 void d2d_brush_bind_resources(struct d2d_brush *brush, struct d2d_d3d_render_target *render_target) DECLSPEC_HIDDEN;
145 struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface) DECLSPEC_HIDDEN;
147 struct d2d_stroke_style
149 ID2D1StrokeStyle ID2D1StrokeStyle_iface;
150 LONG refcount;
153 void d2d_stroke_style_init(struct d2d_stroke_style *style, ID2D1Factory *factory,
154 const D2D1_STROKE_STYLE_PROPERTIES *desc, const float *dashes, UINT32 dash_count) DECLSPEC_HIDDEN;
156 struct d2d_mesh
158 ID2D1Mesh ID2D1Mesh_iface;
159 LONG refcount;
162 void d2d_mesh_init(struct d2d_mesh *mesh) DECLSPEC_HIDDEN;
164 struct d2d_bitmap
166 ID2D1Bitmap ID2D1Bitmap_iface;
167 LONG refcount;
169 ID3D10ShaderResourceView *view;
170 D2D1_SIZE_U pixel_size;
171 float dpi_x;
172 float dpi_y;
175 HRESULT d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_d3d_render_target *render_target,
176 D2D1_SIZE_U size, const void *src_data, UINT32 pitch, const D2D1_BITMAP_PROPERTIES *desc) DECLSPEC_HIDDEN;
177 struct d2d_bitmap *unsafe_impl_from_ID2D1Bitmap(ID2D1Bitmap *iface) DECLSPEC_HIDDEN;
179 struct d2d_state_block
181 ID2D1DrawingStateBlock ID2D1DrawingStateBlock_iface;
182 LONG refcount;
184 D2D1_DRAWING_STATE_DESCRIPTION drawing_state;
185 IDWriteRenderingParams *text_rendering_params;
188 void d2d_state_block_init(struct d2d_state_block *state_block, const D2D1_DRAWING_STATE_DESCRIPTION *desc,
189 IDWriteRenderingParams *text_rendering_params) DECLSPEC_HIDDEN;
190 struct d2d_state_block *unsafe_impl_from_ID2D1DrawingStateBlock(ID2D1DrawingStateBlock *iface) DECLSPEC_HIDDEN;
192 enum d2d_geometry_state
194 D2D_GEOMETRY_STATE_INITIAL = 0,
195 D2D_GEOMETRY_STATE_ERROR,
196 D2D_GEOMETRY_STATE_OPEN,
197 D2D_GEOMETRY_STATE_CLOSED,
198 D2D_GEOMETRY_STATE_FIGURE,
201 struct d2d_face
203 UINT16 v[3];
206 struct d2d_geometry
208 ID2D1Geometry ID2D1Geometry_iface;
209 LONG refcount;
211 D2D1_POINT_2F *vertices;
212 size_t vertex_count;
214 struct d2d_face *faces;
215 size_t face_count;
217 union
219 struct
221 ID2D1GeometrySink ID2D1GeometrySink_iface;
223 enum d2d_geometry_state state;
224 UINT32 figure_count, segment_count;
225 } path;
226 struct
228 D2D1_RECT_F rect;
229 } rectangle;
230 } u;
233 void d2d_path_geometry_init(struct d2d_geometry *geometry) DECLSPEC_HIDDEN;
234 HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, const D2D1_RECT_F *rect) DECLSPEC_HIDDEN;
236 #endif /* __WINE_D2D1_PRIVATE_H */