static void test_12_23() { const I a(1,2), b(2,3); BOOST_CHECK(!cerlt(a, b)); BOOST_CHECK(cerle(a, b)); BOOST_CHECK(!cergt(a, b)); BOOST_CHECK(!cerge(a, b)); BOOST_CHECK(!cerlt(b, a)); BOOST_CHECK(!cerle(b, a)); BOOST_CHECK(!cergt(b, a)); BOOST_CHECK(cerge(b, a)); BOOST_CHECK(poslt(a, b)); BOOST_CHECK(posle(a, b)); BOOST_CHECK(!posgt(a, b)); BOOST_CHECK(posge(a, b)); BOOST_CHECK(!poslt(b, a)); BOOST_CHECK(posle(b, a)); BOOST_CHECK(posgt(b, a)); BOOST_CHECK(posge(b, a)); BOOST_CHECK(!cereq(a, b)); BOOST_CHECK(!cerne(a, b)); BOOST_CHECK(poseq(a, b)); BOOST_CHECK(posne(a, b)); BOOST_CHECK(!cereq(b, a)); BOOST_CHECK(!cerne(b, a)); BOOST_CHECK(poseq(b, a)); BOOST_CHECK(posne(b, a)); }
static void test_13_24() { const I a(1,3), b(2,4); BOOST_CHECK(!cerlt(a, b)); BOOST_CHECK(!cerle(a, b)); BOOST_CHECK(!cergt(a, b)); BOOST_CHECK(!cerge(a, b)); BOOST_CHECK(!cerlt(b, a)); BOOST_CHECK(!cerle(b, a)); BOOST_CHECK(!cergt(b, a)); BOOST_CHECK(!cerge(b, a)); BOOST_CHECK(poslt(a, b)); BOOST_CHECK(posle(a, b)); BOOST_CHECK(posgt(a, b)); BOOST_CHECK(posge(a, b)); BOOST_CHECK(poslt(b, a)); BOOST_CHECK(posle(b, a)); BOOST_CHECK(posgt(b, a)); BOOST_CHECK(posge(b, a)); BOOST_CHECK(!cereq(a, b)); BOOST_CHECK(!cerne(a, b)); BOOST_CHECK(poseq(a, b)); BOOST_CHECK(posne(a, b)); BOOST_CHECK(!cereq(b, a)); BOOST_CHECK(!cerne(b, a)); BOOST_CHECK(poseq(b, a)); BOOST_CHECK(posne(b, a)); }
static void test_12_3() { const I a(1,2); const int b = 3; BOOST_CHECK(cerlt(a, b)); BOOST_CHECK(cerle(a, b)); BOOST_CHECK(!cergt(a, b)); BOOST_CHECK(!cerge(a, b)); BOOST_CHECK(!cerlt(b, a)); BOOST_CHECK(!cerle(b, a)); BOOST_CHECK(cergt(b, a)); BOOST_CHECK(cerge(b, a)); BOOST_CHECK(poslt(a, b)); BOOST_CHECK(posle(a, b)); BOOST_CHECK(!posgt(a, b)); BOOST_CHECK(!posge(a, b)); BOOST_CHECK(!poslt(b, a)); BOOST_CHECK(!posle(b, a)); BOOST_CHECK(posgt(b, a)); BOOST_CHECK(posge(b, a)); BOOST_CHECK(!cereq(a, b)); BOOST_CHECK(cerne(a, b)); BOOST_CHECK(!poseq(a, b)); BOOST_CHECK(posne(a, b)); BOOST_CHECK(!cereq(b, a)); BOOST_CHECK(cerne(b, a)); BOOST_CHECK(!poseq(b, a)); BOOST_CHECK(posne(b, a)); }
static void sel_drag(pos selpoint) { term.selected = true; if (!term.sel_rect) { /* * For normal selection, we set (sel_start,sel_end) to * (selpoint,sel_anchor) in some order. */ if (poslt(selpoint, term.sel_anchor)) { term.sel_start = selpoint; term.sel_end = term.sel_anchor; } else { term.sel_start = term.sel_anchor; term.sel_end = selpoint; } incpos(term.sel_end); sel_spread(); } else { /* * For rectangular selection, we may need to * interchange x and y coordinates (if the user has * dragged in the -x and +y directions, or vice versa). */ term.sel_start.x = min(term.sel_anchor.x, selpoint.x); term.sel_end.x = 1 + max(term.sel_anchor.x, selpoint.x); term.sel_start.y = min(term.sel_anchor.y, selpoint.y); term.sel_end.y = max(term.sel_anchor.y, selpoint.y); } }
static void test_12_3() { const I a(1,2); const int b = 3; BOOST_CHECK(cerlt(a, b)); BOOST_CHECK(cerle(a, b)); BOOST_CHECK(!cergt(a, b)); BOOST_CHECK(!cerge(a, b)); BOOST_CHECK(!cerlt(b, a)); BOOST_CHECK(!cerle(b, a)); BOOST_CHECK(cergt(b, a)); BOOST_CHECK(cerge(b, a)); BOOST_CHECK(poslt(a, b)); BOOST_CHECK(posle(a, b)); BOOST_CHECK(!posgt(a, b)); BOOST_CHECK(!posge(a, b)); BOOST_CHECK(!poslt(b, a)); BOOST_CHECK(!posle(b, a)); BOOST_CHECK(posgt(b, a)); BOOST_CHECK(posge(b, a)); BOOST_CHECK(!cereq(a, b)); BOOST_CHECK(cerne(a, b)); BOOST_CHECK(!poseq(a, b)); BOOST_CHECK(posne(a, b)); BOOST_CHECK(!cereq(b, a)); BOOST_CHECK(cerne(b, a)); BOOST_CHECK(!poseq(b, a)); BOOST_CHECK(posne(b, a)); # ifdef __BORLANDC__ ::detail::ignore_unused_variable_warning(a); ::detail::ignore_unused_variable_warning(b); # endif }
void winimg_paint(void) { imglist *img; imglist *prev = NULL; int left, top; int x, y; termchar *dchar; bool update_flag; HDC dc; RECT rc; /* free disk space if number of tempfile exceeds TEMPFILE_MAX_NUM */ while (tempfile_num > TEMPFILE_MAX_NUM && term.imgs.first) { img = term.imgs.first; term.imgs.first = term.imgs.first->next; winimg_destroy(img); } dc = GetDC(wnd); GetClientRect(wnd, &rc); IntersectClipRect(dc, rc.left + PADDING, rc.top + PADDING, rc.left + PADDING + term.cols * cell_width, rc.top + PADDING + term.rows * cell_height); for (img = term.imgs.first; img;) { // if the image is out of scrollback, collect it if (img->top + img->height - term.virtuallines < - term.sblines) { if (img == term.imgs.first) term.imgs.first = img->next; if (img == term.imgs.last) term.imgs.last = prev; if (prev) prev->next = img->next; prev = img; img = img->next; winimg_destroy(prev); } else { // if the image is scrolled out, serialize it into a temp file. left = img->left; top = img->top - term.virtuallines - term.disptop; if (top + img->height < 0 || top > term.rows) { winimg_hibernate(img); } else { // create DC handle if it is not initialized, or resume from hibernate winimg_lazyinit(img); for (y = max(0, top); y < min(top + img->height, term.rows); ++y) { int wide_factor = (term.displines[y]->lattr & LATTR_MODE) == LATTR_NORM ? 1: 2; for (x = left; x < min(left + img->width, term.cols); ++x) { dchar = &term.displines[y]->chars[x]; // if sixel image is overwirtten by characters, // exclude the area from the clipping rect. update_flag = false; if (dchar->chr != SIXELCH) update_flag = true; if (dchar->attr.attr & (TATTR_RESULT | TATTR_CURRESULT | TATTR_MARKED | TATTR_CURMARKED)) update_flag = true; if (term.selected && !update_flag) { pos scrpos = {y + term.disptop, x, false}; update_flag = term.sel_rect ? posPle(term.sel_start, scrpos) && posPlt(scrpos, term.sel_end) : posle(term.sel_start, scrpos) && poslt(scrpos, term.sel_end); } if (update_flag) ExcludeClipRect(dc, x * wide_factor * cell_width + PADDING, y * cell_height + PADDING, (x + 1) * wide_factor * cell_width + PADDING, (y + 1) * cell_height + PADDING); } } StretchBlt(dc, left * cell_width + PADDING, top * cell_height + PADDING, img->width * cell_width, img->height * cell_height, img->hdc, 0, 0, img->pixelwidth, img->pixelheight, SRCCOPY); } prev = img; img = img->next; } } ReleaseDC(wnd, dc); }