* some small code cleanup
* followed Rene' sugestion and constrain the clipping region, still we only get the "user" visible view region drawn, so there might be an other problem git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24687 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <PrintJob.h>
|
#include <PrintJob.h>
|
||||||
|
#include <Region.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
@@ -353,18 +354,13 @@ BPrintJob::ConfigJob()
|
|||||||
void
|
void
|
||||||
BPrintJob::BeginJob()
|
BPrintJob::BeginJob()
|
||||||
{
|
{
|
||||||
if (fSpoolFile != NULL) {
|
// can not start a new job until it has been commited or cancelled
|
||||||
// can not start a new job until it has been commited or cancelled
|
if (fSpoolFile != NULL || fCurrentPageHeader == NULL)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (fCurrentPageHeader == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fSetupMessage == NULL) {
|
// TODO show alert, setup message is required
|
||||||
// TODO show alert, setup message is required
|
if (fSetupMessage == NULL)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// create spool file
|
// create spool file
|
||||||
BPath path;
|
BPath path;
|
||||||
@@ -383,7 +379,6 @@ BPrintJob::BeginJob()
|
|||||||
_GetMangledName(mangledName, B_FILE_NAME_LENGTH);
|
_GetMangledName(mangledName, B_FILE_NAME_LENGTH);
|
||||||
|
|
||||||
path.Append(mangledName);
|
path.Append(mangledName);
|
||||||
|
|
||||||
if (path.InitCheck() != B_OK)
|
if (path.InitCheck() != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -398,13 +393,13 @@ BPrintJob::BeginJob()
|
|||||||
|
|
||||||
// add print_file_header
|
// add print_file_header
|
||||||
// page_count is updated in CommitJob()
|
// page_count is updated in CommitJob()
|
||||||
|
// on BeOS R5 the offset to the first page was always -1
|
||||||
fCurrentHeader.version = 1 << 16;
|
fCurrentHeader.version = 1 << 16;
|
||||||
fCurrentHeader.page_count = 0;
|
fCurrentHeader.page_count = 0;
|
||||||
// on BeOS R5 the offset to the first page
|
|
||||||
// was always -1.
|
|
||||||
fCurrentHeader.first_page = (off_t)-1;
|
fCurrentHeader.first_page = (off_t)-1;
|
||||||
|
|
||||||
if (fSpoolFile->Write(&fCurrentHeader, sizeof(fCurrentHeader)) != sizeof(fCurrentHeader)) {
|
if (fSpoolFile->Write(&fCurrentHeader, sizeof(print_file_header))
|
||||||
|
!= sizeof(print_file_header)) {
|
||||||
CancelJob();
|
CancelJob();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -658,10 +653,14 @@ BPrintJob::_RecurseView(BView *view, BPoint origin, BPicture *picture,
|
|||||||
{
|
{
|
||||||
ASSERT(picture != NULL);
|
ASSERT(picture != NULL);
|
||||||
|
|
||||||
|
BRegion region;
|
||||||
|
region.Set(BRect(rect.left, rect.top, rect.right, rect.bottom));
|
||||||
|
|
||||||
view->AppendToPicture(picture);
|
view->AppendToPicture(picture);
|
||||||
view->f_is_printing = true;
|
view->f_is_printing = true;
|
||||||
view->PushState();
|
view->PushState();
|
||||||
view->SetOrigin(origin);
|
view->SetOrigin(origin);
|
||||||
|
view->ConstrainClippingRegion(®ion);
|
||||||
view->Draw(rect);
|
view->Draw(rect);
|
||||||
view->PopState();
|
view->PopState();
|
||||||
view->f_is_printing = false;
|
view->f_is_printing = false;
|
||||||
@@ -682,6 +681,7 @@ BPrintJob::_RecurseView(BView *view, BPoint origin, BPicture *picture,
|
|||||||
view->f_is_printing = true;
|
view->f_is_printing = true;
|
||||||
view->PushState();
|
view->PushState();
|
||||||
view->SetOrigin(origin);
|
view->SetOrigin(origin);
|
||||||
|
view->ConstrainClippingRegion(®ion);
|
||||||
view->DrawAfterChildren(rect);
|
view->DrawAfterChildren(rect);
|
||||||
view->PopState();
|
view->PopState();
|
||||||
view->f_is_printing = false;
|
view->f_is_printing = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user