void pipeline_base::order_before(pipeline_base & other) { if (get_node_map()->find_authority() == other.get_node_map()->find_authority()) { tpie::log_debug() << "Ignoring pipeline ordering hint since node maps are already shared" << std::endl; return; } runtime rt1(get_node_map()->find_authority()); runtime rt2(other.get_node_map()->find_authority()); std::vector<node *> mySinks; std::vector<node *> otherSources; rt1.get_item_sinks(mySinks); rt2.get_item_sources(otherSources); if (mySinks.size() == 0) { throw tpie::exception("pipeline::order_before: mySinks is empty"); } if (otherSources.size() == 0) { throw tpie::exception("pipeline::order_before: otherSources is empty"); } for (size_t i = 0; i < otherSources.size(); ++i) { for (size_t j = 0; j < mySinks.size(); ++j) { otherSources[i]->add_dependency(*mySinks[j]); } } }
CRect CPlotDlg::DrawAxis(CDC *pDC, CAxis *pax) { int width, height, axHeight, axWidth; CPen pen; COLORREF orgCol; POINT org; CRect rt; GetClientRect(hDlg, &rt); pen.CreatePen(PS_SOLID, 1, pax->colorAx); pDC->SelectObject(&pen); width = (rt.right-rt.left); height= rt.bottom-rt.top; org.x = (int)((double)rt.left + (double)width*pax->pos.x0+.5); org.y = (int)((double)rt.bottom - (double)height*pax->pos.y0+.5); axWidth = (int)((double)width*pax->pos.width+.5); axHeight = (int)((double)height*pax->pos.height+.5); CRect rt2(org.x, org.y-axHeight, org.x+axWidth, org.y); orgCol = pDC->GetBkColor(); CRect rctAx(org, CPoint(org.x+axWidth, org.y-axHeight)); pDC->SolidFill(gca->colorBack, rctAx); pDC->MoveTo(org); pDC->LineTo(org.x, org.y-axHeight); pDC->LineTo(org.x+axWidth, org.y-axHeight); pDC->LineTo(org.x+axWidth, org.y); pDC->LineTo(org); pDC->SetBkColor(orgCol); pax->axRect = rt2; return rt2; }
void odt_set_font(const ustring & directory, const ustring & fontname) // Writes the font to the right files in the directory given. { // Save the font in the content file. ReadText rt2(odt_content_xml_filename(directory), true, false); for (unsigned int i = 0; i < rt2.lines.size(); i++) { replace_text(rt2.lines[i], "Bitstream", fontname); } write_lines(odt_content_xml_filename(directory), rt2.lines); }
static void test_homo_copy_assign () { rw_info (0, __FILE__, __LINE__, "copy assignment operator (homogenous tuples)"); const std::tuple<> et1 = std::tuple<> (); std::tuple<> et2; et2 = et1; _RWSTD_UNUSED (et2); int i = std::rand (); const std::tuple<int> it1 (i); std::tuple<int> it2; it2 = it1; test (__LINE__, it2, i); // copy assignment ill-formed for constant element types const std::tuple<int&> rt1 (i); int j = -1; // outside range of rand() std::tuple<int&> rt2 (j); // note, different reference rt2 = rt1; test (__LINE__, rt2, i); std::tuple<std::tuple<int> > nt1 (it1); std::tuple<std::tuple<int> > nt2; nt2 = nt1; test (__LINE__, nt2, it1); const std::tuple<long, const char*> pt1 (long (i), "string"); std::tuple<long, const char*> pt2; pt2 = pt1; test (__LINE__, pt2, long (i), (const char*) "string"); const UserDefined ud (i); const std::tuple<UserDefined> ut1 (ud); std::tuple<UserDefined> ut2; UserDefined::reset (); ut2 = ut1; ++UserDefined::expect.copy_asgn; test (__LINE__, ut2, ud); const std::tuple<bool, char, int, double, void*, UserDefined> bt1 (true, 'a', i, 3.14159, (void* const) &i, ud); ++UserDefined::expect.copy_ctor; std::tuple<bool, char, int, double, void*, UserDefined> bt2; ++UserDefined::expect.dflt_ctor; bt2 = bt1; ++UserDefined::expect.copy_asgn; test (__LINE__, bt2, true, 'a', i, 3.14159, (void* const) &i, ud); }
static void test_homo_copy_ctor () { rw_info (0, __FILE__, __LINE__, "copy constructor (homogenous tuples)"); std::tuple<> et1, et2 (et1); _RWSTD_UNUSED (et2); const int ci = std::rand (); const std::tuple<int> it1 (ci); std::tuple<int> it2 (it1); test (__LINE__, it2, ci); const std::tuple<const int>& ct1 = it1; // same as copy ctor std::tuple<const int> ct2 (ct1); test (__LINE__, ct2, ci); int i = ci; const std::tuple<int&> rt1 (i); std::tuple<int&> rt2 (rt1); test (__LINE__, rt2, ci); const std::tuple<std::tuple<int> > nt1 (it1); std::tuple<std::tuple<int> > nt2 (nt1); test (__LINE__, nt2, it1); const std::tuple<long, const char*> pt1 (1234567890L, "string"); std::tuple<long, const char*> pt2 (pt1); test (__LINE__, pt2, 1234567890L, (const char*) "string"); UserDefined ud (ci); const std::tuple<UserDefined> ut1 (ud); UserDefined::reset (); std::tuple<UserDefined> ut2 (ut1); ++UserDefined::expect.copy_ctor; test (__LINE__, ut2, ud); const std::tuple<bool, char, int, double, void*, UserDefined> bt1 (true, 'a', ci, 3.14159, (void* const) &i, ud); ++UserDefined::expect.move_ctor; // moved ud to bt1 std::tuple<bool, char, int, double, void*, UserDefined> bt2 (bt1); ++UserDefined::expect.copy_ctor; // copied to bt2 test (__LINE__, bt2, true, 'a', ci, 3.14159, (void* const) &i, ud); }
virtual void on_draw() { struct font_type { const agg::int8u* font; const char* name; } fonts[] = { { agg::gse4x6, "gse4x6" }, { agg::gse4x8, "gse4x8" }, { agg::gse5x7, "gse5x7" }, { agg::gse5x9, "gse5x9" }, { agg::gse6x9, "gse6x9" }, { agg::gse6x12, "gse6x12" }, { agg::gse7x11, "gse7x11" }, { agg::gse7x11_bold, "gse7x11_bold" }, { agg::gse7x15, "gse7x15" }, { agg::gse7x15_bold, "gse7x15_bold" }, { agg::gse8x16, "gse8x16" }, { agg::gse8x16_bold, "gse8x16_bold" }, { agg::mcs11_prop, "mcs11_prop" }, { agg::mcs11_prop_condensed, "mcs11_prop_condensed" }, { agg::mcs12_prop, "mcs12_prop" }, { agg::mcs13_prop, "mcs13_prop" }, { agg::mcs5x10_mono, "mcs5x10_mono" }, { agg::mcs5x11_mono, "mcs5x11_mono" }, { agg::mcs6x10_mono, "mcs6x10_mono" }, { agg::mcs6x11_mono, "mcs6x11_mono" }, { agg::mcs7x12_mono_high, "mcs7x12_mono_high" }, { agg::mcs7x12_mono_low, "mcs7x12_mono_low" }, { agg::verdana12, "verdana12" }, { agg::verdana12_bold, "verdana12_bold" }, { agg::verdana13, "verdana13" }, { agg::verdana13_bold, "verdana13_bold" }, { agg::verdana14, "verdana14" }, { agg::verdana14_bold, "verdana14_bold" }, { agg::verdana16, "verdana16" }, { agg::verdana16_bold, "verdana16_bold" }, { agg::verdana17, "verdana17" }, { agg::verdana17_bold, "verdana17_bold" }, { agg::verdana18, "verdana18" }, { agg::verdana18_bold, "verdana18_bold" }, 0, 0 }; glyph_gen glyph(0); pixfmt pixf(rbuf_window()); ren_base rb(pixf); rb.clear(agg::rgba(1,1,1)); agg::renderer_raster_htext_solid<ren_base, glyph_gen> rt(rb, glyph); int i; double y = 5; rt.color(agg::rgba(0,0,0)); for(i = 0; fonts[i].font; i++) { char buf[100]; strcpy(buf, "A quick brown fox jumps over the lazy dog 0123456789: "); strcat(buf, fonts[i].name); // Testing "wide-char" unsigned wbuf[100]; unsigned* wp = wbuf; const char* p = buf; while(*p) *wp++ = *(unsigned char*)p++; *wp++ = 0; glyph.font(fonts[i].font); rt.render_text(5, y, wbuf, !flip_y()); y += glyph.height() + 1; } // Rendering raster text with a custom span generator, gradient typedef agg::span_interpolator_linear<> interpolator_type; typedef agg::span_allocator<agg::rgba8> span_alloc_type; typedef agg::span_gradient<agg::rgba8, interpolator_type, gradient_sine_repeat_adaptor<agg::gradient_circle>, agg::gradient_linear_color<agg::rgba8> > span_gen_type; typedef agg::renderer_scanline_aa<ren_base, span_alloc_type, span_gen_type> ren_type; agg::trans_affine mtx; gradient_sine_repeat_adaptor<agg::gradient_circle> grad_func; grad_func.periods(5); agg::gradient_linear_color<agg::rgba8> color_func; color_func.colors(agg::rgba(1.0,0,0), agg::rgba(0,0.5,0)); interpolator_type inter(mtx); span_alloc_type sa; span_gen_type sg(inter, grad_func, color_func, 0, 150.0); ren_type ren(rb, sa, sg); agg::renderer_raster_htext<ren_type, glyph_gen> rt2(ren, glyph); rt2.render_text(5, 465, (unsigned char*)"RADIAL REPEATING GRADIENT: A quick brown fox jumps over the lazy dog", !flip_y()); }