Move raytracePending reset into MeshContentProvider result assignment

This commit is contained in:
John Lewin 2018-06-20 22:32:15 -07:00
parent 0e574131a9
commit a71ced7dcd
2 changed files with 10 additions and 12 deletions

View file

@ -262,7 +262,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
container.AddChild(text);
}
this.SetItemThumbnail(loadingImage, raytracedImage: false);
this.SetItemThumbnail(loadingImage);
}
public override string ToolTipText

View file

@ -75,7 +75,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
var thumbnail = MeshContentProvider.LoadCachedImage(thumbnailId, thumbWidth, thumbHeight);
if (thumbnail != null)
{
this.SetItemThumbnail(thumbnail, raytracedImage: false);
this.SetItemThumbnail(thumbnail);
return;
}
@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
else
{
// Show processing image
this.SetItemThumbnail(generatingThumbnailIcon, raytracedImage: false);
this.SetItemThumbnail(generatingThumbnailIcon);
// Ask the provider for a content specific thumbnail
thumbnail = await contentProvider.GetThumbnail(libraryItem, thumbWidth, thumbHeight);
@ -125,7 +125,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
thumbnail = ((libraryItem is ILibraryContainerLink) ? defaultFolderIcon : defaultItemIcon).AlphaToPrimaryAccent();
}
this.SetItemThumbnail(thumbnail, raytracedImage: false);
this.SetItemThumbnail(thumbnail);
}
private void ScheduleRaytraceOperation()
@ -151,13 +151,16 @@ namespace MatterHackers.MatterControl.CustomWidgets
requeueRaytraceOnDraw = false;
// Show processing image
this.SetItemThumbnail(generatingThumbnailIcon, raytracedImage: false);
this.SetItemThumbnail(generatingThumbnailIcon);
// Ask the MeshContentProvider to RayTrace the image
var thumbnail = await meshContentProvider.GetThumbnail(listViewItem.Model, thumbWidth, thumbHeight);
if (thumbnail != null)
{
this.SetItemThumbnail(thumbnail, raytracedImage: true);
requeueRaytraceOnDraw = false;
raytracePending = false;
this.SetItemThumbnail(thumbnail);
}
}
});
@ -215,7 +218,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
public event EventHandler ImageSet;
protected void SetItemThumbnail(ImageBuffer thumbnail, bool raytracedImage)
protected void SetItemThumbnail(ImageBuffer thumbnail)
{
if (thumbnail != null)
{
@ -229,11 +232,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
thumbnail = LibraryProviderHelpers.ResizeImage(thumbnail, thumbWidth, thumbHeight);
}
if (raytracedImage)
{
this.raytracePending = false;
}
if (GuiWidget.DeviceScale != 1)
{
thumbnail = thumbnail.CreateScaledImage(GuiWidget.DeviceScale);