Browse Source

Merge pull request #1432 from ahopper/WriteableBitmap-rename

rename WritableBitmap
pull/1439/head
Steven Kirk 8 years ago
committed by GitHub
parent
commit
ff281ae340
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Avalonia.Controls/Remote/RemoteWidget.cs
  2. 10
      src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs
  3. 6
      src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs
  4. 4
      src/Avalonia.Visuals/Platform/IWriteableBitmapImpl.cs
  5. 2
      src/Skia/Avalonia.Skia/BitmapImpl.cs
  6. 2
      src/Skia/Avalonia.Skia/PlatformRenderInterface.cs
  7. 4
      src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs
  8. 4
      src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs
  9. 10
      tests/Avalonia.RenderTests/Media/BitmapTests.cs
  10. 2
      tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs
  11. 2
      tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs
  12. 0
      tests/TestFiles/Direct2D1/Media/Bitmap/WriteableBitmapShouldBeUsable_Bgra8888.expected.png
  13. 0
      tests/TestFiles/Direct2D1/Media/Bitmap/WriteableBitmapShouldBeUsable_Rgba8888.expected.png
  14. 0
      tests/TestFiles/Skia/Media/Bitmap/WriteableBitmapShouldBeUsable_Bgra8888.expected.png
  15. 0
      tests/TestFiles/Skia/Media/Bitmap/WriteableBitmapShouldBeUsable_Rgba8888.expected.png

4
src/Avalonia.Controls/Remote/RemoteWidget.cs

@ -14,7 +14,7 @@ namespace Avalonia.Controls.Remote
{
private readonly IAvaloniaRemoteTransportConnection _connection;
private FrameMessage _lastFrame;
private WritableBitmap _bitmap;
private WriteableBitmap _bitmap;
public RemoteWidget(IAvaloniaRemoteTransportConnection connection)
{
_connection = connection;
@ -62,7 +62,7 @@ namespace Avalonia.Controls.Remote
var fmt = (PixelFormat) _lastFrame.Format;
if (_bitmap == null || _bitmap.PixelWidth != _lastFrame.Width ||
_bitmap.PixelHeight != _lastFrame.Height)
_bitmap = new WritableBitmap(_lastFrame.Width, _lastFrame.Height, fmt);
_bitmap = new WriteableBitmap(_lastFrame.Width, _lastFrame.Height, fmt);
using (var l = _bitmap.Lock())
{
var lineLen = (fmt == PixelFormat.Rgb565 ? 2 : 4) * _lastFrame.Width;

10
src/Avalonia.Visuals/Media/Imaging/WritableBitmap.cs → src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs

@ -9,15 +9,15 @@ using Avalonia.Utilities;
namespace Avalonia.Media.Imaging
{
/// <summary>
/// Holds a writable bitmap image.
/// Holds a writeable bitmap image.
/// </summary>
public class WritableBitmap : Bitmap
public class WriteableBitmap : Bitmap
{
public WritableBitmap(int width, int height, PixelFormat? format = null)
: base(AvaloniaLocator.Current.GetService<IPlatformRenderInterface>().CreateWritableBitmap(width, height, format))
public WriteableBitmap(int width, int height, PixelFormat? format = null)
: base(AvaloniaLocator.Current.GetService<IPlatformRenderInterface>().CreateWriteableBitmap(width, height, format))
{
}
public ILockedFramebuffer Lock() => ((IWritableBitmapImpl) PlatformImpl.Item).Lock();
public ILockedFramebuffer Lock() => ((IWriteableBitmapImpl) PlatformImpl.Item).Lock();
}
}

6
src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs

@ -61,13 +61,13 @@ namespace Avalonia.Platform
double dpiY);
/// <summary>
/// Creates a writable bitmap implementation.
/// Creates a writeable bitmap implementation.
/// </summary>
/// <param name="width">The width of the bitmap.</param>
/// <param name="height">The height of the bitmap.</param>
/// <param name="format">Pixel format (optional).</param>
/// <returns>An <see cref="IWritableBitmapImpl"/>.</returns>
IWritableBitmapImpl CreateWritableBitmap(int width, int height, PixelFormat? format = null);
/// <returns>An <see cref="IWriteableBitmapImpl"/>.</returns>
IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? format = null);
/// <summary>
/// Loads a bitmap implementation from a file..

4
src/Avalonia.Visuals/Platform/IWritableBitmapImpl.cs → src/Avalonia.Visuals/Platform/IWriteableBitmapImpl.cs

@ -7,9 +7,9 @@ using System.Threading.Tasks;
namespace Avalonia.Platform
{
/// <summary>
/// Defines the platform-specific interface for a <see cref="Avalonia.Media.Imaging.WritableBitmap"/>.
/// Defines the platform-specific interface for a <see cref="Avalonia.Media.Imaging.WriteableBitmap"/>.
/// </summary>
public interface IWritableBitmapImpl : IBitmapImpl
public interface IWriteableBitmapImpl : IBitmapImpl
{
ILockedFramebuffer Lock();
}

2
src/Skia/Avalonia.Skia/BitmapImpl.cs

@ -6,7 +6,7 @@ using SkiaSharp;
namespace Avalonia.Skia
{
class BitmapImpl : IRenderTargetBitmapImpl, IWritableBitmapImpl
class BitmapImpl : IRenderTargetBitmapImpl, IWriteableBitmapImpl
{
private Vector _dpi;

2
src/Skia/Avalonia.Skia/PlatformRenderInterface.cs

@ -88,7 +88,7 @@ namespace Avalonia.Skia
return new FramebufferRenderTarget(fb);
}
public IWritableBitmapImpl CreateWritableBitmap(int width, int height, PixelFormat? format = null)
public IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? format = null)
{
return new BitmapImpl(width, height, new Vector(96, 96), format);
}

4
src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs

@ -168,9 +168,9 @@ namespace Avalonia.Direct2D1
dpiY);
}
public IWritableBitmapImpl CreateWritableBitmap(int width, int height, PixelFormat? format = null)
public IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? format = null)
{
return new WritableWicBitmapImpl(s_imagingFactory, width, height, format);
return new WriteableWicBitmapImpl(s_imagingFactory, width, height, format);
}
public IStreamGeometryImpl CreateStreamGeometry()

4
src/Windows/Avalonia.Direct2D1/Media/Imaging/WritableWicBitmapImpl.cs → src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs

@ -9,9 +9,9 @@ using PixelFormat = Avalonia.Platform.PixelFormat;
namespace Avalonia.Direct2D1.Media.Imaging
{
class WritableWicBitmapImpl : WicBitmapImpl, IWritableBitmapImpl
class WriteableWicBitmapImpl : WicBitmapImpl, IWriteableBitmapImpl
{
public WritableWicBitmapImpl(ImagingFactory factory, int width, int height, PixelFormat? pixelFormat)
public WriteableWicBitmapImpl(ImagingFactory factory, int width, int height, PixelFormat? pixelFormat)
: base(factory, width, height, pixelFormat)
{
}

10
tests/Avalonia.RenderTests/Media/BitmapTests.cs

@ -106,9 +106,9 @@ namespace Avalonia.Direct2D1.RenderTests.Media
[Theory]
[InlineData(PixelFormat.Bgra8888), InlineData(PixelFormat.Rgba8888)]
public void WritableBitmapShouldBeUsable(PixelFormat fmt)
public void WriteableBitmapShouldBeUsable(PixelFormat fmt)
{
var writableBitmap = new WritableBitmap(256, 256, fmt);
var writeableBitmap = new WriteableBitmap(256, 256, fmt);
var data = new int[256 * 256];
for (int y = 0; y < 256; y++)
@ -116,7 +116,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
data[y * 256 + x] =(int)((uint)(x + (y << 8)) | 0xFF000000u);
using (var l = writableBitmap.Lock())
using (var l = writeableBitmap.Lock())
{
for(var r = 0; r<256; r++)
{
@ -125,9 +125,9 @@ namespace Avalonia.Direct2D1.RenderTests.Media
}
var name = nameof(WritableBitmapShouldBeUsable) + "_" + fmt;
var name = nameof(WriteableBitmapShouldBeUsable) + "_" + fmt;
writableBitmap.Save(System.IO.Path.Combine(OutputPath, name + ".out.png"));
writeableBitmap.Save(System.IO.Path.Combine(OutputPath, name + ".out.png"));
CompareImagesNoRenderer(name);
}

2
tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs

@ -39,7 +39,7 @@ namespace Avalonia.UnitTests
return new MockStreamGeometryImpl();
}
public IWritableBitmapImpl CreateWritableBitmap(int width, int height, PixelFormat? format = default(PixelFormat?))
public IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? format = default(PixelFormat?))
{
throw new NotImplementedException();
}

2
tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs

@ -49,7 +49,7 @@ namespace Avalonia.Visuals.UnitTests.VisualTree
throw new NotImplementedException();
}
public IWritableBitmapImpl CreateWritableBitmap(int width, int height, PixelFormat? fmt)
public IWriteableBitmapImpl CreateWriteableBitmap(int width, int height, PixelFormat? fmt)
{
throw new NotImplementedException();
}

0
tests/TestFiles/Direct2D1/Media/Bitmap/WritableBitmapShouldBeUsable_Bgra8888.expected.png → tests/TestFiles/Direct2D1/Media/Bitmap/WriteableBitmapShouldBeUsable_Bgra8888.expected.png

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

0
tests/TestFiles/Direct2D1/Media/Bitmap/WritableBitmapShouldBeUsable_Rgba8888.expected.png → tests/TestFiles/Direct2D1/Media/Bitmap/WriteableBitmapShouldBeUsable_Rgba8888.expected.png

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

0
tests/TestFiles/Skia/Media/Bitmap/WritableBitmapShouldBeUsable_Bgra8888.expected.png → tests/TestFiles/Skia/Media/Bitmap/WriteableBitmapShouldBeUsable_Bgra8888.expected.png

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

0
tests/TestFiles/Skia/Media/Bitmap/WritableBitmapShouldBeUsable_Rgba8888.expected.png → tests/TestFiles/Skia/Media/Bitmap/WriteableBitmapShouldBeUsable_Rgba8888.expected.png

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Loading…
Cancel
Save