Code Monkey home page Code Monkey logo

Comments (5)

ArtiomCiumac avatar ArtiomCiumac commented on July 28, 2024

Can you please provide more details about this idea? (or a code sample, if possible)
Currently DataStream class has ~230 usages only in SharpDX.sln, so any changes to it should be implemented with extreme caution.

from sharpdx.

xoofx avatar xoofx commented on July 28, 2024

DataStream is a legacy class inherited from SlimDX and mainly used for backward "compatibility", as artiom noted, It is quite heavily referenced. If you want to have random access to a memory buffer you could use DataBuffer. Also, Utilities.Read/Write are often a simpler alternative. It is usually better to avoid using DataStream.

from sharpdx.

ziriax avatar ziriax commented on July 28, 2024

An example can help here to explain what I mean:

The font collection loader interface method CreateEnumeratorFromKey
http://msdn.microsoft.com/en-us/library/windows/desktop/dd368216(v=vs.85).aspx

takes in a pointer to the key and size of the key.

The SharpDX version of this method
http://sharpdx.org/documentation/api/m-sharpdx-directwrite-fontcollectionloader-createenumeratorfromkey

uses a DataStream to represent this key

IMHO a DataStream should not be used to refer to pieces of memory like this key argument,

The same can be said for FontFileLoader.CreateStreamFromKey and maybe other methods too.

I guess a SharpDX.DataPointer would be more suitable to marshalling the concept of a "block of memory".

from sharpdx.

xoofx avatar xoofx commented on July 28, 2024

Sure, DataPointer was introduced in SharpDX to avoid making DataStream mandatory (DataBuffer and DataStream are automatically castable to DataPointer), so yes, for these methods, I think that's better to make them use DataPointer.

from sharpdx.

ArtiomCiumac avatar ArtiomCiumac commented on July 28, 2024

Some of the DataStream usages were replaced by DataPointer (in the SharpDX.Direct2D1 assembly).
Feel free to post here if there are some specific usages that need to be refactored.

from sharpdx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.