Debugger: Improved draw performance by using Format32bppPArgb for all bitmaps
This commit is contained in:
parent
e338ab0765
commit
438cccce77
14 changed files with 83 additions and 58 deletions
|
@ -11,6 +11,7 @@ using System.Runtime.InteropServices;
|
|||
using Mesen.GUI.Controls;
|
||||
using Mesen.GUI.Config;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Mesen.GUI.Debugger.Controls
|
||||
{
|
||||
|
@ -33,7 +34,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
tlpTileMappings.Controls.Add(mapping);
|
||||
tlpTileMappings.SetColumn(mapping, x);
|
||||
tlpTileMappings.SetRow(mapping, y + 1);
|
||||
mapping.picTiles.Image = new Bitmap(416, 20);
|
||||
mapping.picTiles.Image = new Bitmap(416, 20, PixelFormat.Format32bppPArgb);
|
||||
_mappings[(y << 1) + x] = mapping;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +69,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
GCHandle handle = GCHandle.Alloc(_chrPixelData, GCHandleType.Pinned);
|
||||
try {
|
||||
Bitmap source = new Bitmap(128, 128, 4*128, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap source = new Bitmap(128, 128, 4*128, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
|
||||
for(int y = 0; y < 16; y++) {
|
||||
using(Graphics g = Graphics.FromImage(_mappings[y].picTiles.Image)) {
|
||||
|
|
|
@ -12,6 +12,7 @@ using Mesen.GUI.Controls;
|
|||
using Mesen.GUI.Config;
|
||||
using Mesen.GUI.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Mesen.GUI.Debugger.Controls
|
||||
{
|
||||
|
@ -156,18 +157,18 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
GCHandle handle = GCHandle.Alloc(pixelData, GCHandleType.Pinned);
|
||||
try {
|
||||
Bitmap source = new Bitmap(128, 128, 4*128, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap target = new Bitmap(256, 256);
|
||||
Bitmap source = new Bitmap(128, 128, 4*128, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap target = new Bitmap(256, 256, PixelFormat.Format32bppPArgb);
|
||||
|
||||
using(Graphics g = Graphics.FromImage(target)) {
|
||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
|
||||
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
|
||||
g.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
g.SmoothingMode = SmoothingMode.None;
|
||||
g.PixelOffsetMode = PixelOffsetMode.Half;
|
||||
g.ScaleTransform(2, 2);
|
||||
g.DrawImageUnscaled(source, 0, 0);
|
||||
}
|
||||
|
||||
Bitmap originalImg = new Bitmap(128, 128, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
Bitmap originalImg = new Bitmap(128, 128, PixelFormat.Format32bppPArgb);
|
||||
using(Graphics g = Graphics.FromImage(originalImg)) {
|
||||
g.DrawImage(source, 0, 0);
|
||||
}
|
||||
|
@ -187,7 +188,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
private void DrawHud(int chrBank)
|
||||
{
|
||||
Bitmap chrBankImage = new Bitmap(256, 256);
|
||||
Bitmap chrBankImage = new Bitmap(256, 256, PixelFormat.Format32bppPArgb);
|
||||
using(Graphics g = Graphics.FromImage(chrBankImage)) {
|
||||
g.DrawImage(_chrBanks[chrBank], 0, 0);
|
||||
|
||||
|
@ -390,7 +391,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
_tilePreview = PpuViewerHelper.GetPreview(new Point(tileX * 16, tileY * 16), new Size(16, 16), 8, bottomBank ? this._chrBanks[1] : this._chrBanks[0]);
|
||||
|
||||
Bitmap tile = new Bitmap(128, 128);
|
||||
Bitmap tile = new Bitmap(128, 128, PixelFormat.Format32bppPArgb);
|
||||
using(Graphics g = Graphics.FromImage(tile)) {
|
||||
g.DrawImageUnscaled(_tilePreview, 0, 0);
|
||||
using(Brush brush = new SolidBrush(Color.FromArgb(128, Color.White))) {
|
||||
|
@ -528,7 +529,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
private Bitmap GetCopyBitmap()
|
||||
{
|
||||
Bitmap copy = new Bitmap(128, 256);
|
||||
Bitmap copy = new Bitmap(128, 256, PixelFormat.Format32bppPArgb);
|
||||
using(Graphics g = Graphics.FromImage(copy)) {
|
||||
g.DrawImage(_originalChrBanks[0], 0, 0);
|
||||
g.DrawImage(_originalChrBanks[1], 0, 128);
|
||||
|
@ -549,7 +550,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
sfd.SetFilter("PNG files|*.png");
|
||||
if(sfd.ShowDialog() == DialogResult.OK) {
|
||||
using(Bitmap copy = GetCopyBitmap()) {
|
||||
copy.Save(sfd.FileName, System.Drawing.Imaging.ImageFormat.Png);
|
||||
copy.Save(sfd.FileName, ImageFormat.Png);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ using Mesen.GUI.Controls;
|
|||
using Mesen.GUI.Forms;
|
||||
using Mesen.GUI.Config;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Mesen.GUI.Debugger.Controls
|
||||
{
|
||||
|
@ -113,13 +114,13 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
{
|
||||
GCHandle handle = GCHandle.Alloc(this._pictureData, GCHandleType.Pinned);
|
||||
try {
|
||||
Bitmap source = new Bitmap(256, 240, 256*4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap source = new Bitmap(256, 240, 256*4, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
int picHeight = (int)_state.PPU.ScanlineCount * 2;
|
||||
if(_eventBitmap == null || _eventBitmap.Height != picHeight) {
|
||||
_screenBitmap = new Bitmap(682, picHeight);
|
||||
_eventBitmap = new Bitmap(682, picHeight);
|
||||
_overlayBitmap = new Bitmap(682, picHeight);
|
||||
_displayBitmap = new Bitmap(682, picHeight);
|
||||
_screenBitmap = new Bitmap(682, picHeight, PixelFormat.Format32bppPArgb);
|
||||
_eventBitmap = new Bitmap(682, picHeight, PixelFormat.Format32bppPArgb);
|
||||
_overlayBitmap = new Bitmap(682, picHeight, PixelFormat.Format32bppPArgb);
|
||||
_displayBitmap = new Bitmap(682, picHeight, PixelFormat.Format32bppPArgb);
|
||||
}
|
||||
|
||||
Size picSize = new Size((int)((_eventBitmap.Width * _scale) + 2), (int)((_eventBitmap.Height * _scale) + 2));
|
||||
|
|
|
@ -12,6 +12,7 @@ using Mesen.GUI.Config;
|
|||
using Mesen.GUI.Controls;
|
||||
using Mesen.GUI.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Mesen.GUI.Debugger.Controls
|
||||
{
|
||||
|
@ -28,9 +29,9 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
private byte[][] _tileData = new byte[4][];
|
||||
private byte[][] _attributeData = new byte[4][];
|
||||
private Bitmap _gridOverlay;
|
||||
private Bitmap _nametableImage = new Bitmap(512, 480);
|
||||
private Bitmap _finalImage = new Bitmap(512, 480);
|
||||
private Bitmap _hudImage = new Bitmap(512, 480);
|
||||
private Bitmap _nametableImage = new Bitmap(512, 480, PixelFormat.Format32bppPArgb);
|
||||
private Bitmap _finalImage = new Bitmap(512, 480, PixelFormat.Format32bppPArgb);
|
||||
private Bitmap _hudImage = new Bitmap(512, 480, PixelFormat.Format32bppPArgb);
|
||||
private TileInfo _tileInfo;
|
||||
private int _currentPpuAddress = -1;
|
||||
private int _tileX = 0;
|
||||
|
@ -140,7 +141,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
using(Graphics gNametable = Graphics.FromImage(_nametableImage)) {
|
||||
for(int i = 0; i < 4; i++) {
|
||||
GCHandle handle = GCHandle.Alloc(_nametablePixelData[i], GCHandleType.Pinned);
|
||||
Bitmap source = new Bitmap(256, 240, 4*256, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap source = new Bitmap(256, 240, 4*256, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
try {
|
||||
gNametable.DrawImage(source, new Rectangle(i % 2 == 0 ? 0 : 256, i <= 1 ? 0 : 240, 256, 240), new Rectangle(0, 0, 256, 240), GraphicsUnit.Pixel);
|
||||
} finally {
|
||||
|
@ -150,13 +151,13 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
}
|
||||
|
||||
if(this._gridOverlay == null && (chkShowTileGrid.Checked || chkShowAttributeGrid.Checked)) {
|
||||
this._gridOverlay = new Bitmap(512, 480);
|
||||
this._gridOverlay = new Bitmap(512, 480, PixelFormat.Format32bppPArgb);
|
||||
|
||||
using(Graphics overlay = Graphics.FromImage(this._gridOverlay)) {
|
||||
if(chkShowTileGrid.Checked) {
|
||||
using(Pen pen = new Pen(Color.FromArgb(chkShowAttributeGrid.Checked ? 120 : 180, 240, 100, 120))) {
|
||||
if(chkShowAttributeGrid.Checked) {
|
||||
pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
|
||||
pen.DashStyle = DashStyle.Dot;
|
||||
}
|
||||
DrawGrid(overlay, pen, 1);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ using System.Runtime.InteropServices;
|
|||
using Mesen.GUI.Controls;
|
||||
using Mesen.GUI.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Mesen.GUI.Debugger.Controls
|
||||
{
|
||||
|
@ -50,13 +51,13 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
GCHandle handle = GCHandle.Alloc(this._palettePixelData, GCHandleType.Pinned);
|
||||
try {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
Bitmap source = new Bitmap(4, 4, 4 * 4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject()+i*16*4);
|
||||
Bitmap target = new Bitmap(128, 128);
|
||||
Bitmap source = new Bitmap(4, 4, 4 * 4, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject()+i*16*4);
|
||||
Bitmap target = new Bitmap(128, 128, PixelFormat.Format32bppPArgb);
|
||||
|
||||
using(Graphics g = Graphics.FromImage(target)) {
|
||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
|
||||
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
|
||||
g.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
g.SmoothingMode = SmoothingMode.None;
|
||||
g.PixelOffsetMode = PixelOffsetMode.Half;
|
||||
g.ScaleTransform(32, 32);
|
||||
g.DrawImageUnscaled(source, 0, 0);
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
private int _contextMenuSpriteIndex = -1;
|
||||
private bool _copyPreview = false;
|
||||
private Bitmap _imgSprites;
|
||||
private Bitmap _scaledSprites = new Bitmap(256, 512);
|
||||
private Bitmap _screenPreview = new Bitmap(256, 240, PixelFormat.Format32bppArgb);
|
||||
private Bitmap _scaledSprites = new Bitmap(256, 512, PixelFormat.Format32bppPArgb);
|
||||
private Bitmap _screenPreview = new Bitmap(256, 240, PixelFormat.Format32bppPArgb);
|
||||
private HdPackCopyHelper _hdCopyHelper = new HdPackCopyHelper();
|
||||
private bool _firstDraw = true;
|
||||
private int _originalSpriteHeight = 0;
|
||||
|
@ -48,8 +48,8 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
InitializeComponent();
|
||||
|
||||
if(!IsDesignMode) {
|
||||
picPreview.Image = new Bitmap(256, 240, PixelFormat.Format32bppArgb);
|
||||
picSprites.Image = new Bitmap(256, 512, PixelFormat.Format32bppArgb);
|
||||
picPreview.Image = new Bitmap(256, 240, PixelFormat.Format32bppPArgb);
|
||||
picSprites.Image = new Bitmap(256, 512, PixelFormat.Format32bppPArgb);
|
||||
|
||||
chkDisplaySpriteOutlines.Checked = ConfigManager.Config.DebugInfo.SpriteViewerDisplaySpriteOutlines;
|
||||
|
||||
|
@ -116,9 +116,9 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
GCHandle handle = GCHandle.Alloc(_spritePixelData, GCHandleType.Pinned);
|
||||
try {
|
||||
Bitmap source = new Bitmap(64, 128, 4*64, PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap source = new Bitmap(64, 128, 4*64, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
|
||||
Bitmap sprites = new Bitmap(64, 128, PixelFormat.Format32bppArgb);
|
||||
Bitmap sprites = new Bitmap(64, 128, PixelFormat.Format32bppPArgb);
|
||||
using(Graphics g = Graphics.FromImage(sprites)) {
|
||||
if(_largeSprites) {
|
||||
g.DrawImage(source, 0, 0);
|
||||
|
@ -167,7 +167,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
private void ToggleSpriteMode()
|
||||
{
|
||||
if(_largeSprites) {
|
||||
picSprites.Image = new Bitmap(256, 512, PixelFormat.Format32bppArgb);
|
||||
picSprites.Image = new Bitmap(256, 512, PixelFormat.Format32bppPArgb);
|
||||
picSprites.Height = _originalSpriteHeight;
|
||||
picTile.Height = _originalTileHeight;
|
||||
picPreview.Size = _originalPreviewSize;
|
||||
|
@ -177,7 +177,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
tlpInfo.Controls.Add(picPreview, 1, 5);
|
||||
lblScreenPreview.Visible = true;
|
||||
} else {
|
||||
picSprites.Image = new Bitmap(256, 256, PixelFormat.Format32bppArgb);
|
||||
picSprites.Image = new Bitmap(256, 256, PixelFormat.Format32bppPArgb);
|
||||
picSprites.Height = (_originalSpriteHeight - 2) / 2 + 2;
|
||||
picTile.Height = (_originalTileHeight - 2) / 2 + 2;
|
||||
picPreview.Size = new Size((int)(_originalPreviewSize.Width * _scale), (int)(_originalPreviewSize.Height * _scale));
|
||||
|
@ -224,12 +224,12 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
{
|
||||
GCHandle handle = GCHandle.Alloc(_spritePixelData, GCHandleType.Pinned);
|
||||
try {
|
||||
Bitmap source = new Bitmap(64, 128, 4*64, PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap source = new Bitmap(64, 128, 4*64, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
|
||||
using(Graphics g = Graphics.FromImage(_screenPreview)) {
|
||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
|
||||
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
|
||||
g.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
g.SmoothingMode = SmoothingMode.None;
|
||||
g.PixelOffsetMode = PixelOffsetMode.Half;
|
||||
g.Clear(Color.Transparent);
|
||||
|
||||
for(int i = 63; i >= 0; i--) {
|
||||
|
|
|
@ -12,6 +12,7 @@ using Mesen.GUI.Config;
|
|||
using Mesen.GUI.Controls;
|
||||
using Mesen.GUI.Forms;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Mesen.GUI.Debugger.Controls
|
||||
{
|
||||
|
@ -23,8 +24,8 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
private byte[] _tmpTileData = new byte[16];
|
||||
private byte[] _ppuMemory = new byte[0x4000];
|
||||
|
||||
private Bitmap _nametableImage = new Bitmap(512, 480);
|
||||
private Bitmap _outputImage = new Bitmap(512, 480);
|
||||
private Bitmap _nametableImage = new Bitmap(512, 480, PixelFormat.Format32bppPArgb);
|
||||
private Bitmap _outputImage = new Bitmap(512, 480, PixelFormat.Format32bppPArgb);
|
||||
private int _xScroll = 0;
|
||||
private int _yScroll = 0;
|
||||
private DebugState _state = new DebugState();
|
||||
|
@ -91,7 +92,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
using(Graphics gNametable = Graphics.FromImage(_nametableImage)) {
|
||||
for(int i = 0; i < 4; i++) {
|
||||
GCHandle handle = GCHandle.Alloc(_nametablePixelData[i], GCHandleType.Pinned);
|
||||
Bitmap source = new Bitmap(256, 240, 4*256, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap source = new Bitmap(256, 240, 4*256, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
try {
|
||||
gNametable.DrawImage(source, new Rectangle(i % 2 == 0 ? 0 : 256, i <= 1 ? 0 : 240, 256, 240), new Rectangle(0, 0, 256, 240), GraphicsUnit.Pixel);
|
||||
} finally {
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.Windows.Forms;
|
|||
using System.Runtime.InteropServices;
|
||||
using Mesen.GUI.Forms;
|
||||
using Mesen.GUI.Controls;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Mesen.GUI.Debugger.Controls
|
||||
{
|
||||
|
@ -118,8 +119,8 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
GCHandle handle = GCHandle.Alloc(_currentPalette, GCHandleType.Pinned);
|
||||
try {
|
||||
Bitmap source = new Bitmap(4, 1, 4*4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap target = new Bitmap(128, 32);
|
||||
Bitmap source = new Bitmap(4, 1, 4*4, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap target = new Bitmap(128, 32, PixelFormat.Format32bppPArgb);
|
||||
|
||||
using(Graphics g = Graphics.FromImage(target)) {
|
||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Windows.Forms.VisualStyles;
|
|||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Be.Windows.Forms
|
||||
{
|
||||
|
@ -2837,7 +2838,7 @@ namespace Be.Windows.Forms
|
|||
Point dimensions = new Point(rec.Width, rec.Height);
|
||||
Bitmap bitmap;
|
||||
if(!_shadowSelectionCache.TryGetValue(dimensions, out bitmap)) {
|
||||
bitmap = new Bitmap(rec.Width, rec.Height);
|
||||
bitmap = new Bitmap(rec.Width, rec.Height, PixelFormat.Format32bppPArgb);
|
||||
using(Graphics bitmapGraphics = Graphics.FromImage(bitmap)) {
|
||||
using(SolidBrush shadowSelectionBrush = new SolidBrush(_shadowSelectionColor)) {
|
||||
bitmapGraphics.FillRectangle(shadowSelectionBrush, 0, 0, rec.Width, rec.Height);
|
||||
|
|
|
@ -4,6 +4,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
@ -19,7 +20,7 @@ namespace Mesen.GUI.Debugger
|
|||
{
|
||||
int[] palette = InteropEmu.DebugGetPalette();
|
||||
GCHandle handle = GCHandle.Alloc(palette, GCHandleType.Pinned);
|
||||
Bitmap source = new Bitmap(4, 1, 4 * 4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject() + paletteIndex * 16);
|
||||
Bitmap source = new Bitmap(4, 1, 4 * 4, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject() + paletteIndex * 16);
|
||||
|
||||
g.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
g.SmoothingMode = SmoothingMode.None;
|
||||
|
@ -62,8 +63,8 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
public static Bitmap GetPreview(Point originalPos, Size originalSize, int scale, Image source)
|
||||
{
|
||||
Bitmap tile = new Bitmap(originalSize.Width * scale, originalSize.Height * scale);
|
||||
Bitmap tilePreview = new Bitmap(originalSize.Width, originalSize.Height);
|
||||
Bitmap tile = new Bitmap(originalSize.Width * scale, originalSize.Height * scale, PixelFormat.Format32bppPArgb);
|
||||
Bitmap tilePreview = new Bitmap(originalSize.Width, originalSize.Height, PixelFormat.Format32bppPArgb);
|
||||
using(Graphics g = Graphics.FromImage(tilePreview)) {
|
||||
g.DrawImage(source, 0, 0, new Rectangle(originalPos.X, originalPos.Y, originalSize.Width, originalSize.Height), GraphicsUnit.Pixel);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.Windows.Forms;
|
|||
using Mesen.GUI.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using Mesen.GUI.Controls;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Mesen.GUI.Debugger
|
||||
{
|
||||
|
@ -65,8 +66,8 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
GCHandle handle = GCHandle.Alloc(this.PaletteData, GCHandleType.Pinned);
|
||||
try {
|
||||
Bitmap source = new Bitmap(16, 4, 16*4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap target = new Bitmap(336, 336);
|
||||
Bitmap source = new Bitmap(16, 4, 16*4, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap target = new Bitmap(336, 336, PixelFormat.Format32bppPArgb);
|
||||
|
||||
Font font = new Font(BaseControl.MonospaceFontFamily, BaseControl.DefaultFontSize - 2, GraphicsUnit.Pixel);
|
||||
using(Graphics g = Graphics.FromImage(target)) {
|
||||
|
|
|
@ -169,10 +169,23 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void GetData()
|
||||
{
|
||||
this.ctrlNametableViewer.GetData();
|
||||
this.ctrlChrViewer.GetData();
|
||||
this.ctrlSpriteViewer.GetData();
|
||||
this.ctrlPaletteViewer.GetData();
|
||||
if(_isCompact) {
|
||||
//In compact mode, only load data for the current tab
|
||||
if(_selectedTab == this.tpgNametableViewer) {
|
||||
this.ctrlNametableViewer.GetData();
|
||||
} else if(_selectedTab == this.tpgChrViewer) {
|
||||
this.ctrlChrViewer.GetData();
|
||||
} else if(_selectedTab == this.tpgSpriteViewer) {
|
||||
this.ctrlSpriteViewer.GetData();
|
||||
} else if(_selectedTab == this.tpgPaletteViewer) {
|
||||
this.ctrlPaletteViewer.GetData();
|
||||
}
|
||||
} else {
|
||||
this.ctrlNametableViewer.GetData();
|
||||
this.ctrlChrViewer.GetData();
|
||||
this.ctrlSpriteViewer.GetData();
|
||||
this.ctrlPaletteViewer.GetData();
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshViewers()
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -241,7 +242,7 @@ namespace Mesen.GUI.Forms.Config
|
|||
|
||||
private void UpdateOverscanImage(PictureBox picture, int top, int bottom, int left, int right)
|
||||
{
|
||||
Bitmap overscan = new Bitmap(picture.Width - 2, picture.Height - 2);
|
||||
Bitmap overscan = new Bitmap(picture.Width - 2, picture.Height - 2, PixelFormat.Format32bppPArgb);
|
||||
|
||||
using(Graphics g = Graphics.FromImage(overscan)) {
|
||||
g.Clear(Color.DarkGray);
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -29,7 +30,7 @@ namespace Mesen.GUI.Forms.HdPackEditor
|
|||
}
|
||||
|
||||
txtSaveFolder.Text = Path.Combine(ConfigManager.HdPackFolder, InteropEmu.GetRomInfo().GetRomName());
|
||||
picBankPreview.BackgroundImage = new Bitmap(256, 256);
|
||||
picBankPreview.BackgroundImage = new Bitmap(256, 256, PixelFormat.Format32bppPArgb);
|
||||
picBankPreview.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
|
||||
UpdateFilterDropdown();
|
||||
|
@ -99,7 +100,7 @@ namespace Mesen.GUI.Forms.HdPackEditor
|
|||
using(Graphics g = Graphics.FromImage(picBankPreview.BackgroundImage)) {
|
||||
Byte[] rgbBuffer = InteropEmu.HdBuilderGetBankPreview((uint)cboBank.SelectedItem, scale, 0);
|
||||
GCHandle handle = GCHandle.Alloc(rgbBuffer, GCHandleType.Pinned);
|
||||
Bitmap source = new Bitmap(128*scale, 128*scale, 4*128*scale, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.AddrOfPinnedObject());
|
||||
Bitmap source = new Bitmap(128*scale, 128*scale, 4*128*scale, PixelFormat.Format32bppPArgb, handle.AddrOfPinnedObject());
|
||||
try {
|
||||
g.Clear(Color.Black);
|
||||
g.DrawImage(source, 0, 0, 256, 256);
|
||||
|
|
Loading…
Add table
Reference in a new issue