mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
CtrlCore: Cocoa ImageDraw::operator Image now const
git-svn-id: svn://ultimatepp.org/upp/trunk@15015 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9723fc1a24
commit
4d6f29602e
6 changed files with 19 additions and 11 deletions
|
|
@ -95,9 +95,9 @@ class ImageDraw : public SystemDraw {
|
|||
public:
|
||||
Draw& Alpha();
|
||||
|
||||
operator Image();
|
||||
operator Image() const;
|
||||
|
||||
Image GetStraight();
|
||||
Image GetStraight() const;
|
||||
|
||||
ImageDraw(Size sz);
|
||||
ImageDraw(int cx, int cy);
|
||||
|
|
|
|||
|
|
@ -331,26 +331,30 @@ ImageDraw::~ImageDraw()
|
|||
handle = NULL; // avoid releasing invalid handle in ~SystemDraw
|
||||
}
|
||||
|
||||
Image ImageDraw::GetStraight()
|
||||
Image ImageDraw::GetStraight() const
|
||||
{
|
||||
ImageBuffer ib2(ib.GetSize());
|
||||
memcpy_t(~ib2, ~ib, ib.GetLength());
|
||||
if(alpha) {
|
||||
RGBA *e = ib.End();
|
||||
RGBA *t = ib;
|
||||
RGBA *s = alpha->ib;
|
||||
RGBA *e = ib2.End();
|
||||
RGBA *t = ib2;
|
||||
const RGBA *s = alpha->ib;
|
||||
while(t < e) {
|
||||
t->a = s->r;
|
||||
s++;
|
||||
t++;
|
||||
}
|
||||
}
|
||||
return Image(ib);
|
||||
return Image(ib2);
|
||||
}
|
||||
|
||||
ImageDraw::operator Image()
|
||||
ImageDraw::operator Image() const
|
||||
{
|
||||
if(alpha)
|
||||
return Premultiply(GetStraight());
|
||||
return Image(ib);
|
||||
ImageBuffer ib2(ib.GetSize());
|
||||
memcpy_t(~ib2, ~ib, ib.GetLength());
|
||||
return Image(ib2);
|
||||
}
|
||||
|
||||
Image GetIconForFile(const char *path)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
NSEvent *sCurrentMouseEvent__; // needed for drag operation
|
||||
|
||||
#define LLOG(x) // DLOG(x)
|
||||
#define LLOG(x) DLOG(x)
|
||||
|
||||
static Upp::Point coco_mouse_pos;
|
||||
static bool coco_mouse_left;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
#define LLOG(x) // DLOG(x)
|
||||
#define LLOG(x) DLOG(x)
|
||||
|
||||
Ptr<Ctrl> Ctrl::eventCtrl;
|
||||
Ptr<Ctrl> Ctrl::mouseCtrl;
|
||||
|
|
|
|||
|
|
@ -1682,6 +1682,7 @@ void ArrayCtrl::ClickSel(dword flags)
|
|||
|
||||
void ArrayCtrl::LeftDown(Point p, dword flags)
|
||||
{
|
||||
DLOG("ArrayCtrl " << p);
|
||||
if(IsReadOnly()) return;
|
||||
int q = header.GetSplit(p.x);
|
||||
if(q >= 0) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ Point DisplayPopup::Op(Point p)
|
|||
|
||||
void DisplayPopup::LeftDown(Point p, dword flags)
|
||||
{
|
||||
DDUMP(p);
|
||||
DDUMP(Op(p));
|
||||
DDUMP(Upp::Name(ctrl));
|
||||
ctrl->LeftDown(Op(p), flags);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue