From 0e5c628ce84f905e4e67c5de6bc3047315ca18d2 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Tue, 4 Nov 2008 12:57:58 +0100 Subject: [PATCH] Bugfix: Import of PDF pages. Two bugs in one: 1) XObjects obviously don't interpret their contents relative to the default state of a page, hence the state must be synchronized before the operation. 2) The global Kernel::THE_DEFAULT_STATE was initialized before Lang::THE_BLACK, causing THE_DEFAULT_STATE to behave as if colors were void. --- source/globals.cc | 6 +++++- source/pdfimport.cc | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/globals.cc b/source/globals.cc index 68763b97..7fb0b6a6 100644 --- a/source/globals.cc +++ b/source/globals.cc @@ -33,7 +33,6 @@ Kernel::Import Kernel::thePDFImporter; Kernel::DebugLog Kernel::theDebugLog; Kernel::TeXLabelManager Kernel::theTeXLabelManager; RefCountPtr< const Kernel::GraphicsState > Kernel::THE_NO_STATE = NullPtr< const Kernel::GraphicsState >( ); -RefCountPtr< const Kernel::GraphicsState > Kernel::THE_DEFAULT_STATE( new Kernel::GraphicsState( true ) ); RefCountPtr< const Lang::Function > Kernel::THE_NO_FUNCTION = NullPtr< const Lang::Function >( ); Concrete::Length Computation::the_arcdelta( 0.1 ); /* that is, 0.1bp */ @@ -114,6 +113,11 @@ Lang::Transform3D Lang::THE_3D_IDENTITY( 1, 0, 0, 0, 0, 1, Concrete::ZERO_LENGTH, Concrete::ZERO_LENGTH, Concrete::ZERO_LENGTH ); +/* + * Be sure to initiate this after globals that it relies on! + */ +RefCountPtr< const Kernel::GraphicsState > Kernel::THE_DEFAULT_STATE( new Kernel::GraphicsState( true ) ); + void Shapes::Kernel::registerGlobals( Kernel::Environment * env ) diff --git a/source/pdfimport.cc b/source/pdfimport.cc index 9dda748b..0978af89 100644 --- a/source/pdfimport.cc +++ b/source/pdfimport.cc @@ -86,7 +86,7 @@ Kernel::Import::addPagesAsXObjects( RefCountPtr< PDF_in > pdfi ) bboxpath->close( ); RefCountPtr< PDF_Object > indirection = SimplePDF::indirect( newObj, & Kernel::theIndirectObjectCount ); - res->push_back( RefCountPtr< Lang::XObject >( new Lang::XObject( indirection, RefCountPtr< const Lang::ElementaryPath2D >( bboxpath ) ) ) ); + res->push_back( RefCountPtr< Lang::XObject >( new Lang::XObject( indirection, RefCountPtr< const Lang::ElementaryPath2D >( bboxpath ), Kernel::THE_DEFAULT_STATE ) ) ); } return RefCountPtr< const std::vector< RefCountPtr< const Lang::XObject > > >( res ); } -- 2.11.4.GIT