Skip to content

Commit

Permalink
Resolve @facs pointing to <surface>
Browse files Browse the repository at this point in the history
  • Loading branch information
lpugin committed Jan 9, 2024
1 parent 162d6df commit 2f2e538
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions include/vrv/facsimileinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ class FacsimileInterface : public Interface, public AttFacsimile {
Zone *GetZone() { return m_zone; }
const Zone *GetZone() const { return m_zone; }
///@}
///

/** Get the surface */
///@{
Surface *GetSurface() { return m_surface; }
const Surface *GetSurface() const { return m_surface; }
///@}

//-----------------//
// Pseudo functors //
Expand Down
8 changes: 5 additions & 3 deletions src/facsimilefunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ FunctorCode SyncFromFacsimileFunctor::VisitPb(Pb *pb)
assert(m_currentPage);

Zone *zone = pb->GetZone();
assert(zone && zone->GetParent());
Surface *surface = (zone->GetParent()->Is(SURFACE)) ? vrv_cast<Surface *>(zone->GetParent()) : NULL;
// Use the parent surface attributes if given
Surface *surface = pb->GetSurface();
if (!surface && zone && zone->GetParent())
surface = (zone->GetParent()->Is(SURFACE)) ? vrv_cast<Surface *>(zone->GetParent()) : NULL;
assert(zone || surface);
// Use the (parent) surface attributes if given
if (surface && surface->HasLrx() && surface->HasLry()) {
m_currentPage->m_pageHeight = surface->GetLry() * DEFINITION_FACTOR;
m_currentPage->m_pageWidth = surface->GetLrx() * DEFINITION_FACTOR;
Expand Down

0 comments on commit 2f2e538

Please sign in to comment.