d2d1: Take the bitmap's alpha mode into account in bitmap brushes.
This commit is contained in:
parent
d742887b7f
commit
c4503779bb
|
@ -728,8 +728,9 @@ HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_d3d_render_targe
|
|||
struct
|
||||
{
|
||||
float _11, _21, _31, pad0;
|
||||
float _12, _22, _32, pad1;
|
||||
} transform;
|
||||
float _12, _22, _32, opacity;
|
||||
BOOL ignore_alpha;
|
||||
} bitmap_brush_cb;
|
||||
D2D1_COLOR_F color;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -783,17 +784,18 @@ HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_d3d_render_targe
|
|||
d = b._11 * b._22 - b._21 * b._12;
|
||||
if (d != 0.0f)
|
||||
{
|
||||
transform._11 = b._22 / d;
|
||||
transform._21 = -b._21 / d;
|
||||
transform._31 = (b._21 * b._32 - b._31 * b._22) / d;
|
||||
transform._12 = -b._12 / d;
|
||||
transform._22 = b._11 / d;
|
||||
transform._32 = -(b._11 * b._32 - b._31 * b._12) / d;
|
||||
bitmap_brush_cb._11 = b._22 / d;
|
||||
bitmap_brush_cb._21 = -b._21 / d;
|
||||
bitmap_brush_cb._31 = (b._21 * b._32 - b._31 * b._22) / d;
|
||||
bitmap_brush_cb._12 = -b._12 / d;
|
||||
bitmap_brush_cb._22 = b._11 / d;
|
||||
bitmap_brush_cb._32 = -(b._11 * b._32 - b._31 * b._12) / d;
|
||||
}
|
||||
transform.pad1 = brush->opacity;
|
||||
bitmap_brush_cb.opacity = brush->opacity;
|
||||
bitmap_brush_cb.ignore_alpha = bitmap->format.alphaMode == D2D1_ALPHA_MODE_IGNORE;
|
||||
|
||||
buffer_desc.ByteWidth = sizeof(transform);
|
||||
buffer_data.pSysMem = &transform;
|
||||
buffer_desc.ByteWidth = sizeof(bitmap_brush_cb);
|
||||
buffer_data.pSysMem = &bitmap_brush_cb;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1564,6 +1564,7 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target,
|
|||
#if 0
|
||||
float3x2 transform;
|
||||
float opacity;
|
||||
bool ignore_alpha;
|
||||
|
||||
SamplerState s;
|
||||
Texture2D t;
|
||||
|
@ -1576,26 +1577,30 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target,
|
|||
texcoord.x = position.x * transform._11 + position.y * transform._21 + transform._31;
|
||||
texcoord.y = position.x * transform._12 + position.y * transform._22 + transform._32;
|
||||
ret = t.Sample(s, texcoord);
|
||||
if (ignore_alpha)
|
||||
ret.a = opacity;
|
||||
else
|
||||
ret.a *= opacity;
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
0x43425844, 0x9a5f9280, 0xa5351c23, 0x15d6e760, 0xce35bcc3, 0x00000001, 0x000001d0, 0x00000003,
|
||||
0x43425844, 0xf2e9967c, 0xad1d1ac2, 0x865274b8, 0x6ab4c5ca, 0x00000001, 0x000001fc, 0x00000003,
|
||||
0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
|
||||
0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000030f, 0x505f5653, 0x5449534f, 0x004e4f49,
|
||||
0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
|
||||
0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000134, 0x00000040,
|
||||
0x0000004d, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0300005a, 0x00106000, 0x00000000,
|
||||
0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000160, 0x00000040,
|
||||
0x00000058, 0x04000059, 0x00208e46, 0x00000000, 0x00000003, 0x0300005a, 0x00106000, 0x00000000,
|
||||
0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04002064, 0x00101032, 0x00000000, 0x00000001,
|
||||
0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x0800000f, 0x00100012, 0x00000000,
|
||||
0x00101046, 0x00000000, 0x00208046, 0x00000000, 0x00000000, 0x08000000, 0x00100012, 0x00000000,
|
||||
0x0010000a, 0x00000000, 0x0020802a, 0x00000000, 0x00000000, 0x0800000f, 0x00100042, 0x00000000,
|
||||
0x00101046, 0x00000000, 0x00208046, 0x00000000, 0x00000001, 0x08000000, 0x00100022, 0x00000000,
|
||||
0x0010002a, 0x00000000, 0x0020802a, 0x00000000, 0x00000001, 0x09000045, 0x001000f2, 0x00000000,
|
||||
0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x00102082,
|
||||
0x00100046, 0x00000000, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x08000038, 0x00100082,
|
||||
0x00000000, 0x0010003a, 0x00000000, 0x0020803a, 0x00000000, 0x00000001, 0x05000036, 0x00102072,
|
||||
0x00000000, 0x00100246, 0x00000000, 0x0100003e,
|
||||
0x00000000, 0x00100246, 0x00000000, 0x0b000037, 0x00102082, 0x00000000, 0x0020800a, 0x00000000,
|
||||
0x00000002, 0x0020803a, 0x00000000, 0x00000001, 0x0010003a, 0x00000000, 0x0100003e,
|
||||
};
|
||||
/* The basic idea here is to evaluate the implicit form of the curve in
|
||||
* texture space. "t.z" determines which side of the curve is shaded. */
|
||||
|
|
Loading…
Reference in New Issue