OHP3D.cpp
branchv_0
changeset 32 711d3d781143
parent 31 ed3caeea978a
child 33 4620bba4fa40
--- a/OHP3D.cpp	Wed Dec 27 12:11:27 2023 +0100
+++ b/OHP3D.cpp	Wed Dec 27 12:50:47 2023 +0100
@@ -563,6 +563,9 @@
 }
 
 void OHP3D::Impl::loadDocuments() {
+	if (cfg.documents.empty())
+		cfg.documents.push_back({getDefaultFile("documents/default.pdf")});
+
 	for (const Configuration::File& document : cfg.documents) {
 		std::cerr << "loading document: " << document.fileName.c_str() << "\n";
 
@@ -571,8 +574,8 @@
 		namespace pp = poppler;
 		using Document = pp::document;
 
-		std::shared_ptr<Document> doc = std::shared_ptr<Document>(
-				Document::load_from_raw_data(buffer.getData(), buffer.getSize()));
+		std::shared_ptr<Document> doc = std::shared_ptr<Document>(Document::
+				load_from_raw_data(buffer.getData(), buffer.getSize()));
 
 		log(LogLevel::INFO, std::string("PDF parsed:")
 				+ " pages=" + std::to_string(doc->pages()));
@@ -588,7 +591,7 @@
 
 			PageBuffer img(
 					pageImage.data(),
-					pageImage.bytes_per_row() * pageImage.height(),
+					pageImage.width() * pageImage.height() * 3,
 					pageImage.width(), pageImage.height());
 
 			textures.push_back(std::make_shared<Texture>(
@@ -610,7 +613,7 @@
 				<< " total = " << timingTotal << " µs ("
 				<< doc->pages() << " pages)";
 		log(LogLevel::INFO, timingMsg.str());
-		if (timingTotal < 400000) logOutput << ">>> Doherty threshold met! <<<\n";
+		if (timingTotal < 400000) logOutput << ">> Doherty threshold met! <<\n";
 	}
 }