12 #ifndef ROOT_X11Buffer
13 #define ROOT_X11Buffer
18 #include <Cocoa/Cocoa.h>
46 friend class CommandBuffer;
53 Command(Drawable_t wid);
54 Command(Drawable_t wid,
const GCValues_t &gc);
57 virtual bool HasOperand(Drawable_t drawable)
const;
58 virtual bool IsGraphicsCommand()
const;
60 virtual void Execute()
const = 0;
61 virtual void Execute(CGContextRef )
const;
64 Command(
const Command &rhs);
65 Command &operator = (
const Command &rhs);
68 class DrawLine :
public Command {
74 DrawLine(Drawable_t wid,
const GCValues_t &gc,
const Point &p1,
const Point &p2);
76 bool IsGraphicsCommand()
const
82 class DrawSegments :
public Command {
84 std::vector<Segment_t> fSegments;
87 DrawSegments(Drawable_t wid,
const GCValues_t &gc,
const Segment_t *segments, Int_t nSegments);
89 bool IsGraphicsCommand()
const
95 class ClearArea :
public Command {
97 const Rectangle_t fArea;
100 ClearArea(Window_t wid,
const Rectangle_t &area);
102 bool IsGraphicsCommand()
const
108 class CopyArea :
public Command {
110 const Drawable_t fSrc;
111 const Rectangle_t fArea;
112 const Point fDstPoint;
115 CopyArea(Drawable_t src, Drawable_t dst,
const GCValues_t &gc,
const Rectangle_t &area,
const Point &dstPoint);
117 bool HasOperand(Drawable_t drawable)
const;
118 bool IsGraphicsCommand()
const
127 class DrawString :
public Command {
130 const std::string fText;
133 DrawString(Drawable_t wid,
const GCValues_t &gc,
const Point &point,
const std::string &text);
135 bool IsGraphicsCommand()
const
143 class FillRectangle :
public Command {
145 const Rectangle_t fRectangle;
148 FillRectangle(Drawable_t wid,
const GCValues_t &gc,
const Rectangle_t &rectangle);
150 bool IsGraphicsCommand()
const
158 class FillPolygon :
public Command {
160 std::vector<Point_t> fPolygon;
163 FillPolygon(Drawable_t wid,
const GCValues_t &gc,
const Point_t *points, Int_t nPoints);
165 bool IsGraphicsCommand()
const
173 class DrawRectangle :
public Command {
175 Rectangle_t fRectangle;
178 DrawRectangle(Drawable_t wid,
const GCValues_t &gc,
const Rectangle_t &rectangle);
180 bool IsGraphicsCommand()
const
188 class UpdateWindow :
public Command {
193 UpdateWindow(QuartzView *view);
195 bool IsGraphicsCommand()
const
203 class DeletePixmap :
public Command {
205 DeletePixmap(Pixmap_t pixmap);
210 class DrawBoxXor :
public Command {
216 DrawBoxXor(Window_t windowID,
const Point &p1,
const Point &p2);
219 void Execute(CGContextRef ctx)
const;
222 class DrawLineXor :
public Command {
228 DrawLineXor(Window_t windowID,
const Point &p1,
const Point &p2);
231 void Execute(CGContextRef ctx)
const;
234 class CommandBuffer {
236 CommandBuffer(
const CommandBuffer &rhs);
237 CommandBuffer &operator = (
const CommandBuffer &rhs);
239 std::vector<Command *> fCommands;
240 std::vector<QuartzView *> fViewBranch;
242 std::vector<Command *> fXorOps;
244 typedef std::vector<Command *>::size_type size_type;
249 void AddDrawLine(Drawable_t wid,
const GCValues_t &gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2);
250 void AddDrawSegments(Drawable_t wid,
const GCValues_t &gc,
const Segment_t *segments, Int_t nSegments);
251 void AddClearArea(Window_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h);
252 void AddCopyArea(Drawable_t src, Drawable_t dst,
const GCValues_t &gc, Int_t srcX, Int_t srcY, UInt_t width, UInt_t height, Int_t dstX, Int_t dstY);
253 void AddDrawString(Drawable_t wid,
const GCValues_t &gc, Int_t x, Int_t y,
const char *text, Int_t len);
254 void AddFillRectangle(Drawable_t wid,
const GCValues_t &gc, Int_t x, Int_t y, UInt_t w, UInt_t h);
255 void AddFillPolygon(Drawable_t wid,
const GCValues_t &gc,
const Point_t *polygon, Int_t nPoints);
256 void AddDrawRectangle(Drawable_t wid,
const GCValues_t &gc, Int_t x, Int_t y, UInt_t w, UInt_t h);
257 void AddUpdateWindow(QuartzView *view);
258 void AddDeletePixmap(Pixmap_t pixmap);
261 void AddDrawBoxXor(Window_t windowID, Int_t x1, Int_t y1, Int_t x2, Int_t y2);
262 void AddDrawLineXor(Window_t windowID, Int_t x1, Int_t y1, Int_t x2, Int_t y2);
264 void Flush(Details::CocoaPrivate *impl);
265 void FlushXOROps(Details::CocoaPrivate *impl);
266 void RemoveOperationsForDrawable(Drawable_t wid);
267 void RemoveGraphicsOperationsForWindow(Window_t wid);
268 void RemoveXORGraphicsOperationsForWindow(Window_t wid);
270 size_type BufferSize()
const
272 return fCommands.size();
275 void ClearCommands();
276 void ClearXOROperations();
287 : fX1(0), fY1(0), fX2(0), fY2(0)
291 WidgetRect(
int leftX,
int bottomY,
int rightX,
int topY)
292 : fX1(leftX), fY1(bottomY), fX2(rightX), fY2(topY)
297 void ClipOverlaps(QuartzView *view);
298 void BuildClipRegion(
const WidgetRect &rect);
300 std::vector<WidgetRect> fRectsToClip;
301 std::vector<CGRect> fClippedRegion;
302 std::vector<int> fXBounds;
303 std::vector<int> fYBounds;
304 std::vector<bool> fGrid;