mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.developing rainbow
git-svn-id: svn://ultimatepp.org/upp/trunk@3556 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0803e97b94
commit
be80807d50
10 changed files with 65 additions and 26 deletions
|
|
@ -39,6 +39,8 @@ Size GetScreenSize();
|
|||
|
||||
typedef ImageDraw SystemImageDraw;
|
||||
|
||||
void StdDrawImage(SystemDraw& w, int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color);
|
||||
|
||||
void DrawDragRect(SystemDraw& w, const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
|
||||
Color color, uint64 pattern);
|
||||
|
||||
|
|
@ -466,6 +468,7 @@ private:
|
|||
static bool mouseinview;
|
||||
static bool mouseinframe;
|
||||
static bool globalbackpaint;
|
||||
static bool globalbackbuffer;
|
||||
static bool painting;
|
||||
static int LoopLevel;
|
||||
static Ctrl *LoopCtrl;
|
||||
|
|
@ -1196,6 +1199,7 @@ public:
|
|||
|
||||
static void GlobalBackPaint(bool b = true);
|
||||
static void GlobalBackPaintHint();
|
||||
static void GlobalBackBuffer(bool b = true);
|
||||
|
||||
String Name() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ NAMESPACE_UPP
|
|||
#define LTIMING(x) // TIMING(x)
|
||||
|
||||
bool Ctrl::globalbackpaint;
|
||||
bool Ctrl::globalbackbuffer;
|
||||
|
||||
void Ctrl::RefreshFrame(const Rect& r) {
|
||||
GuiLock __;
|
||||
|
|
@ -468,6 +469,11 @@ void Ctrl::UpdateArea0(SystemDraw& draw, const Rect& clip, int backpaint)
|
|||
GuiLock __;
|
||||
LTIMING("UpdateArea");
|
||||
LLOG("========== UPDATE AREA " << UPP::Name(this) << " ==========");
|
||||
if(globalbackbuffer) {
|
||||
CtrlPaint(draw, clip);
|
||||
LLOG("========== END (TARGET IS BACKBUFFER)");
|
||||
return;
|
||||
}
|
||||
if(backpaint == FULLBACKPAINT || globalbackpaint && !hasdhctrl && !dynamic_cast<DHCtrl *>(this)) {
|
||||
ShowRepaintRect(draw, clip, LtRed());
|
||||
BackDraw bw;
|
||||
|
|
@ -657,4 +663,10 @@ void Ctrl::GlobalBackPaintHint()
|
|||
GlobalBackPaint();
|
||||
}
|
||||
|
||||
void Ctrl::GlobalBackBuffer(bool b)
|
||||
{
|
||||
GuiLock __;
|
||||
globalbackbuffer = b;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -145,6 +145,12 @@ void SystemDraw::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color col
|
|||
::LineTo(handle, x2, y2);
|
||||
}
|
||||
|
||||
void SystemDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color)
|
||||
{
|
||||
GuiLock __;
|
||||
StdDrawImage(*this, x, y, cx, cy, img, src, color);
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_WINCE
|
||||
|
||||
void SystemDraw::DrawPolyPolylineOp(const Point *vertices, int vertex_count,
|
||||
|
|
|
|||
|
|
@ -144,6 +144,12 @@ void SystemDraw::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color col
|
|||
x2 + actual_offset.x, y2 + actual_offset.y);
|
||||
}
|
||||
|
||||
void SystemDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color)
|
||||
{
|
||||
GuiLock __;
|
||||
StdDrawImage(*this, x, y, cx, cy, img, src, color);
|
||||
}
|
||||
|
||||
void SystemDraw::DrawPolyPolylineOp(const Point *vertices, int vertex_count,
|
||||
const int *counts, int count_count,
|
||||
int width, Color color, Color doxor)
|
||||
|
|
|
|||
|
|
@ -400,6 +400,15 @@ void ImageDraw::Init()
|
|||
has_alpha = false;
|
||||
}
|
||||
|
||||
Draw& ImageDraw::Alpha()
|
||||
{
|
||||
if(!has_alpha) {
|
||||
alpha.DrawRect(size, GrayColor(0));
|
||||
has_alpha = true;
|
||||
}
|
||||
return alpha;
|
||||
}
|
||||
|
||||
Image ImageDraw::Get(bool pm) const
|
||||
{
|
||||
ImageBuffer b(size);
|
||||
|
|
|
|||
|
|
@ -388,6 +388,15 @@ ImageDraw::~ImageDraw()
|
|||
XFreeGC(Xdisplay, alpha.gc);
|
||||
}
|
||||
|
||||
Draw& ImageDraw::Alpha()
|
||||
{
|
||||
if(!has_alpha) {
|
||||
alpha.DrawRect(size, GrayColor(0));
|
||||
has_alpha = true;
|
||||
}
|
||||
return alpha;
|
||||
}
|
||||
|
||||
Image X11Cursor(int c)
|
||||
{
|
||||
ImageBuffer b(32, 32);
|
||||
|
|
|
|||
|
|
@ -4,18 +4,17 @@ NAMESPACE_UPP
|
|||
|
||||
#define LTIMING(x)
|
||||
|
||||
void SystemDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color)
|
||||
void StdDrawImage(SystemDraw& w, int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color)
|
||||
{
|
||||
GuiLock __;
|
||||
LTIMING("DrawImageOp");
|
||||
bool tonative = !IsNative();
|
||||
bool tonative = !w.IsNative();
|
||||
if(tonative) {
|
||||
BeginNative();
|
||||
Native(x, y);
|
||||
Native(cx, cy);
|
||||
w.BeginNative();
|
||||
w.Native(x, y);
|
||||
w.Native(cx, cy);
|
||||
}
|
||||
Size sz = Size(cx, cy);
|
||||
if((cx > 2000 || cy > 1500) && IsNull(color) && IsPrinter()) {
|
||||
if((cx > 2000 || cy > 1500) && IsNull(color) && w.IsPrinter()) {
|
||||
int yy = 0;
|
||||
ImageRaster ir(img);
|
||||
RescaleImage rm;
|
||||
|
|
@ -25,29 +24,19 @@ void SystemDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& img, con
|
|||
ImageBuffer ib(cx, ccy);
|
||||
for(int q = 0; q < ccy; q++)
|
||||
rm.Get(ib[q]);
|
||||
DrawImageBandRLE(*this, x, y + yy, ib, 16);
|
||||
DrawImageBandRLE(w, x, y + yy, ib, 16);
|
||||
yy += ccy;
|
||||
}
|
||||
}
|
||||
else
|
||||
if(src.GetSize() == sz)
|
||||
img.PaintImage(*this, x, y, src, color);
|
||||
img.PaintImage(w, x, y, src, color);
|
||||
else {
|
||||
Image h = Rescale(img, Size(cx, cy), src);
|
||||
h.PaintImage(*this, x, y, h.GetSize(), color);
|
||||
h.PaintImage(w, x, y, h.GetSize(), color);
|
||||
}
|
||||
if(tonative)
|
||||
EndNative();
|
||||
}
|
||||
|
||||
|
||||
Draw& ImageDraw::Alpha()
|
||||
{
|
||||
if(!has_alpha) {
|
||||
alpha.DrawRect(size, GrayColor(0));
|
||||
has_alpha = true;
|
||||
}
|
||||
return alpha;
|
||||
w.EndNative();
|
||||
}
|
||||
|
||||
ImageBuffer::ImageBuffer(ImageDraw& iw)
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ public:
|
|||
Color ink = DefaultInk, const int *dx = NULL);
|
||||
|
||||
static void SinCos(int angle, double& sina, double& cosa);
|
||||
|
||||
|
||||
// deprecated:
|
||||
static void SetStdFont(Font font) { UPP::SetStdFont(font); }
|
||||
static Font GetStdFont() { return UPP::GetStdFont(); }
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@ public:
|
|||
operator RGBA*() { return pixels; }
|
||||
const RGBA *operator~() const { return pixels; }
|
||||
operator const RGBA*() const { return pixels; }
|
||||
RGBA *Begin() { return pixels; }
|
||||
const RGBA *Begin() const { return pixels; }
|
||||
RGBA *End() { return pixels + GetLength(); }
|
||||
const RGBA *End() const { return pixels + GetLength(); }
|
||||
|
||||
void Create(int cx, int cy);
|
||||
void Create(Size sz) { Create(sz.cx, sz.cy); }
|
||||
|
|
@ -187,10 +191,6 @@ private:
|
|||
friend class ImageBuffer;
|
||||
friend struct Data;
|
||||
|
||||
friend class SystemDraw;
|
||||
|
||||
void PaintImage(SystemDraw& w, int x, int y, const Rect& src, Color c) const;
|
||||
|
||||
friend void SetPaintOnly___(Image& m);
|
||||
friend void DrawImageBandRLE(Draw& w, int x, int y, const Image& m, int minp);
|
||||
friend void InstallSystemImage();
|
||||
|
|
@ -254,6 +254,7 @@ public:
|
|||
Image(ImageBuffer& b);
|
||||
~Image();
|
||||
|
||||
void PaintImage(SystemDraw& w, int x, int y, const Rect& src, Color c) const;
|
||||
|
||||
static Image Arrow();
|
||||
static Image Wait();
|
||||
|
|
|
|||
|
|
@ -357,5 +357,8 @@ private:
|
|||
enum { FILL = -1, CLIP = -2, ONPATH = -3 };
|
||||
|
||||
public:
|
||||
ImageBuffer& GetBuffer() { return ib; }
|
||||
const ImageBuffer& GetBuffer() const { return ib; }
|
||||
|
||||
BufferPainter(ImageBuffer& ib, int mode = MODE_ANTIALIASED);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue