galakt / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

Why not jut grow the stream? #398

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
// why would you do this exception?  This is only true for the datastream, 
a memory or filestream can grow.

kind regards

Alexander

bool Texture::ToStream( Texture^ texture, ImageFileFormat format, Stream^ 
stream )
    {
        ID3D10Blob* blob = 0;
        HRESULT hr = D3DX10SaveTextureToMemory( texture-
>InternalPointer, (D3DX10_IMAGE_FILE_FORMAT) format, &blob, 0 );
        if( RECORD_D3D10( hr ).IsFailure )
            return false;

        if( static_cast<SIZE_T>( stream->Length - stream-
>Position ) < blob->GetBufferSize() )
            throw gcnew InvalidOperationException( "The 
specified stream does not have sufficient capacity for the specified 
texture." );

Original issue reported on code.google.com by amuylaer...@gmail.com on 11 Jan 2009 at 4:49

GoogleCodeExporter commented 8 years ago
Because the DataStream is not always backed by resizable memory. 

Original comment by josh.petrie on 11 Jan 2009 at 9:06

GoogleCodeExporter commented 8 years ago

Original comment by josh.petrie on 11 Jan 2009 at 9:07