mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 14:23:40 +01:00
Texture handle shim
This commit is contained in:
parent
6858c646a2
commit
dc83879c89
25 changed files with 68 additions and 63 deletions
|
|
@ -414,7 +414,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
|
|||
false,
|
||||
false,
|
||||
$"Font#{textureIndex}");
|
||||
io.Fonts.SetTexID(textureIndex, tex.ImGuiHandle);
|
||||
io.Fonts.SetTexID(textureIndex, tex.Handle);
|
||||
this.fontTextures.Add(tex);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public static class NotificationUtilities
|
|||
return false;
|
||||
try
|
||||
{
|
||||
var handle = texture.ImGuiHandle;
|
||||
var handle = texture.Handle;
|
||||
var size = texture.Size;
|
||||
if (size.X > maxCoord.X - minCoord.X)
|
||||
size *= (maxCoord.X - minCoord.X) / size.X;
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
|
|||
ImGui.SetCursorPos(new Vector2(logoContainerSize.X / 2 - logoSize.X / 2, logoContainerSize.Y / 2 - logoSize.Y / 2));
|
||||
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(this.windowFade.EasedPoint.X - 0.5f, 0f, 1f)))
|
||||
ImGui.Image(this.logoTexture.Value.ImGuiHandle, logoSize);
|
||||
ImGui.Image(this.logoTexture.Value.Handle, logoSize);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
|
@ -380,7 +380,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
|
|||
|
||||
ImGuiHelpers.CenterCursorFor(this.apiBumpExplainerTexture.Value.Width);
|
||||
ImGui.Image(
|
||||
this.apiBumpExplainerTexture.Value.ImGuiHandle,
|
||||
this.apiBumpExplainerTexture.Value.Handle,
|
||||
this.apiBumpExplainerTexture.Value.Size);
|
||||
|
||||
if (!this.currentFtueLevels.TryGetValue(FtueLevels.AutoUpdate.Name, out var autoUpdateLevel) || autoUpdateLevel < FtueLevels.AutoUpdate.AutoUpdateInitial)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ internal class FateTableWidget : IDataWindowWidget
|
|||
{
|
||||
if (textureManager.Shared.GetFromGameIcon(fate.IconId).TryGetWrap(out var texture, out _))
|
||||
{
|
||||
ImGui.Image(texture.ImGuiHandle, new(ImGui.GetTextLineHeight()));
|
||||
ImGui.Image(texture.Handle, new(ImGui.GetTextLineHeight()));
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
|
|
@ -101,7 +101,7 @@ internal class FateTableWidget : IDataWindowWidget
|
|||
ImGui.BeginTooltip();
|
||||
ImGui.TextUnformatted("Click to copy IconId");
|
||||
ImGui.TextUnformatted($"ID: {fate.IconId} – Size: {texture.Width}x{texture.Height}");
|
||||
ImGui.Image(texture.ImGuiHandle, new(texture.Width, texture.Height));
|
||||
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ internal class FateTableWidget : IDataWindowWidget
|
|||
{
|
||||
if (textureManager.Shared.GetFromGameIcon(fate.MapIconId).TryGetWrap(out var texture, out _))
|
||||
{
|
||||
ImGui.Image(texture.ImGuiHandle, new(ImGui.GetTextLineHeight()));
|
||||
ImGui.Image(texture.Handle, new(ImGui.GetTextLineHeight()));
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
|
|
@ -126,7 +126,7 @@ internal class FateTableWidget : IDataWindowWidget
|
|||
ImGui.BeginTooltip();
|
||||
ImGui.TextUnformatted("Click to copy MapIconId");
|
||||
ImGui.TextUnformatted($"ID: {fate.MapIconId} – Size: {texture.Width}x{texture.Height}");
|
||||
ImGui.Image(texture.ImGuiHandle, new(texture.Width, texture.Height));
|
||||
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ public class IconBrowserWidget : IDataWindowWidget
|
|||
|
||||
if (texm.Shared.GetFromGameIcon(iconId).TryGetWrap(out var texture, out var exc))
|
||||
{
|
||||
ImGui.Image(texture.ImGuiHandle, this.iconSize);
|
||||
ImGui.Image(texture.Handle, this.iconSize);
|
||||
|
||||
// If we have the option to show a tooltip image, draw the image, but make sure it's not too big.
|
||||
if (ImGui.IsItemHovered() && this.showTooltipImage)
|
||||
|
|
@ -167,7 +167,7 @@ public class IconBrowserWidget : IDataWindowWidget
|
|||
texture.Size.X * scale / 2.0f - textSize.X / 2.0f + ImGui.GetStyle().FramePadding.X * 2.0f);
|
||||
ImGui.Text(iconId.ToString());
|
||||
|
||||
ImGui.Image(texture.ImGuiHandle, texture.Size * scale);
|
||||
ImGui.Image(texture.Handle, texture.Size * scale);
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ internal class ImGuiWidget : IDataWindowWidget
|
|||
|
||||
public DisposeLoggingTextureWrap(IDalamudTextureWrap inner) => this.inner = inner;
|
||||
|
||||
public ImTextureID ImGuiHandle => this.inner.ImGuiHandle;
|
||||
public ImTextureID Handle => this.inner.Handle;
|
||||
|
||||
public int Width => this.inner.Width;
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ internal class InventoryWidget : IDataWindowWidget
|
|||
|
||||
if (this.textureManager.Shared.TryGetFromGameIcon(new GameIconLookup(iconId, item.IsHq), out var tex) && tex.TryGetWrap(out var texture, out _))
|
||||
{
|
||||
ImGui.Image(texture.ImGuiHandle, new Vector2(ImGui.GetTextLineHeight()));
|
||||
ImGui.Image(texture.Handle, new Vector2(ImGui.GetTextLineHeight()));
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
|
|
@ -156,7 +156,7 @@ internal class InventoryWidget : IDataWindowWidget
|
|||
ImGui.BeginTooltip();
|
||||
ImGui.TextUnformatted("Click to copy IconId");
|
||||
ImGui.TextUnformatted($"ID: {iconId} – Size: {texture.Width}x{texture.Height}");
|
||||
ImGui.Image(texture.ImGuiHandle, new(texture.Width, texture.Height));
|
||||
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
.GetFromGame(Encoding.UTF8.GetString(state.Span[(byteOffset + 4)..(byteOffset + off)]))
|
||||
.GetWrapOrEmpty();
|
||||
state.Draw(
|
||||
tex.ImGuiHandle,
|
||||
tex.Handle,
|
||||
offset + new Vector2(0, (state.LineHeight - state.FontSize) / 2),
|
||||
tex.Size * (state.FontSize / tex.Size.Y),
|
||||
Vector2.Zero,
|
||||
|
|
@ -408,7 +408,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
.GetFromGameIcon(parsed)
|
||||
.GetWrapOrEmpty();
|
||||
state.Draw(
|
||||
tex.ImGuiHandle,
|
||||
tex.Handle,
|
||||
offset + new Vector2(0, (state.LineHeight - state.FontSize) / 2),
|
||||
tex.Size * (state.FontSize / tex.Size.Y),
|
||||
Vector2.Zero,
|
||||
|
|
@ -417,7 +417,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
|
||||
static void DrawAsset(scoped in SeStringDrawState state, Vector2 offset, DalamudAsset asset) =>
|
||||
state.Draw(
|
||||
Service<DalamudAssetManager>.Get().GetDalamudTextureWrap(asset).ImGuiHandle,
|
||||
Service<DalamudAssetManager>.Get().GetDalamudTextureWrap(asset).Handle,
|
||||
offset + new Vector2(0, (state.LineHeight - state.FontSize) / 2),
|
||||
new(state.FontSize, state.FontSize),
|
||||
Vector2.Zero,
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
{
|
||||
if (t.GetTexture(this.textureManager) is { } source)
|
||||
{
|
||||
var psrv = (ID3D11ShaderResourceView*)source.ImGuiHandle.Handle;
|
||||
var psrv = (ID3D11ShaderResourceView*)source.Handle.Handle;
|
||||
var rcsrv = psrv->AddRef() - 1;
|
||||
psrv->Release();
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
if (this.inputTexScale != Vector2.Zero)
|
||||
scale *= this.inputTexScale;
|
||||
|
||||
ImGui.Image(tex.ImGuiHandle, scale, this.inputTexUv0, this.inputTexUv1, this.inputTintCol);
|
||||
ImGui.Image(tex.Handle, scale, this.inputTexUv0, this.inputTexUv1, this.inputTintCol);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -467,7 +467,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.Image(wrap.ImGuiHandle, wrap.Size);
|
||||
ImGui.Image(wrap.Handle, wrap.Size);
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
@ -590,7 +590,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
if (ImGui.IsItemHovered() && texture.GetWrapOrDefault(null) is { } immediate)
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.Image(immediate.ImGuiHandle, immediate.Size);
|
||||
ImGui.Image(immediate.Handle, immediate.Size);
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
var texturePath = GetStringNullTerminated(textureEntry.Path);
|
||||
ImGui.TextUnformatted($"Base path at {texturePath}:");
|
||||
if (textureManager.Shared.GetFromGame(texturePath).TryGetWrap(out var wrap, out var e))
|
||||
ImGui.Image(wrap.ImGuiHandle, wrap.Size);
|
||||
ImGui.Image(wrap.Handle, wrap.Size);
|
||||
else if (e is not null)
|
||||
ImGui.TextUnformatted(e.ToString());
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
var texturePathThemed = this.ToThemedPath(texturePath);
|
||||
ImGui.TextUnformatted($"Themed path at {texturePathThemed}:");
|
||||
if (textureManager.Shared.GetFromGame(texturePathThemed).TryGetWrap(out wrap, out e))
|
||||
ImGui.Image(wrap.ImGuiHandle, wrap.Size);
|
||||
ImGui.Image(wrap.Handle, wrap.Size);
|
||||
else if (e is not null)
|
||||
ImGui.TextUnformatted(e.ToString());
|
||||
}
|
||||
|
|
@ -533,7 +533,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
{
|
||||
var uv0 = new Vector2(partsDataPart.U, partsDataPart.V);
|
||||
var uv1 = uv0 + partSize;
|
||||
ImGui.Image(wrap.ImGuiHandle, partSize * ImGuiHelpers.GlobalScale, uv0 / wrap.Size, uv1 / wrap.Size);
|
||||
ImGui.Image(wrap.Handle, partSize * ImGuiHelpers.GlobalScale, uv0 / wrap.Size, uv1 / wrap.Size);
|
||||
}
|
||||
|
||||
if (ImGui.IsItemClicked())
|
||||
|
|
|
|||
|
|
@ -1737,19 +1737,19 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var iconSize = ImGuiHelpers.ScaledVector2(64, 64);
|
||||
|
||||
var cursorBeforeImage = ImGui.GetCursorPos();
|
||||
ImGui.Image(iconTex.ImGuiHandle, iconSize);
|
||||
ImGui.Image(iconTex.Handle, iconSize);
|
||||
ImGui.SameLine();
|
||||
|
||||
if (this.testerError)
|
||||
{
|
||||
ImGui.SetCursorPos(cursorBeforeImage);
|
||||
ImGui.Image(this.imageCache.TroubleIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.TroubleIcon.Handle, iconSize);
|
||||
ImGui.SameLine();
|
||||
}
|
||||
else if (this.testerUpdateAvailable)
|
||||
{
|
||||
ImGui.SetCursorPos(cursorBeforeImage);
|
||||
ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.UpdateIcon.Handle, iconSize);
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
|
|
@ -1850,7 +1850,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
if (ImGui.BeginPopup(popupId))
|
||||
{
|
||||
if (ImGui.ImageButton(image.ImGuiHandle, new Vector2(image.Width, image.Height)))
|
||||
if (ImGui.ImageButton(image.Handle, new Vector2(image.Width, image.Height)))
|
||||
ImGui.CloseCurrentPopup();
|
||||
|
||||
ImGui.EndPopup();
|
||||
|
|
@ -1874,7 +1874,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
|
||||
var size = ImGuiHelpers.ScaledVector2(xAct / thumbFactor, yAct / thumbFactor);
|
||||
if (ImGui.ImageButton(image.ImGuiHandle, size))
|
||||
if (ImGui.ImageButton(image.Handle, size))
|
||||
ImGui.OpenPopup(popupId);
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
|
|
@ -2125,7 +2125,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, iconAlpha);
|
||||
ImGui.Image(iconTex.ImGuiHandle, iconSize);
|
||||
ImGui.Image(iconTex.Handle, iconSize);
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
ImGui.SameLine();
|
||||
|
|
@ -2136,13 +2136,13 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, overlayAlpha);
|
||||
if (flags.HasFlag(PluginHeaderFlags.UpdateAvailable))
|
||||
ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.UpdateIcon.Handle, iconSize);
|
||||
else if ((flags.HasFlag(PluginHeaderFlags.HasTrouble) && !pluginDisabled) || flags.HasFlag(PluginHeaderFlags.IsOrphan))
|
||||
ImGui.Image(this.imageCache.TroubleIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.TroubleIcon.Handle, iconSize);
|
||||
else if (flags.HasFlag(PluginHeaderFlags.IsInstallableOutdated))
|
||||
ImGui.Image(this.imageCache.OutdatedInstallableIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.OutdatedInstallableIcon.Handle, iconSize);
|
||||
else if (pluginDisabled)
|
||||
ImGui.Image(this.imageCache.DisabledIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.DisabledIcon.Handle, iconSize);
|
||||
/* NOTE: Replaced by the checkmarks for now, let's see if that is fine
|
||||
else if (isLoaded && isThirdParty)
|
||||
ImGui.Image(this.imageCache.ThirdInstalledIcon.ImGuiHandle, iconSize);
|
||||
|
|
@ -2150,7 +2150,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
ImGui.Image(this.imageCache.ThirdIcon.ImGuiHandle, iconSize);
|
||||
*/
|
||||
else if (isLoaded)
|
||||
ImGui.Image(this.imageCache.InstalledIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.InstalledIcon.Handle, iconSize);
|
||||
else
|
||||
ImGui.Dummy(iconSize);
|
||||
ImGui.PopStyleVar();
|
||||
|
|
@ -2334,7 +2334,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
icon = this.imageCache.CorePluginIcon;
|
||||
}
|
||||
|
||||
ImGui.Image(icon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(icon.Handle, iconSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3637,7 +3637,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var popupId = $"plugin{index}image{i}";
|
||||
if (ImGui.BeginPopup(popupId))
|
||||
{
|
||||
if (ImGui.ImageButton(image.ImGuiHandle, new Vector2(image.Width, image.Height)))
|
||||
if (ImGui.ImageButton(image.Handle, new Vector2(image.Width, image.Height)))
|
||||
ImGui.CloseCurrentPopup();
|
||||
|
||||
ImGui.EndPopup();
|
||||
|
|
@ -3661,7 +3661,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
|
||||
var size = ImGuiHelpers.ScaledVector2(xAct / thumbFactor, yAct / thumbFactor);
|
||||
if (ImGui.ImageButton(image.ImGuiHandle, size))
|
||||
if (ImGui.ImageButton(image.Handle, size))
|
||||
ImGui.OpenPopup(popupId);
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
|
|
|
|||
|
|
@ -416,13 +416,13 @@ internal class ProfileManagerWidget
|
|||
pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.IsThirdParty, out var icon, out _);
|
||||
icon ??= pic.DefaultIcon;
|
||||
|
||||
ImGui.Image(icon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(icon.Handle, new Vector2(pluginLineHeight));
|
||||
|
||||
if (pmPlugin.IsDev)
|
||||
{
|
||||
ImGui.SetCursorPos(cursorBeforeIcon);
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.7f);
|
||||
ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(pic.DevPluginIcon.Handle, new Vector2(pluginLineHeight));
|
||||
ImGui.PopStyleVar();
|
||||
}
|
||||
|
||||
|
|
@ -439,7 +439,7 @@ internal class ProfileManagerWidget
|
|||
}
|
||||
else
|
||||
{
|
||||
ImGui.Image(pic.DefaultIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(pic.DefaultIcon.Handle, new Vector2(pluginLineHeight));
|
||||
ImGui.SameLine();
|
||||
|
||||
var text = Locs.NotInstalled(profileEntry.InternalName);
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ Contribute at: https://github.com/goatcorp/Dalamud
|
|||
const float imageSize = 190f;
|
||||
ImGui.SameLine((ImGui.GetWindowWidth() / 2) - (imageSize / 2));
|
||||
this.logoTexture ??= Service<DalamudAssetManager>.Get().GetDalamudTextureWrap(DalamudAsset.Logo);
|
||||
ImGui.Image(this.logoTexture.ImGuiHandle, ImGuiHelpers.ScaledVector2(imageSize));
|
||||
ImGui.Image(this.logoTexture.Handle, ImGuiHelpers.ScaledVector2(imageSize));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(0, 20f);
|
||||
|
||||
|
|
|
|||
|
|
@ -116,14 +116,14 @@ public class SettingsTabAutoUpdates : SettingsTab
|
|||
pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.IsThirdParty, out var icon, out _);
|
||||
icon ??= pic.DefaultIcon;
|
||||
|
||||
ImGui.Image(icon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(icon.Handle, new Vector2(pluginLineHeight));
|
||||
|
||||
if (pmPlugin.IsDev)
|
||||
{
|
||||
ImGui.SetCursorPos(cursorBeforeIcon);
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, 0.7f))
|
||||
{
|
||||
ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(pic.DevPluginIcon.Handle, new Vector2(pluginLineHeight));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ public class SettingsTabAutoUpdates : SettingsTab
|
|||
}
|
||||
else
|
||||
{
|
||||
ImGui.Image(pic.DefaultIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(pic.DefaultIcon.Handle, new Vector2(pluginLineHeight));
|
||||
ImGui.SameLine();
|
||||
|
||||
var text = Loc.Localize("DalamudSettingsAutoUpdateOptInUnknownPlugin", "Unknown plugin");
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)shadeEasing.ValueClamped))
|
||||
{
|
||||
var texture = this.shadeTexture.Value;
|
||||
ImGui.Image(texture.ImGuiHandle, new Vector2(texture.Width, texture.Height) * scale);
|
||||
ImGui.Image(texture.Handle, new Vector2(texture.Width, texture.Height) * scale);
|
||||
}
|
||||
|
||||
var isHover = ImGui.IsItemHovered();
|
||||
|
|
@ -408,7 +408,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
|
||||
// Wrap should always be valid at this point due to us checking the validity of the image each frame
|
||||
var dalamudTextureWrap = entry.Texture.GetWrapOrEmpty();
|
||||
ImGui.Image(dalamudTextureWrap.ImGuiHandle, new Vector2(TitleScreenMenu.TextureSize * scale));
|
||||
ImGui.Image(dalamudTextureWrap.Handle, new Vector2(TitleScreenMenu.TextureSize * scale));
|
||||
if (overrideAlpha || isFirst)
|
||||
{
|
||||
ImGui.PopStyleVar();
|
||||
|
|
|
|||
|
|
@ -709,7 +709,7 @@ internal sealed partial class FontAtlasFactory
|
|||
name);
|
||||
this.factory.TextureManager.Blame(wrap, this.data.Owner?.OwnerPlugin);
|
||||
this.data.AddExistingTexture(wrap);
|
||||
texture.TexID = wrap.ImGuiHandle;
|
||||
texture.TexID = wrap.Handle;
|
||||
}
|
||||
else if (texture.TexPixelsAlpha8 is not null)
|
||||
{
|
||||
|
|
@ -755,7 +755,7 @@ internal sealed partial class FontAtlasFactory
|
|||
name);
|
||||
this.factory.TextureManager.Blame(wrap, this.data.Owner?.OwnerPlugin);
|
||||
this.data.AddExistingTexture(wrap);
|
||||
texture.TexID = wrap.ImGuiHandle;
|
||||
texture.TexID = wrap.Handle;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ internal sealed partial class FontAtlasFactory
|
|||
if (this.wraps is null)
|
||||
throw new ObjectDisposedException(nameof(FontAtlasBuiltData));
|
||||
|
||||
var handle = wrap.ImGuiHandle;
|
||||
var handle = wrap.Handle;
|
||||
var index = this.ImTextures.IndexOf(x => x.TexID == handle);
|
||||
if (index == -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -253,12 +253,12 @@ internal sealed partial class TextureManager
|
|||
0);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ImTextureID ImGuiHandle
|
||||
public ImTextureID Handle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.refCount == 0)
|
||||
return Service<DalamudAssetManager>.Get().Empty4X4.ImGuiHandle;
|
||||
return Service<DalamudAssetManager>.Get().Empty4X4.Handle;
|
||||
|
||||
this.srvDebugPreviewExpiryTick = Environment.TickCount64 + 1000;
|
||||
if (!this.srvDebugPreview.IsEmpty())
|
||||
|
|
@ -273,7 +273,7 @@ internal sealed partial class TextureManager
|
|||
using var srv = default(ComPtr<ID3D11ShaderResourceView>);
|
||||
if (device.Get()->CreateShaderResourceView((ID3D11Resource*)this.tex2D, &srvDesc, srv.GetAddressOf())
|
||||
.FAILED)
|
||||
return Service<DalamudAssetManager>.Get().Empty4X4.ImGuiHandle;
|
||||
return Service<DalamudAssetManager>.Get().Empty4X4.Handle;
|
||||
|
||||
srv.Swap(ref this.srvDebugPreview);
|
||||
return new ImTextureID(this.srvDebugPreview.Get());
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ internal sealed partial class TextureManager
|
|||
ctx->PSSetShader(this.pixelShader, null, 0);
|
||||
var simp = this.sampler.Get();
|
||||
ctx->PSSetSamplers(0, 1, &simp);
|
||||
var ppn = (ID3D11ShaderResourceView*)Service<DalamudAssetManager>.Get().White4X4.ImGuiHandle.Handle;
|
||||
var ppn = (ID3D11ShaderResourceView*)Service<DalamudAssetManager>.Get().White4X4.Handle.Handle;
|
||||
ctx->PSSetShaderResources(0, 1, &ppn);
|
||||
|
||||
ctx->GSSetShader(null, null, 0);
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ internal sealed partial class TextureManager
|
|||
{
|
||||
this.wrapToClose = leaveWrapOpen ? null : wrap;
|
||||
|
||||
using var unk = new ComPtr<IUnknown>((IUnknown*)wrap.ImGuiHandle.Handle);
|
||||
using var unk = new ComPtr<IUnknown>((IUnknown*)wrap.Handle.Handle);
|
||||
|
||||
using var srvTemp = default(ComPtr<ID3D11ShaderResourceView>);
|
||||
unk.As(&srvTemp).ThrowOnError();
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ namespace Dalamud.Interface.Textures.TextureWraps;
|
|||
public abstract class ForwardingTextureWrap : IDalamudTextureWrap
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public ImTextureID ImGuiHandle
|
||||
public ImTextureID Handle
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => this.GetWrap().ImGuiHandle;
|
||||
get => this.GetWrap().Handle;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
@ -56,7 +56,7 @@ public abstract class ForwardingTextureWrap : IDalamudTextureWrap
|
|||
public virtual unsafe IDalamudTextureWrap CreateWrapSharingLowLevelResource()
|
||||
{
|
||||
// Dalamud specific: IDalamudTextureWrap always points to an ID3D11ShaderResourceView.
|
||||
var handle = (IUnknown*)this.ImGuiHandle.Handle;
|
||||
var handle = (IUnknown*)this.Handle.Handle;
|
||||
return new UnknownTextureWrap(handle, this.Width, this.Height, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System.Numerics;
|
|||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface.Textures.TextureWraps.Internal;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
|
|
@ -16,7 +17,11 @@ namespace Dalamud.Interface.Textures.TextureWraps;
|
|||
public interface IDalamudTextureWrap : IDisposable
|
||||
{
|
||||
/// <summary>Gets a texture handle suitable for direct use with ImGui functions.</summary>
|
||||
ImTextureID ImGuiHandle { get; }
|
||||
ImTextureID Handle { get; }
|
||||
|
||||
/// <summary>Gets a texture handle suitable for direct use with ImGui functions.</summary>
|
||||
[ImGuiBindingsToDo("Remove.")]
|
||||
IntPtr ImGuiHandle => new((long)this.Handle.Handle);
|
||||
|
||||
/// <summary>Gets the width of the texture.</summary>
|
||||
int Width { get; }
|
||||
|
|
@ -46,7 +51,7 @@ public interface IDalamudTextureWrap : IDisposable
|
|||
unsafe IDalamudTextureWrap CreateWrapSharingLowLevelResource()
|
||||
{
|
||||
// Dalamud specific: IDalamudTextureWrap always points to an ID3D11ShaderResourceView.
|
||||
var handle = (IUnknown*)this.ImGuiHandle.Handle;
|
||||
var handle = (IUnknown*)this.Handle.Handle;
|
||||
return new UnknownTextureWrap(handle, this.Width, this.Height, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ internal sealed unsafe class UnknownTextureWrap : IDalamudTextureWrap, IDeferred
|
|||
~UnknownTextureWrap() => this.Dispose(false);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ImTextureID ImGuiHandle =>
|
||||
public ImTextureID Handle =>
|
||||
this.imGuiHandle == nint.Zero
|
||||
? throw new ObjectDisposedException(nameof(UnknownTextureWrap))
|
||||
: new ImTextureID(this.imGuiHandle);
|
||||
|
|
|
|||
|
|
@ -51,12 +51,12 @@ internal sealed class ViewportTextureWrap : IDalamudTextureWrap, IDeferredDispos
|
|||
~ViewportTextureWrap() => this.Dispose(false);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public unsafe ImTextureID ImGuiHandle
|
||||
public unsafe ImTextureID Handle
|
||||
{
|
||||
get
|
||||
{
|
||||
var t = (nint)this.srv.Get();
|
||||
return t == nint.Zero ? Service<DalamudAssetManager>.Get().Empty4X4.ImGuiHandle : ImTextureID.Null;
|
||||
return t == nint.Zero ? Service<DalamudAssetManager>.Get().Empty4X4.Handle : ImTextureID.Null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ internal sealed class DevTextureSaveMenu : IInternalDisposableService
|
|||
size *= previewImageWidth / size.X;
|
||||
if (size.Y > previewImageWidth)
|
||||
size *= previewImageWidth / size.Y;
|
||||
ImGui.Image(textureWrap.ImGuiHandle, size);
|
||||
ImGui.Image(textureWrap.Handle, size);
|
||||
|
||||
if (tcs.Task.IsCompleted)
|
||||
ImGui.CloseCurrentPopup();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue