void CompoundUpdateInputVisitor::_updateZoom( const Compound* compound, Frame* frame, const Frame* outputFrame ) { Zoom zoom = frame->getNativeZoom(); if( !zoom.isValid( )) // if zoom is not set, inherit from parent zoom = compound->getInheritZoom(); // Zoom difference between output and input const FrameData* frameData = outputFrame->getMasterData(); zoom /= frameData->getZoom(); frame->setZoom( zoom ); }
void CompoundUpdateOutputVisitor::_updateZoom(const Compound* compound, Frame* frame) { Zoom zoom = frame->getNativeZoom(); Zoom zoom_1; if (!zoom.isValid()) // if zoom is not set, auto-calculate from parent { zoom_1 = compound->getInheritZoom(); LBASSERT(zoom_1.isValid()); zoom.x() = 1.0f / zoom_1.x(); zoom.y() = 1.0f / zoom_1.y(); } else { zoom_1.x() = 1.0f / zoom.x(); zoom_1.y() = 1.0f / zoom.y(); } if (frame->getType() == Frame::TYPE_TEXTURE) { FrameData* frameData = frame->getMasterData(); frameData->setZoom(zoom_1); // textures are zoomed by input frame frame->setZoom(Zoom::NONE); } else { Zoom inputZoom; /* Output frames downscale pixel data during readback, and upscale it on * the input frame by setting the input frame's inherit zoom. */ if (zoom.x() > 1.0f) { inputZoom.x() = zoom_1.x(); zoom.x() = 1.f; } if (zoom.y() > 1.0f) { inputZoom.y() = zoom_1.y(); zoom.y() = 1.f; } FrameData* frameData = frame->getMasterData(); frameData->setZoom(inputZoom); frame->setZoom(zoom); } }