Draw: SDraw::PaintOnly now optional (fixes #676, #678)

git-svn-id: svn://ultimatepp.org/upp/trunk@6867 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-02-04 18:57:52 +00:00
parent 1a3e8d464e
commit f0bdfa2fef
5 changed files with 22 additions and 5 deletions

View file

@ -24,7 +24,9 @@ struct scImageMaker : LRUCache<Image>::Maker {
bool paintonly;
virtual String Key() const {
return m->Key();
String s = m->Key();
s.Cat(paintonly ? '1' : '0');
return s;
}
virtual int Make(Image& object) const {
object = m->Make();

View file

@ -33,6 +33,8 @@ private:
void operator<<=(const Cloff& b) { clip <<= b.clip; offset = b.offset; }
};
bool paintonly;
Array<Cloff> cloff;
Color docolor;
@ -47,6 +49,10 @@ public:
void Init(const Rect& r);
void Init(const Vector<Rect>& rs, int height, Point offset = Point(0, 0));
void PaintOnly() { paintonly = true; }
SDraw() { paintonly = false; }
};
class SImageDraw1 : public SDraw {

View file

@ -4,7 +4,8 @@ NAMESPACE_UPP
void SDraw::PutImage(Point p, const Image& img, const Rect& src, Color color)
{
PutImage(p, CachedSetColorKeepAlphaPaintOnly(img, color), src);
PutImage(p, (paintonly ? CachedSetColorKeepAlphaPaintOnly : CachedSetColorKeepAlpha)
(img, color), src);
}
void SDraw::SysDrawImageOp(int x, int y, const Image& img, const Rect& src, Color color)

View file

@ -59,14 +59,22 @@ void SDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Co
if(font.GetHeight() > 200) {
int bn = font[g.chr] + font.GetLineHeight();
for(g.yy = 0; g.yy < bn; g.yy += 32) {
Image m = MakeImagePaintOnly(g);
Image m;
if(paintonly)
m = MakeImagePaintOnly(g);
else
m = MakeImage(g);
Point h = m.GetHotSpot();
SysDrawImageOp(x - h.x, y + g.yy - h.y, m, m.GetSize(), ink);
}
}
else {
g.yy = Null;
Image m = MakeImagePaintOnly(g);
Image m;
if(paintonly)
m = MakeImagePaintOnly(g);
else
m = MakeImage(g);
Point h = m.GetHotSpot();
SysDrawImageOp(x - h.x, y - h.y, m, m.GetSize(), ink);
}

View file

@ -89,7 +89,7 @@ public:
bool CanSetSurface() { return false; }
static void Flush() {}
SystemDraw() { pos = Point(0, 0); }
SystemDraw() { pos = Point(0, 0); PaintOnly(); }
};
struct BackDraw__ : public SystemDraw {