mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-30 23:02:39 -06:00
CtrlCore, Draw: LinuxGl adjustments
git-svn-id: svn://ultimatepp.org/upp/trunk@6199 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
2763f89194
commit
c21ddc2d5e
9 changed files with 43 additions and 16 deletions
|
|
@ -582,7 +582,7 @@ private:
|
|||
Ctrl *FindBestOpaque(const Rect& clip);
|
||||
void UpdateArea0(SystemDraw& draw, const Rect& clip, int backpaint);
|
||||
void UpdateArea(SystemDraw& draw, const Rect& clip);
|
||||
Ctrl *GetTopRect(Rect& r, bool inframe);
|
||||
Ctrl *GetTopRect(Rect& r, bool inframe, bool clip = true);
|
||||
void DoSync(Ctrl *q, Rect r, bool inframe);
|
||||
bool HasDHCtrl() const;
|
||||
void SyncDHCtrl();
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ struct sDrawLevelCheck {
|
|||
#define LEVELCHECK(w, q)
|
||||
#define DOLEVELCHECK
|
||||
#endif
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {
|
||||
GuiLock __;
|
||||
LEVELCHECK(w, this);
|
||||
|
|
@ -272,7 +272,8 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {
|
|||
if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect))
|
||||
return;
|
||||
|
||||
glPushMatrix();
|
||||
w.PushContext();
|
||||
//glPushMatrix();
|
||||
ApplyTransform(TS_BEFORE_CTRL_PAINT);
|
||||
|
||||
Ctrl *q;
|
||||
|
|
@ -338,7 +339,8 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {
|
|||
}
|
||||
|
||||
ApplyTransform(TS_AFTER_CTRL_PAINT);
|
||||
glPopMatrix();
|
||||
//glPopMatrix();
|
||||
w.PopContext();
|
||||
}
|
||||
#else
|
||||
void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {
|
||||
|
|
@ -639,16 +641,17 @@ void Ctrl::RemoveFullRefresh()
|
|||
q->RemoveFullRefresh();
|
||||
}
|
||||
|
||||
Ctrl *Ctrl::GetTopRect(Rect& r, bool inframe)
|
||||
Ctrl *Ctrl::GetTopRect(Rect& r, bool inframe, bool clip)
|
||||
{
|
||||
GuiLock __;
|
||||
if(!inframe) {
|
||||
r &= Rect(GetSize());
|
||||
if(clip)
|
||||
r &= Rect(GetSize());
|
||||
r.Offset(GetView().TopLeft());
|
||||
}
|
||||
if(parent) {
|
||||
r.Offset(GetRect().TopLeft());
|
||||
return parent->GetTopRect(r, InFrame());
|
||||
return parent->GetTopRect(r, InFrame(), clip);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ Image Ctrl::DispatchMouse(int e, Point p, int zd) {
|
|||
|
||||
Image Ctrl::DispatchMouseEvent(int e, Point p, int zd) {
|
||||
GuiLock __;
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
if(!IsEnabled() && this != (Ctrl*) &infoPanel)
|
||||
return Image::Arrow();
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void ChDraw(Draw& w, int x, int y, int cx, int cy, const Image& img, const Rect
|
|||
{
|
||||
LTIMING("ChDraw");
|
||||
if(cx > 0 && cy > 0) {
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
w.DrawImage(x, y, cx, cy, img, src);
|
||||
#else
|
||||
ChImageMaker m;
|
||||
|
|
@ -253,7 +253,11 @@ Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op)
|
|||
}
|
||||
if(op == LOOK_PAINT || op == LOOK_PAINTEDGE) {
|
||||
LTIMING("ChPaint Image");
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
w.Offset(r.TopLeft());
|
||||
#else
|
||||
w.Clipoff(r);
|
||||
#endif
|
||||
Rect sr(p, p2);
|
||||
Size sz2(isz.cx - sr.right, isz.cy - sr.bottom);
|
||||
Rect r = RectC(p.x, p.y, sz.cx - sr.left - sz2.cx, sz.cy - sr.top - sz2.cy);
|
||||
|
|
@ -274,7 +278,7 @@ Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op)
|
|||
ChDraw(w, r.right, p.y, sz2.cx, r.Height(), img,
|
||||
RectC(sr.right, p.y, sz2.cx, sr.Height()));
|
||||
if(op == LOOK_PAINT) {
|
||||
if(IsNull(r) || IsNull(sr)) {
|
||||
if(IsNull(r) || IsNull(sr)) {
|
||||
w.End();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -284,7 +288,7 @@ Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op)
|
|||
Size sz;
|
||||
sz.cx = (tile & 1 ? sr : r).GetWidth();
|
||||
sz.cy = (tile & 2 ? sr : r).GetHeight();
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
DrawTiles(w, r, img, sz, sr);
|
||||
#else
|
||||
img = Rescale(img, sz, sr);
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ void AddRefreshRect(Vector<Rect>& invalid, const Rect& _r);
|
|||
void DrawRect(Draw& w, const Rect& rect, const Image& img, bool ralgn = false); //??? TODO
|
||||
void DrawRect(Draw& w, int x, int y, int cx, int cy, const Image& img, bool ra = false);
|
||||
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
void DrawTiles(Draw& w, int x, int y, int cx, int cy, const Image& img, const Size& isz, const Rect& src);
|
||||
void DrawTiles(Draw& w, const Rect& rect, const Image& img, const Size& isz, const Rect& src);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ NAMESPACE_UPP
|
|||
#include <WinGl/FontGl.h>
|
||||
#include <WinGl/ResGl.h>
|
||||
#endif
|
||||
#ifdef flagLINUXGL
|
||||
#include <LinuxGl/FontGl.h>
|
||||
#include <LinuxGl/ResGl.h>
|
||||
#endif
|
||||
|
||||
#define LLOG(x) // LOG(x)
|
||||
#define LTIMING(x) // TIMING(x)
|
||||
|
|
@ -31,7 +35,7 @@ WString TextUnicode(const char *s, int n, byte cs, Font font)
|
|||
void Draw::DrawText(int x, int y, int angle, const wchar *text, Font font,
|
||||
Color ink, int n, const int *dx)
|
||||
{
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
if(IsNull(ink))
|
||||
return;
|
||||
DrawTextOp(x, y, angle, text, font, ink, n, dx);
|
||||
|
|
@ -221,7 +225,7 @@ void Draw::DrawText(int x, int y, const String& text, Font font, Color ink, cons
|
|||
|
||||
Size GetTextSize(const wchar *text, Font font, int n)
|
||||
{
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
return GetTextSize(text, resources.GetFont(font), n);
|
||||
#else
|
||||
FontInfo fi = font.Info();
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ void DrawRect(Draw& w, const Rect& rect, const Image& img, bool ralgn)
|
|||
DrawRect(w, rect.left, rect.top, rect.Width(), rect.Height(), img, ralgn);
|
||||
}
|
||||
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL) || defined(flagLINUXGL)
|
||||
void DrawTiles(Draw& w, int x, int y, int cx, int cy, const Image& img, const Size& isz, const Rect& src) {
|
||||
w.Clip(x, y, cx, cy);
|
||||
Size sz = isz;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ void Font::InitStdFont()
|
|||
int height = 0;
|
||||
GetStdFontSys(name, height);
|
||||
#ifdef PLATFORM_WIN32
|
||||
#ifdef flagWINGL
|
||||
#if defined(flagWINGL)
|
||||
AStdFont = Font(FindFaceNameIndex("Tahoma"), 12);
|
||||
#else
|
||||
int q = FindFaceNameIndex(name);
|
||||
|
|
|
|||
|
|
@ -179,6 +179,21 @@ CommonFontInfo GetFontInfoSys(Font font)
|
|||
|
||||
GlyphInfo (*GetGlyphInfoSysXft)(Font font, int chr);
|
||||
|
||||
#ifdef flagLINUXGL
|
||||
#include <LinuxGl/FontGl.h>
|
||||
#include <LinuxGl/ResGl.h>
|
||||
GlyphInfo GetGlyphInfoSys(Font font, int chr)
|
||||
{
|
||||
static GlyphInfo gi;
|
||||
const OpenGLFont& fi = resources.GetFont(font);
|
||||
gi.width = chr < fi.chars.GetCount()
|
||||
? int(fi.chars[chr].xadvance * fi.scale + 0.5f)
|
||||
: 0;
|
||||
gi.lspc = 0;
|
||||
gi.rspc = 0;
|
||||
return gi;
|
||||
}
|
||||
#else
|
||||
GlyphInfo GetGlyphInfoSys(Font font, int chr)
|
||||
{
|
||||
LTIMING("GetGlyphInfoSys");
|
||||
|
|
@ -207,6 +222,7 @@ GlyphInfo GetGlyphInfoSys(Font font, int chr)
|
|||
}
|
||||
return gi;
|
||||
}
|
||||
#endif
|
||||
|
||||
Vector<FaceInfo> GetAllFacesSys()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue