Scroom 0.14-48-ga0fee447
Loading...
Searching...
No Matches
DataFetcher Class Reference
Collaboration diagram for DataFetcher:
Collaboration graph

Public Member Functions

 DataFetcher (Layer::Ptr layer, int height, int horTileCount, int verTileCount, SourcePresentation::Ptr sp, ThreadPool::WeakQueue::Ptr queue, std::function< void()> on_finished)
 DataFetcher.
 
void operator() ()
 

Private Attributes

Layer::Ptr layer
 
int height
 
int horTileCount
 
int verTileCount
 
int currentRow {0}
 
SourcePresentation::Ptr sp
 
ThreadPool::Ptr threadPool
 
ThreadPool::WeakQueue::Ptr queue
 
std::function< void()> on_finished
 

Constructor & Destructor Documentation

◆ DataFetcher()

DataFetcher::DataFetcher ( Layer::Ptr  layer,
int  height,
int  horTileCount,
int  verTileCount,
SourcePresentation::Ptr  sp,
ThreadPool::WeakQueue::Ptr  queue,
std::function< void()>  on_finished 
)

DataFetcher.

205 : layer(std::move(layer_))
206 , height(height_)
207 , horTileCount(horTileCount_)
208 , verTileCount(verTileCount_)
209 , sp(std::move(sp_))
211 , queue(std::move(queue_))
212 , on_finished(std::move(on_finished_))
213{
214}
Layer::Ptr layer
Definition layer.cc:46
ThreadPool::Ptr threadPool
Definition layer.cc:52
ThreadPool::WeakQueue::Ptr queue
Definition layer.cc:53
std::function< void()> on_finished
Definition layer.cc:54
int verTileCount
Definition layer.cc:49
int height
Definition layer.cc:47
int horTileCount
Definition layer.cc:48
SourcePresentation::Ptr sp
Definition layer.cc:51
ThreadPool::Ptr CpuBound()
Definition threadpoolimpl.cc:455

Member Function Documentation

◆ operator()()

void DataFetcher::operator() ( )
217{
219
220 threadPool->schedule(qj, REDUCE_PRIO, queue);
221
222 CompressedTileLine& tileLine = layer->getTileLine(currentRow);
223 std::vector<Tile::Ptr> tiles;
224 for(int x = 0; x < horTileCount; x++)
225 {
226 CompressedTile::Ptr const ti = tileLine[x];
227 Scroom::Utils::Stuff const s = ti->initialize();
228 tiles.push_back(ti->getTileSync());
229 }
230 const int lineCount = std::min(TILESIZE, height - currentRow * TILESIZE);
231
232 sp->fillTiles(currentRow * TILESIZE, lineCount, TILESIZE, 0, tiles);
233
234 for(int x = 0; x < horTileCount; x++)
235 {
236 tileLine[x]->reportFinished();
237 }
238
239 currentRow++;
241 {
242 DataFetcher const successor(*this);
243 if(!qj->setWork(successor))
244 {
245 threadPool->schedule(successor, DATAFETCH_PRIO, queue);
246 }
247 }
248 else
249 {
250 sp->done();
251 on_finished();
252 }
253}
std::shared_ptr< CompressedTile > Ptr
Definition tiledbitmaplayer.hh:107
Definition layer.cc:44
int currentRow
Definition layer.cc:50
static Ptr create()
QueueJumper.
Definition threadpoolimpl.cc:422
std::shared_ptr< QueueJumper > Ptr
Definition threadpool.hh:533
#define REDUCE_PRIO
Definition local.hh:12
#define DATAFETCH_PRIO
Definition local.hh:11
std::shared_ptr< void > Stuff
Definition stuff.hh:17
#define TILESIZE
Definition tiledbitmaplayer.hh:27
std::vector< CompressedTile::Ptr > CompressedTileLine
Definition tiledbitmaplayer.hh:240
BitmapSurface::Ptr const s
Definition transformpresentation_test.cc:70
Here is the call graph for this function:

Member Data Documentation

◆ currentRow

int DataFetcher::currentRow {0}
private
50{0};

Referenced by operator()().

◆ height

int DataFetcher::height
private

Referenced by operator()().

◆ horTileCount

int DataFetcher::horTileCount
private

Referenced by operator()().

◆ layer

Layer::Ptr DataFetcher::layer
private

Referenced by operator()().

◆ on_finished

std::function<void()> DataFetcher::on_finished
private

Referenced by operator()().

◆ queue

ThreadPool::WeakQueue::Ptr DataFetcher::queue
private

Referenced by operator()().

◆ sp

SourcePresentation::Ptr DataFetcher::sp
private

Referenced by operator()().

◆ threadPool

ThreadPool::Ptr DataFetcher::threadPool
private

Referenced by operator()().

◆ verTileCount

int DataFetcher::verTileCount
private

Referenced by operator()().


The documentation for this class was generated from the following file: