Exemplo n.º 1
0
void
acism_destroy(ac_trie_t *psp)
{
	if (!psp) return;
	if (psp->flags & IS_MMAP)
		munmap((char*)psp->tranv - sizeof(ac_trie_t),
				sizeof(ac_trie_t) + p_size(psp));
	else free(psp->tranv);
	free(psp);
}
Exemplo n.º 2
0
//--------------|---------------------------------------------
void
acism_dump(ACISM const* psp, PS_DUMP_TYPE pdt, FILE *out, MEMREF const*pattv)
{
    int i, empty;
    char charv[256];
    int symdist[257] = {};
    for (i = 256; --i >=0;) charv[psp->symv[i]] = i;

    if (pdt & PS_STATS) {
        for (i = psp->tran_size, empty = 0; --i >= 0;) {
            if (psp->tranv[i]) {
                ++symdist[t_sym(psp, psp->tranv[i])];
            } else ++empty;
        }
        fprintf(out, "strs:%zu syms:%zu chars:%zu "
                     "trans:%d empty:%d mod:%d hash:%d size:%lu\n",
                psp->nstrs, psp->nsyms, psp->nchars,
                psp->tran_size, empty, psp->hash_mod, psp->hash_size,
                (long)sizeof(ACISM) + p_size(psp));
    }

    if (pdt & PS_TRAN) {
        fprintf(out, "==== TRAN:\n%8s %8s Ch MS %8s\n", "Cell", "State", "Next");
        for (i = 1; i < (int)psp->tran_size; ++i) {
            fprintf(out, "%8d %8d ", i, i - t_sym(psp, psp->tranv[i]));
            printrans(psp, i, charv, out, pattv);
        }
    }

    if (pdt & PS_HASH) {
        fprintf(out, "==== HASH:\n.....: state strno\n");
        for (i = 0; i < (int)psp->hash_size; ++i) {
            STATE state = psp->hashv[i].state;
            if (state)
                fprintf(out, "%5d: %7"FX"u %3d %8"FX"u %.*s\n",
                        i, state, i - p_hash(psp, state), 
                        PSTR(psp, psp->hashv[i].strno, pattv));
            else
                fprintf(out, "%5d: %7"FX"d --- %8"FX"d\n", i, state,
                        psp->hashv[i].strno);
        }
    }

    if (pdt & PS_TREE) {
        fprintf(out, "==== TREE:\n");
        char str[psp->maxlen + 1];
        printree(psp, 0, 0, str, charv, out, pattv);
    }
    //TODO: calculate stats: backref chain lengths ...
}
Exemplo n.º 3
0
void MainView::resizeContent(const QSize &s)
{
    QSizeF l_size(s);
    QSizeF p_size(l_size.height(), l_size.width());
    bool portrait = (m_angle%90 == 0) && (m_angle%180 != 0);
    if (portrait) {
        m_mainWidget->resize(p_size);
        m_backGround->resize(p_size);
    }
    else {
        m_mainWidget->resize(l_size);
        m_backGround->resize(l_size);
    }
    m_menu->setPos(m_topBar->getStatusBarLocation());
    setSceneRect(QRectF(m_mainWidget->pos(), m_mainWidget->size()));
}
Exemplo n.º 4
0
/*
 * Define the known paper sizes.
 *
 * The values are taken from the H-P manual and are in 1/300" units,
 * but the structure values are in centipoints (1/7200").
 */
#define p_size(t, n, w, h, offp, offl)                                  \
    { (t), (n), { (w) * 24L, (h) * 24L, (offp) * 24L, (offl) * 24L } }

static struct {
    uint                    tag;
    const char *            pname;
    pcl_paper_size_t        psize;
} paper_sizes[] = {
    p_size(  1, "executive", 2175, 3150, 75, 60),
    p_size(  2, "letter",    2550, 3300, 75, 60),
    p_size(  3, "legal",     2550, 4200, 75, 60),
    p_size(  6, "ledger",    3300, 5100, 75, 60),
    p_size( 26, "a4",        2480, 3507, 71, 59),
    p_size( 27, "a3",        3507, 4960, 71, 59),
    p_size( 80, "monarch",   1162, 2250, 75, 60),
    p_size( 81, "com_10",    1237, 2850, 75, 60),
    p_size( 90, "dl",        1299, 2598, 71, 59),
    p_size( 91, "c5",        1913, 2704, 71, 59),
    p_size(100, "b5",        2078, 2952, 71, 59)
};

