35 #if defined(SHOW_CLIP_STACK_CHANGES)
36 static const char *clipstatestr(
AW_device *device) {
44 "clip_rect={t=%i, b=%i, l=%i, r=%i} "
45 "font_overlap={t=%i, b=%i, l=%i, r=%i} "
46 "scale=%f unscale=%f "
47 "offset={x=%f y=%f}" ,
48 clip_rect.
t, clip_rect.
b, clip_rect.
l, clip_rect.
r,
51 offset.
x(), offset.
y());
55 #endif // SHOW_CLIP_STACK_CHANGES
68 #if defined(SHOW_CLIP_STACK_CHANGES)
69 char *state_before_pop = strdup(clipstatestr(
this));
70 #endif // SHOW_CLIP_STACK_CHANGES
84 #if defined(SHOW_CLIP_STACK_CHANGES)
85 printf(
" pop_clip_scale: %s\n", state_before_pop);
86 printf(
" [after pop]: %s\n\n", clipstatestr(
this));
87 free(state_before_pop);
88 #endif // SHOW_CLIP_STACK_CHANGES
102 #if defined(SHOW_CLIP_STACK_CHANGES)
103 printf(
"push_clip_scale: %s\n", clipstatestr(
this));
104 #endif // SHOW_CLIP_STACK_CHANGES
115 bool inside_clipping_left =
true;
116 bool inside_clipping_right =
true;
124 if (!(
filter & filteri))
return 0;
136 if (Y0+font.
descent < clipRect.
t)
return 0;
139 if (Y0-font.
ascent < clipRect.
t)
return 0;
143 if (Y0-font.
ascent > clipRect.
b)
return 0;
146 if (Y0+font.
descent> clipRect.
b)
return 0;
153 const char *
const textBuf =
cstr;
154 #if defined(ASSERTION_USED)
164 X0 = X0-alignment*width;
166 if (X0 > clipRect.
r)
return 0;
173 int l = (
int)clipRect.
l;
174 if (xi + drawLen*font.
width < l)
return 0;
179 if (inside_clipping_left) {
180 if ((l-xi)%font.
width >0) h += 1;
182 if (h >= drawLen)
return 0;
187 if (drawLen < 0)
return 0;
193 for (h=0; xi < l; h++) {
194 if (!(c = textBuf[h]))
return 0;
197 if (!inside_clipping_left) {
204 if (drawLen < 0)
return 0;
212 int r = (
int)clipRect.
r - xi;
214 int h = r / font.
width;
216 if (inside_clipping_right) {
224 if (drawLen < 0)
return 0;
229 for (h = drawOff; r >= 0 && drawLen > 0; h++, drawLen--) {
232 drawLen = h - drawOff;
233 if (r <= 0 && inside_clipping_right && drawLen > 0) {
237 if (drawLen < 0)
return 0;
245 aw_assert(drawLen >= 0 && textBufLen >= drawLen);
246 aw_assert(textBufLen >= (drawOff+drawLen));
248 return toc(
this, gc, textBuf, drawOff, drawLen,
rtransform(tpos), cduser);
252 bool drawflag =
false;
255 for (
int n = 0; n<npos; ++n) {
256 drawflag |=
line(gc, pos[p], pos[n], filteri);
274 const int UMIN = INT_MIN/10;
275 const int UMAX = INT_MAX/10;
305 drawflag |= line_impl(gc, rect.
upper_edge(), filteri);
306 drawflag |= line_impl(gc, rect.
lower_edge(), filteri);
307 drawflag |= line_impl(gc, rect.
left_edge(), filteri);
308 drawflag |= line_impl(gc, rect.
right_edge(), filteri);
332 unscale = scale = 1.0;
358 unsigned long value_mask = GCLineWidth|GCLineStyle|GCCapStyle|GCJoinStyle;
364 if (gc) XFreeGC(
get_common()->get_display(), gc);
366 void AW_GC_Xm::wm_set_lineattributes(
short lwidth,
AW_linestyle lstyle) {
372 XSetLineAttributes(display, gc, lwidth, LineSolid, GC_DEFAULT_CAP_STYLE, GC_JOIN_STYLE);
377 static char dashes[] = { 5, 2 };
378 static char dots[] = { 1, 1 };
379 XSetDashes(display, gc, 0, lstyle ==
AW_DOTTED ? dots : dashes, 2);
380 XSetLineAttributes(display, gc, lwidth, LineOnOffDash, CapButt, GC_JOIN_STYLE);
388 XSetFunction(
get_common()->get_display(), gc, GXxor);
391 XSetFunction(
get_common()->get_display(), gc, GXcopy);
395 void AW_GC_Xm::wm_set_foreground_color(
AW_rgb col) {
396 XSetForeground(
get_common()->get_display(), gc, col);
406 return len * font_limits.
width;
421 for (
size_t i = 0; i<len; ++i) {
435 int new_count = gi+10;
439 if (gcs[gi])
delete gcs[gi];
483 unsigned int width, height;
484 unsigned int depth, borderwidth;
485 int x_offset, y_offset;
499 void AW_common_Xm::install_common_extends_cb(
AW_window *aww,
AW_area area) {
AW::Vector transform(const AW::Vector &vec) const
virtual void clear(AW_bitset filteri)
XID get_window_id() const
bool allow_left_font_overlap() const
bool allow_right_font_overlap() const
void set_resize_callback(AW_area area, const WindowCallback &wcb)
short get_width_of_char(char c) const
bool is_outside_clip(AW::Position pos) const
void set_grey_level(int gc, AW_grey_level grey_level)
const AW_screen_area & get_screen() const
int get_string_size(long textlen) const
const AW_screen_area & get_area_size() const
void set_line_attributes(short new_width, AW_linestyle new_style)
LineVector lower_edge() const
CONSTEXPR_INLINE unsigned char safeCharIndex(char c)
void set_screen_size(unsigned int width, unsigned int height)
void set_line_attributes(int gc, short width, AW_linestyle style)
void set_function(int gc, AW_function function)
void establish_default(int gc)
const AW_screen_area & get_cliprect() const
void set_font(AW_font font_nr, int size, int *found_size)
bool gc_mapable(int gc) const
virtual void clear_part(const AW::Rectangle &rect, AW_bitset filteri)
AW_GC * map_mod_gc(int gc)
const AW_font_overlap & get_font_overlap() const
AW::Vector get_offset() const
static const AW_screen_area & get_common_screen(const AW_common *common_)
bool generic_polygon(int gc, int npos, const AW::Position *pos, AW_bitset filteri)
void set_offset(const AW::Vector &off)
virtual int get_available_fontsizes(AW_font font_nr, int *available_sizes) const =0
void add_gc(int gi, AW_GC *agc)
char buffer[MESSAGE_BUFFERSIZE]
LineVector left_edge() const
const AW_font_limits & get_font_limits(int gc, char c) const
AW_GC_Xm(AW_common *common)
size_t get_length() const
void set_font(int gc, AW_font fontnr, int size, int *found_size)
void set_foreground_color(int gc, AW_color_idx color)
int get_string_size(int gc, long textlen) const
const double & ypos() const
AW_pos get_unscale() const
Display * get_display() const
void set_grey_level(AW_grey_level grey_level_)
const int GC_DEFAULT_CAP_STYLE
bool line(int gc, const AW::LineVector &Line, AW_bitset filteri=AW_ALL_DEVICES_SCALED)
AW::Vector rtransform(const AW::Vector &vec) const
bool generic_box(int gc, const AW::Rectangle &rect, AW_bitset filteri)
const AW_GC * map_gc(int gc) const
AW_grey_level get_grey_level() const
bool allow_bottom_font_overlap() const
AW_grey_level get_grey_level(int gc)
AW_common * get_common() const
GB_write_int const char GB_write_autoconv_string WRITE_SKELETON(write_pointer, GBDATA *,"%p", GB_write_pointer) char *AW_awa if)(!gb_var) return strdup("")
void ARB_recalloc(TYPE *&tgt, size_t oelem, size_t nelem)
virtual AW_DEVICE_TYPE type()=0
void set_font_overlap(bool allow)
bool generic_invisible(const AW::Position &pos, AW_bitset filteri)
static void AW_get_common_extends_cb(AW_window *, AW_common_Xm *common)
AW_clip_scale_stack * clip_scale_stack
const int GC_DEFAULT_LINE_STYLE
const AW_font_limits & get_font_limits(int gc, char c) const
void set_fg_color(AW_rgb col)
LineVector upper_edge() const
void set_cliprect(const AW_screen_area &rect)
bool is_monospaced() const
static const AW_screen_area & get_universe()
bool(* TextOverlayCallback)(AW_device *device, int gc, const char *textBuffer, size_t textStart, size_t textLen, const AW::Position &pos, AW_CL cduser)
const double & xpos() const
AW_function get_function() const
void set_function(AW_function mode)
void set_filter(AW_bitset filteri)
#define GC_DEFAULT_LINE_WIDTH
virtual void move_region(AW_pos src_x, AW_pos src_y, AW_pos width, AW_pos height, AW_pos dest_x, AW_pos dest_y)
const AW_font_limits & get_font_limits() const
bool ready_to_draw(int gc)
virtual AW_GC * create_gc()
LineVector right_edge() const
AW_common_Xm * get_common() const
int get_available_fontsizes(int gc, AW_font font_nr, int *available_sizes)
bool allow_top_font_overlap() const
bool text_overlay(int gc, const SizedCstr &cstr, const AW::Position &pos, AW_pos alignment, AW_bitset filteri, TextOverlayCallback toc, AW_CL cduser=0)