SurfaceCache( int32_t width, int32_t height, SurfaceChannelOrder sco, int numSurfaces ) : mWidth( width ), mHeight( height ), mSCO( sco ) { for( int i = 0; i < numSurfaces; ++i ) { mSurfaceData.push_back( std::shared_ptr<uint8_t>( new uint8_t[width*height*sco.getPixelInc()], std::default_delete<uint8_t[]>() ) ); mSurfaceUsed.push_back( false ); } }
SurfaceT<T>::SurfaceT( int32_t aWidth, int32_t aHeight, bool alpha, SurfaceChannelOrder aChannelOrder ) { SurfaceChannelOrder channelOrder = aChannelOrder; if( channelOrder == SurfaceChannelOrder::UNSPECIFIED ) channelOrder = ( alpha ) ? SurfaceChannelOrder::RGBA : SurfaceChannelOrder::RGB; int32_t rowBytes = aWidth * sizeof(T) * channelOrder.getPixelInc(); T *data = new T[aHeight * rowBytes]; mObj = std::shared_ptr<Obj>( new Obj( aWidth, aHeight, channelOrder, data, true, rowBytes ) ); }
SurfaceCache( int32_t width, int32_t height, SurfaceChannelOrder sco, int numSurfaces ) : mWidth( width ), mHeight( height ), mSCO( sco ) { for( int i = 0; i < numSurfaces; ++i ) { mSurfaceData.push_back( std::shared_ptr<uint8_t>( new uint8_t[width*height*sco.getPixelInc()], checked_array_deleter<uint8_t>() ) ); mDeallocatorRefcon.push_back( make_pair( this, i ) ); mSurfaceUsed.push_back( false ); } }