/*
 * Reset all parameters which must be reset whenever the logical page
 * orientation changes.
Exemplo n.º 5
0
void Iwa_TiledParticlesFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri)
{
	std::vector<int> lastframe;
	std::vector<TLevelP> partLevel;

	TPointD p_offset;
	TDimension p_size(0, 0);

	/*- 参照画像ポートの取得 -*/
	std::vector<TRasterFxPort *> part_ports;   /*- テクスチャ素材画像のポート -*/
	std::map<int, TRasterFxPort *> ctrl_ports; /*- コントロール画像のポート番号/ポート -*/
	int portsCount = this->getInputPortCount();

	for (int i = 0; i < portsCount; ++i) {
		std::string tmpName = this->getInputPortName(i);
		QString portName = QString::fromStdString(tmpName);

		if (portName.startsWith("T")) {
			TRasterFxPort *tmpPart = (TRasterFxPort *)this->getInputPort(tmpName);
			if (tmpPart->isConnected())
				part_ports.push_back((TRasterFxPort *)this->getInputPort(tmpName));
		} else {
			portName.replace(QString("Control"), QString(""));
			TRasterFxPort *tmpCtrl = (TRasterFxPort *)this->getInputPort(tmpName);
			if (tmpCtrl->isConnected())
				ctrl_ports[portName.toInt()] = (TRasterFxPort *)this->getInputPort(tmpName);
		}
	}

	/*- テクスチャ素材のバウンディングボックスを足し合わせる ←この工程、いらないかも?-*/
	if (!part_ports.empty()) {
		TRectD outTileBBox(tile.m_pos, TDimensionD(tile.getRaster()->getLx(), tile.getRaster()->getLy()));
		TRectD bbox;

		for (unsigned int i = 0; i < (int)part_ports.size(); ++i) {
			const TFxTimeRegion &tr = (*part_ports[i])->getTimeRegion();

			lastframe.push_back(tr.getLastFrame() + 1);
			partLevel.push_back(new TLevel());
			partLevel[i]->setName((*part_ports[i])->getAlias(0, ri));

			// The particles offset must be calculated without considering the affine's translational
			// component
			TRenderSettings riZero(ri);
			riZero.m_affine.a13 = riZero.m_affine.a23 = 0;

			// Calculate the bboxes union
			for (int t = 0; t <= tr.getLastFrame(); ++t) {
				TRectD inputBox;
				(*part_ports[i])->getBBox(t, inputBox, riZero);
				bbox += inputBox;
			}
		}

		if (bbox == TConsts::infiniteRectD)
			bbox *= outTileBBox;

		p_size.lx = (int)bbox.getLx() + 1;
		p_size.ly = (int)bbox.getLy() + 1;
		p_offset = TPointD(0.5 * (bbox.x0 + bbox.x1), 0.5 * (bbox.y0 + bbox.y1));
	} else {
		partLevel.push_back(new TLevel());
		partLevel[0]->setName("particles");
		TDimension vecsize(10, 10);
		TOfflineGL *offlineGlContext = new TOfflineGL(vecsize);
		offlineGlContext->clear(TPixel32(0, 0, 0, 0));

		TStroke *stroke;
		stroke = makeEllipticStroke(0.07, TPointD((vecsize.lx - 1) * .5, (vecsize.ly - 1) * .5), 2.0, 2.0);
		TVectorImageP vectmp = new TVectorImage();

		TPalette *plt = new TPalette();
		vectmp->setPalette(plt);
		vectmp->addStroke(stroke);
		TVectorRenderData rd(AffI, TRect(vecsize), plt, 0, true, true);
		offlineGlContext->makeCurrent();
		offlineGlContext->draw(vectmp, rd);

		partLevel[0]->setFrame(0, TRasterImageP(offlineGlContext->getRaster()->clone()));
		p_size.lx = vecsize.lx + 1;
		p_size.ly = vecsize.ly + 1;
		lastframe.push_back(1);

		delete offlineGlContext;
	}

	Iwa_Particles_Engine myEngine(this, frame);

	// Retrieving the dpi multiplier from the accumulated affine (which is isotropic). That is,
	// the affine will be applied *before* this effect - and we'll multiply geometrical parameters
	// by this dpi mult. in order to compensate.
	float dpi = sqrt(fabs(ri.m_affine.det())) * 100;

	TTile tileIn;
	if (TRaster32P raster32 = tile.getRaster()) {
		TFlash *flash = 0;
		myEngine.render_particles(flash, &tile, part_ports, ri, p_size, p_offset, ctrl_ports, partLevel,
								  1, (int)frame, 1, 0, 0, 0, 0, lastframe, getIdentifier());
	} else if (TRaster64P raster64 = tile.getRaster()) {
		TFlash *flash = 0;
		myEngine.render_particles(flash, &tile, part_ports, ri, p_size, p_offset, ctrl_ports, partLevel,
								  1, (int)frame, 1, 0, 0, 0, 0, lastframe, getIdentifier());
	} else
		throw TException("ParticlesFx: unsupported Pixel Type");
}