From 87bad2d9fa04f3abf0c9ffdaf1b6b91f2cfa946f Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 16 Jan 2009 00:04:17 +0000 Subject: [PATCH] DrawPainting printer support (banding) git-svn-id: svn://ultimatepp.org/upp/trunk@756 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Draw/Draw.cpp | 18 ++++++++++++++++-- uppsrc/Painter/PaintPainting.cpp | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/uppsrc/Draw/Draw.cpp b/uppsrc/Draw/Draw.cpp index 1ac228e83..793997ee6 100644 --- a/uppsrc/Draw/Draw.cpp +++ b/uppsrc/Draw/Draw.cpp @@ -345,9 +345,23 @@ void RegisterDrawPaintingFn(void (*fn)(ImageBuffer& ib, const Painting& pw, Size void Draw::DrawPaintingOp(const Rect& target, const Painting& pw) { - if(DrawPaintingFn) { - Size sz = target.GetSize(); + if(!DrawPaintingFn) + return; + Size sz = target.GetSize(); + if((sz.cx > 2000 || sz.cy > 1500) && IsPrinter()) { + int yy = 0; + while(yy < sz.cy) { + int ccy = min(sz.cy - yy, 100); + ImageBuffer ib(sz.cx, ccy); + Fill(~ib, RGBAZero(), ib.GetLength()); + DrawPaintingFn(ib, pw, sz, Point(0, yy)); + DrawImageBandRLE(*this, target.left, target.top + yy, ib, 16); + yy += ccy; + } + } + else { ImageBuffer ib(sz); + Fill(~ib, RGBAZero(), ib.GetLength()); DrawPaintingFn(ib, pw, sz, Point(0, 0)); DrawImage(target.left, target.top, ib); } diff --git a/uppsrc/Painter/PaintPainting.cpp b/uppsrc/Painter/PaintPainting.cpp index c4e84bb73..5ffdb76fd 100644 --- a/uppsrc/Painter/PaintPainting.cpp +++ b/uppsrc/Painter/PaintPainting.cpp @@ -227,8 +227,8 @@ void PaintImageBuffer(ImageBuffer& ib, const Painting& p, Size sz, Point pos) { BufferPainter sw(ib); Sizef psz = p.GetSize(); - sw.Scale(sz.cx / psz.cx, sz.cy / psz.cy); sw.Translate(-pos.x, -pos.y); + sw.Scale(sz.cx / psz.cx, sz.cy / psz.cy); sw.Paint(p); }