#include <tiled-bitmap.hh>
◆ Ptr
◆ ViewDataMap
◆ WeakPtr
◆ ~TiledBitmap()
| TiledBitmap::~TiledBitmap |
( |
| ) |
|
|
override |
135 spdlog::debug(
"TiledBitmap: Destructing...");
◆ TiledBitmap() [1/3]
◆ TiledBitmap() [2/3]
◆ TiledBitmap() [3/3]
| TiledBitmap::TiledBitmap |
( |
int |
bitmapWidth, |
|
|
int |
bitmapHeight, |
|
|
LayerSpec |
ls |
|
) |
| |
|
private |
◆ clearCaches()
Clear all bitmap caches related to the view.
You'd typically do this if the bitmap has somehow changed appearance, for example when switching to a new Colormap.
- Parameters
-
Implements TiledBitmapInterface.
281 tbvd->clearVolatileStuff();
◆ close()
Gets called just before the View is destroyed
- Precondition
- Should be called from within a Gdk critical section (i.e. between gdk_threads_enter() and gdk_threads_leave() calls)
Implements Viewable.
◆ connect()
143 const int horTileCount = prevLayer->getHorTileCount();
144 const int verTileCount = prevLayer->getVerTileCount();
146 std::vector<LayerCoordinator::Ptr> coordinators_;
148 for(
int j = 0; j < verTileCount; j++)
150 const int voffset = j % 8;
154 coordinators_.clear();
156 for(
auto& z: tileLine)
159 coordinators_.push_back(lc);
164 for(
int i = 0; i < horTileCount; i++)
166 const int hoffset = i % 8;
168 lc->addSourceTile(hoffset, voffset, prevLayer->getTile(i, j));
Referenced by initialize().
◆ create() [1/2]
80 result->initialize(bottom);
◆ create() [2/2]
◆ drawTile()
185 const int margin = 5;
187 if(viewArea.
width() > 2 * margin && viewArea.
height() > 2 * margin)
190 viewArea.
x() + margin, viewArea.
y() + margin, viewArea.
width() - 2 * margin, viewArea.
height() - 2 * margin);
192 cairo_set_source_rgb(cr, 0, 0, 0);
195 const std::string label = fmt::format(
"Layer {}, Tile ({}, {}), {} bpp", tile->depth, tile->x, tile->y, tile->bpp);
196 cairo_move_to(cr, rect.x() + 20, rect.y() + 20);
197 cairo_show_text(cr, label.c_str());
Referenced by redraw().
◆ getBottomLayer()
◆ initialize() [1/2]
| void TiledBitmap::initialize |
( |
| ) |
|
|
private |
◆ initialize() [2/2]
| void TiledBitmap::initialize |
( |
const Layer::Ptr & |
bottom | ) |
|
|
private |
100 registrations.emplace_back(bottom->registerObserver(shared_from_this<TileInitialisationObserver>()));
106 width = (width + 7) / 8;
107 height = (height + 7) / 8;
110 while(std::max(width, height) >
TILESIZE / 4)
118 registrations.emplace_back(layer->registerObserver(shared_from_this<TileInitialisationObserver>()));
121 connect(layer, prevLayer, prevLo);
125 width = (width + 7) / 8;
126 height = (height + 7) / 8;
◆ open()
Gets called just after the View is created
- Precondition
- Should be called from within a Gdk critical section (i.e. between gdk_threads_enter() and gdk_threads_leave() calls)
Implements Viewable.
295 l->open(viewInterface);
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ progressInterface()
◆ redraw()
Redraw a portion of the bitmap.
This is typically called from PresentationInterface::redraw()
- See also
- PresentationInterface::redraw()
Implements TiledBitmapInterface.
207 auto scaledRequestedPresentationArea = presentationArea;
209 unsigned int layerNr = 0;
210 while(zoom <= -3 && layerNr <
layers.size() - 1)
214 scaledRequestedPresentationArea /= 8;
220 const auto validPresentationArea = scaledRequestedPresentationArea.
intersection(actualPresentationArea);
222 const int left = scaledRequestedPresentationArea.
getLeft();
223 const int top = scaledRequestedPresentationArea.getTop();
224 const int right = scaledRequestedPresentationArea.getRight();
225 const int bottom = scaledRequestedPresentationArea.getBottom();
227 const int imin = std::max(0, left /
TILESIZE);
229 const int jmin = std::max(0, top /
TILESIZE);
232 viewData_->setNeededTiles(layer, imin, imax, jmin, jmax, zoom, layerOperations);
236 layerOperations->initializeCairo(cr);
238 const auto clippedRequestedPresentationArea =
239 scaledRequestedPresentationArea.above(validPresentationArea.getBottom()).leftOf(validPresentationArea.getRight());
241 for(
int i = imin; i < imax; i++)
243 for(
int j = jmin; j < jmax; j++)
248 const auto visibleTileArea = tileArea.intersection(clippedRequestedPresentationArea);
250 const auto tileAreaRect = visibleTileArea - tileArea.getTopLeft();
251 const auto viewAreaRect = (visibleTileArea - clippedRequestedPresentationArea.getTopLeft()) * pixelSize;
261 layerOperations->draw(cr, t, tileAreaRect, viewAreaRect, zoom, cacheResult);
266 layerOperations->drawState(cr, tile->getState(), viewAreaRect);
◆ setSource()
Provide bitmap data to the TiledBitmap
Bitmap data will be loaded and pre-scaled in a fashion that least loads cpu and memory.
- Parameters
-
| sp | source of the bitmap data |
Implements TiledBitmapInterface.
◆ tileCreated()
◆ tileFinished()
341 spdlog::info(
"Finished loading file");
◆ bitmapHeight
| int TiledBitmap::bitmapHeight |
|
private |
◆ bitmapWidth
| int TiledBitmap::bitmapWidth |
|
private |
◆ coordinators
◆ layers
◆ ls
◆ progressBroadcaster
◆ registrations
◆ tileCount
| int TiledBitmap::tileCount {0} |
|
private |
◆ tileFinishedCount
| int TiledBitmap::tileFinishedCount {0} |
|
private |
◆ tileFinishedMutex
| boost::mutex TiledBitmap::tileFinishedMutex |
|
private |
◆ viewData
◆ viewDataMutex
| boost::mutex TiledBitmap::viewDataMutex |
|
private |
The documentation for this class was generated from the following files:
#define UNUSED(x)
Definition: unused.hh:10
boost::shared_ptr< PageProvider > Ptr
Definition: memoryblobs.hh:41
value_type x() const
Definition: rectangle.hh:125
int tileCount
Definition: tiled-bitmap.hh:46
boost::shared_ptr< Layer > Ptr
Definition: tiledbitmaplayer.hh:247
int bitmapWidth
Definition: tiled-bitmap.hh:39
value_type width() const
Definition: rectangle.hh:129
LayerSpec ls
Definition: tiled-bitmap.hh:41
Scroom::Utils::Stuff scheduleLoadingBitmap(const SourcePresentation::Ptr &sp, const Layer::Ptr &layer, const ProgressInterface::Ptr &progress)
Definition: tiled-bitmap.cc:33
int tileFinishedCount
Definition: tiled-bitmap.hh:48
void initialize()
Definition: tiled-bitmap.cc:131
Scroom::Utils::StuffList registrations
Definition: tiled-bitmap.hh:50
boost::shared_ptr< ConstTile > Ptr
Definition: tile.hh:47
Scroom::Utils::Rectangle< int > TileAreaForIndex(Scroom::Utils::Point< int > tileIndex)
Definition: tiled-bitmap.cc:62
boost::shared_ptr< TiledBitmapViewData > Ptr
Definition: tiledbitmapviewdata.hh:25
Rectangle intersection(const Rectangle &other) const
Definition: rectangle.hh:95
boost::mutex tileFinishedMutex
Definition: tiled-bitmap.hh:47
boost::shared_ptr< TileViewState > Ptr
Definition: tileviewstate.hh:27
ViewDataMap viewData
Definition: tiled-bitmap.hh:45
void sync_on_ui_thread(T f)
Definition: gtk-helpers.hh:59
static Ptr create()
Definition: progressinterfacehelpers.cc:122
int bitmapHeight
Definition: tiled-bitmap.hh:40
void connect(Layer::Ptr const &layer, Layer::Ptr const &prevLayer, const LayerOperations::Ptr &prevLo)
Definition: tiled-bitmap.cc:141
static Ptr create(const ViewInterface::WeakPtr &viewInterface)
Definition: tiledbitmapviewdata.cc:20
boost::shared_ptr< TiledBitmap > Ptr
Definition: tiled-bitmap.hh:34
static Ptr create(CompressedTile::Ptr targetTile, LayerOperations::Ptr lo)
Definition: layercoordinator.cc:19
std::list< LayerCoordinator::Ptr > coordinators
Definition: tiled-bitmap.hh:43
boost::shared_ptr< void > Stuff
Definition: stuff.hh:18
Scroom::Utils::ProgressInterfaceBroadcaster::Ptr progressBroadcaster
Definition: tiled-bitmap.hh:49
std::vector< Layer::Ptr > layers
Definition: tiled-bitmap.hh:42
value_type getLeft() const
Definition: rectangle.hh:110
boost::mutex viewDataMutex
Definition: tiled-bitmap.hh:44
double pixelSizeFromZoom(int zoom)
Definition: cairo-helpers.cc:112
value_type height() const
Definition: rectangle.hh:131
void drawRectangleContour(cairo_t *cr, Scroom::Utils::Rectangle< double > const &viewArea)
Definition: cairo-helpers.cc:31
boost::shared_ptr< LayerCoordinator > Ptr
Definition: layercoordinator.hh:33
TiledBitmap(const TiledBitmap &)=delete
boost::shared_ptr< CompressedTile > Ptr
Definition: tiledbitmaplayer.hh:108
#define TILESIZE
Definition: tiledbitmaplayer.hh:28
boost::shared_ptr< LayerOperations > Ptr
Definition: tiledbitmapinterface.hh:53
static void drawTile(cairo_t *cr, const CompressedTile::Ptr &tile, const Scroom::Utils::Rectangle< double > &viewArea)
Definition: tiled-bitmap.cc:183
#define defect_message(m)
Definition: assertions.hh:43
static Ptr create(int depth, int layerWidth, int layerHeight, int bpp, Scroom::MemoryBlobs::PageProvider::Ptr provider)
Definition: layer.cc:98
std::vector< CompressedTile::Ptr > CompressedTileLine
Definition: tiledbitmaplayer.hh:237
value_type y() const
Definition: rectangle.hh:127