mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
enhance: do NOT use render target when there's only added or delete image.
This commit is contained in:
parent
dde5d4a2a8
commit
4e8e39d2fe
1 changed files with 20 additions and 27 deletions
|
@ -244,17 +244,13 @@ namespace SourceGit.Views
|
|||
var right = NewImage;
|
||||
var drawLeft = left != null && alpha < 1.0;
|
||||
var drawRight = right != null && alpha > 0;
|
||||
var psize = left == null ? right.PixelSize : left.PixelSize;
|
||||
var dpi = left == null ? right.Dpi : left.Dpi;
|
||||
|
||||
using (var rt = new RenderTargetBitmap(psize, dpi))
|
||||
if (drawLeft && drawRight)
|
||||
{
|
||||
using (var rt = new RenderTargetBitmap(right.PixelSize, right.Dpi))
|
||||
{
|
||||
var rtRect = new Rect(rt.Size);
|
||||
using (var dc = rt.CreateDrawingContext())
|
||||
{
|
||||
if (drawLeft)
|
||||
{
|
||||
if (drawRight)
|
||||
{
|
||||
using (dc.PushRenderOptions(RO_SRC))
|
||||
using (dc.PushOpacity(1 - alpha))
|
||||
|
@ -264,22 +260,19 @@ namespace SourceGit.Views
|
|||
using (dc.PushOpacity(alpha))
|
||||
dc.DrawImage(right, rtRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
using (dc.PushRenderOptions(RO_SRC))
|
||||
using (dc.PushOpacity(1 - alpha))
|
||||
dc.DrawImage(left, rtRect);
|
||||
|
||||
context.DrawImage(rt, rtRect, rect);
|
||||
}
|
||||
}
|
||||
else if (drawLeft)
|
||||
{
|
||||
using (context.PushOpacity(1 - alpha))
|
||||
context.DrawImage(left, rect);
|
||||
}
|
||||
else if (drawRight)
|
||||
{
|
||||
using (dc.PushRenderOptions(RO_SRC))
|
||||
using (dc.PushOpacity(alpha))
|
||||
dc.DrawImage(right, rtRect);
|
||||
}
|
||||
}
|
||||
|
||||
context.DrawImage(rt, rtRect, rect);
|
||||
using (context.PushOpacity(alpha))
|
||||
context.DrawImage(right, rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue