@ -413,17 +413,14 @@ std::shared_ptr<C2LinearBlock> _C2BlockFactory::CreateLinearBlock(
std : : shared_ptr < C2LinearAllocation > alloc ;
std : : shared_ptr < C2LinearAllocation > alloc ;
if ( C2AllocatorIon : : isValid ( cHandle ) ) {
if ( C2AllocatorIon : : isValid ( cHandle ) ) {
native_handle_t * handle = native_handle_clone ( cHandle ) ;
c2_status_t err = sAllocator - > priorLinearAllocation ( cHandle , & alloc ) ;
if ( handle ) {
const std : : shared_ptr < C2PooledBlockPoolData > poolData =
c2_status_t err = sAllocator - > priorLinearAllocation ( handle , & alloc ) ;
std : : make_shared < C2PooledBlockPoolData > ( data ) ;
const std : : shared_ptr < C2PooledBlockPoolData > poolData =
if ( err = = C2_OK & & poolData ) {
std : : make_shared < C2PooledBlockPoolData > ( data ) ;
// TODO: config params?
if ( err = = C2_OK & & poolData ) {
std : : shared_ptr < C2LinearBlock > block =
// TODO: config params?
_C2BlockFactory : : CreateLinearBlock ( alloc , poolData ) ;
std : : shared_ptr < C2LinearBlock > block =
return block ;
_C2BlockFactory : : CreateLinearBlock ( alloc , poolData ) ;
return block ;
}
}
}
}
}
return nullptr ;
return nullptr ;
@ -674,17 +671,14 @@ public:
ResultStatus status = mBufferPoolManager - > allocate (
ResultStatus status = mBufferPoolManager - > allocate (
mConnectionId , params , & cHandle , & bufferPoolData ) ;
mConnectionId , params , & cHandle , & bufferPoolData ) ;
if ( status = = ResultStatus : : OK ) {
if ( status = = ResultStatus : : OK ) {
native_handle_t * handle = native_handle_clone ( cHandle ) ;
std : : shared_ptr < C2LinearAllocation > alloc ;
if ( handle ) {
std : : shared_ptr < C2PooledBlockPoolData > poolData =
std : : shared_ptr < C2LinearAllocation > alloc ;
std : : make_shared < C2PooledBlockPoolData > ( bufferPoolData ) ;
std : : shared_ptr < C2PooledBlockPoolData > poolData =
c2_status_t err = mAllocator - > priorLinearAllocation ( cHandle , & alloc ) ;
std : : make_shared < C2PooledBlockPoolData > ( bufferPoolData ) ;
if ( err = = C2_OK & & poolData & & alloc ) {
c2_status_t err = mAllocator - > priorLinearAllocation ( handle , & alloc ) ;
* block = _C2BlockFactory : : CreateLinearBlock ( alloc , poolData , 0 , capacity ) ;
if ( err = = C2_OK & & poolData & & alloc ) {
if ( * block ) {
* block = _C2BlockFactory : : CreateLinearBlock ( alloc , poolData , 0 , capacity ) ;
return C2_OK ;
if ( * block ) {
return C2_OK ;
}
}
}
}
}
return C2_NO_MEMORY ;
return C2_NO_MEMORY ;
@ -710,19 +704,16 @@ public:
ResultStatus status = mBufferPoolManager - > allocate (
ResultStatus status = mBufferPoolManager - > allocate (
mConnectionId , params , & cHandle , & bufferPoolData ) ;
mConnectionId , params , & cHandle , & bufferPoolData ) ;
if ( status = = ResultStatus : : OK ) {
if ( status = = ResultStatus : : OK ) {
native_handle_t * handle = native_handle_clone ( cHandle ) ;
std : : shared_ptr < C2GraphicAllocation > alloc ;
if ( handle ) {
std : : shared_ptr < C2PooledBlockPoolData > poolData =
std : : shared_ptr < C2GraphicAllocation > alloc ;
std : : make_shared < C2PooledBlockPoolData > ( bufferPoolData ) ;
std : : shared_ptr < C2PooledBlockPoolData > poolData =
c2_status_t err = mAllocator - > priorGraphicAllocation (
std : : make_shared < C2PooledBlockPoolData > ( bufferPoolData ) ;
cHandle , & alloc ) ;
c2_status_t err = mAllocator - > priorGraphicAllocation (
if ( err = = C2_OK & & poolData & & alloc ) {
handle , & alloc ) ;
* block = _C2BlockFactory : : CreateGraphicBlock (
if ( err = = C2_OK & & poolData & & alloc ) {
alloc , poolData , C2Rect ( width , height ) ) ;
* block = _C2BlockFactory : : CreateGraphicBlock (
if ( * block ) {
alloc , poolData , C2Rect ( width , height ) ) ;
return C2_OK ;
if ( * block ) {
return C2_OK ;
}
}
}
}
}
return C2_NO_MEMORY ;
return C2_NO_MEMORY ;
@ -1117,17 +1108,14 @@ std::shared_ptr<C2GraphicBlock> _C2BlockFactory::CreateGraphicBlock(
std : : shared_ptr < C2GraphicAllocation > alloc ;
std : : shared_ptr < C2GraphicAllocation > alloc ;
if ( C2AllocatorGralloc : : isValid ( cHandle ) ) {
if ( C2AllocatorGralloc : : isValid ( cHandle ) ) {
native_handle_t * handle = native_handle_clone ( cHandle ) ;
c2_status_t err = sAllocator - > priorGraphicAllocation ( cHandle , & alloc ) ;
if ( handle ) {
const std : : shared_ptr < C2PooledBlockPoolData > poolData =
c2_status_t err = sAllocator - > priorGraphicAllocation ( handle , & alloc ) ;
std : : make_shared < C2PooledBlockPoolData > ( data ) ;
const std : : shared_ptr < C2PooledBlockPoolData > poolData =
if ( err = = C2_OK & & poolData ) {
std : : make_shared < C2PooledBlockPoolData > ( data ) ;
// TODO: config setup?
if ( err = = C2_OK & & poolData ) {
std : : shared_ptr < C2GraphicBlock > block =
// TODO: config setup?
_C2BlockFactory : : CreateGraphicBlock ( alloc , poolData ) ;
std : : shared_ptr < C2GraphicBlock > block =
return block ;
_C2BlockFactory : : CreateGraphicBlock ( alloc , poolData ) ;
return block ;
}
}
}
}
}
return nullptr ;
return nullptr ;