Пример #1
0
sk_sp<SkFlattenable> SkMergeImageFilter::CreateProc(SkReadBuffer& buffer) {
    Common common;
    if (!common.unflatten(buffer, -1)) {
        return nullptr;
    }

    const int count = common.inputCount();
    bool hasModes = buffer.readBool();
    if (hasModes) {
        SkAutoSTArray<4, SkXfermode::Mode> modes(count);
        SkAutoSTArray<4, uint8_t> modes8(count);
        if (!buffer.readByteArray(modes8.get(), count)) {
            return nullptr;
        }
        for (int i = 0; i < count; ++i) {
            modes[i] = (SkXfermode::Mode)modes8[i];
            buffer.validate(SkIsValidMode(modes[i]));
        }
        if (!buffer.isValid()) {
            return nullptr;
        }
        return Make(common.inputs(), count, modes.get(), &common.cropRect());
    }
    return Make(common.inputs(), count, nullptr, &common.cropRect());
}
Пример #2
0
int main()
{
    Make('i', 'i');
    Make('i', 'u');
    Make('u', 'i');
    Make('i', 'i');
}
Пример #3
0
TokenPtr SLScanner::ScanMinusOp()
{
    std::string spell;
    spell += TakeIt();

    if (Is('-'))
        return Make(Tokens::UnaryOp, spell, true);
    else if (Is('='))
        return Make(Tokens::AssignOp, spell, true);

    return Make(Tokens::BinaryOp, spell);
}
Пример #4
0
void Make(int p,int u,int v,int c){
	if (u==v) return;
	if (level[u]>level[v]){
		int k=g[father[u]][u];
		w[k][p]=max(w[k][p],cost[k]-c);
		Make(p,father[u],v,c);
	}else{
		int k=g[father[v]][v];
		w[k][p]=max(w[k][p],cost[k]-c);
		Make(p,u,father[v],c);
	}
}
Пример #5
0
void Make(long l, long r, Set& s) {
    if (l == r) {
        long t = s.Value();
        if (t > best)
            ID = l, best = t;
        return;
    }
    Set L, R;
    long mid = (l + r) >> 1;
    Add(s, L, l, mid);
    Add(s, R, mid + 1, r);
    Make(l, mid, R);
    Make(mid + 1, r, L);
}
Пример #6
0
static void MainLineIterate(typePos *Position)
    {
    int va, v2, cp;
    uint32 m;
    (Position->Dyn + 1)->move = MoveNone;
    Mobility(Position);
    if (!RobboTotalBaseScore(Position, &va))
        {
        if (VerboseRobboBases)
			{
			Send("info string Failure in MainLine\n");

#ifdef Log
			if (WriteLog)
				{
				log_file = fopen(log_filename, "a");
				fprintf(log_file, "info string Failure in MainLine\n");
				close_log();
				}
#endif
			}

        (Position->Dyn + 1)->move = MoveNone;
       Position->StackHeight = 0;
        return;
        }
    if (!RobboMove(Position, &m, &v2, &cp))
        {
        (Position->Dyn + 1)->move = MoveNone;
       Position->StackHeight = 0;
        return;
        }
    if (va == dDraw)
        {
       Position->StackHeight = 0;
        Make(Position, m);
       Position->StackHeight = 1;
        Undo(Position, m);
        return;
        }
    m &= 0x7fff;
   Position->StackHeight = 0;
    Make(Position, m);
   Position->StackHeight = 1;
    MainLineIterate(Position);
    Undo(Position, m);
   Position->StackHeight = 1;
    }
Пример #7
0
ArrayData* ProxyArray::SetInt(ArrayData* ad, int64_t k,
                                         const Variant& v, bool copy) {
  ad = copy ? Make(innerArr(ad)) : ad;
  auto r = innerArr(ad)->set(k, v, innerArr(ad)->hasMultipleRefs());
  assert(!copy);
  return reseatable(ad, r);
}
Пример #8
0
sk_sp<SkFlattenable> SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) {
    sk_sp<SkPicture> picture;
    SkRect cropRect;

    if (buffer.isCrossProcess() && SkPicture::PictureIOSecurityPrecautionsEnabled()) {
        buffer.validate(!buffer.readBool());
    } else {
        if (buffer.readBool()) {
            picture = SkPicture::MakeFromBuffer(buffer);
        }
    }
    buffer.readRect(&cropRect);
    PictureResolution pictureResolution;
    if (buffer.isVersionLT(SkReadBuffer::kPictureImageFilterResolution_Version)) {
        pictureResolution = kDeviceSpace_PictureResolution;
    } else {
        pictureResolution = (PictureResolution)buffer.readInt();
    }

    if (kLocalSpace_PictureResolution == pictureResolution) {
        //filterLevel is only serialized if pictureResolution is LocalSpace
        SkFilterQuality filterQuality;
        if (buffer.isVersionLT(SkReadBuffer::kPictureImageFilterLevel_Version)) {
            filterQuality = kLow_SkFilterQuality;
        } else {
            filterQuality = (SkFilterQuality)buffer.readInt();
        }
        return MakeForLocalSpace(picture, cropRect, filterQuality);
    }
    return Make(picture, cropRect);
}
sk_sp<SkFlattenable> SkMatrixConvolutionImageFilter::CreateProc(SkReadBuffer& buffer) {
    SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
    SkISize kernelSize;
    kernelSize.fWidth = buffer.readInt();
    kernelSize.fHeight = buffer.readInt();
    const int count = buffer.getArrayCount();

    const int64_t kernelArea = sk_64_mul(kernelSize.width(), kernelSize.height());
    if (!buffer.validate(kernelArea == count)) {
        return nullptr;
    }
    SkAutoSTArray<16, SkScalar> kernel(count);
    if (!buffer.readScalarArray(kernel.get(), count)) {
        return nullptr;
    }
    SkScalar gain = buffer.readScalar();
    SkScalar bias = buffer.readScalar();
    SkIPoint kernelOffset;
    kernelOffset.fX = buffer.readInt();
    kernelOffset.fY = buffer.readInt();
    TileMode tileMode = (TileMode)buffer.readInt();
    bool convolveAlpha = buffer.readBool();
    return Make(kernelSize, kernel.get(), gain, bias, kernelOffset, tileMode,
                convolveAlpha, common.getInput(0), &common.cropRect());
}
Пример #10
0
sk_sp<SkFlattenable> SkToSRGBColorFilter::CreateProc(SkReadBuffer& buffer) {
    auto data = buffer.readByteArrayAsData();
    if (data) {
        return Make(SkColorSpace::Deserialize(data->data(), data->size()));
    }
    return nullptr;
}
Пример #11
0
sk_sp<SkFont> SkFont::Testing_CreateFromPaint(const SkPaint& paint) {
    uint32_t flags = 0;
    if (paint.isVerticalText()) {
        flags |= kVertical_Flag;
    }
    if (paint.isEmbeddedBitmapText()) {
        flags |= kEmbeddedBitmaps_Flag;
    }
    if (paint.getFlags() & SkPaint::kGenA8FromLCD_Flag) {
        flags |= kGenA8FromLCD_Flag;
    }
    if (paint.isFakeBoldText()) {
        flags |= kEmbolden_Flag;
    }

    if (SkPaint::kFull_Hinting == paint.getHinting()) {
        flags |= kEnableByteCodeHints_Flag;
    }
    if (paint.isAutohinted()) {
        flags |= kEnableAutoHints_Flag;
    }
    if (paint.isSubpixelText() || paint.isLinearText()) {
        // this is our default
    } else {
        flags |= kUseNonlinearMetrics_Flag;
    }

    MaskType maskType = SkFont::kBW_MaskType;
    if (paint.isAntiAlias()) {
        maskType = paint.isLCDRenderText() ? kLCD_MaskType : kA8_MaskType;
    }

    return Make(sk_ref_sp(paint.getTypeface()), paint.getTextSize(), paint.getTextScaleX(),
                paint.getTextSkewX(), maskType, flags);
}
Пример #12
0
int cPath::NextStep(int *px,int *py,int *cx,int *cy)
{
	int move=CONTINUE;

	switch(dir)
	{
		case D_N:	(*py)-=STEP_LENGTH;						break;
		case D_S:	(*py)+=STEP_LENGTH;						break;
		case D_E:	(*px)+=STEP_LENGTH;						break;
		case D_O:	(*px)-=STEP_LENGTH;						break;
		case D_NE:(*py)-=STEP_LENGTH; (*px)+=STEP_LENGTH; break;
		case D_NO:(*py)-=STEP_LENGTH; (*px)-=STEP_LENGTH; break;
		case D_SE:(*py)+=STEP_LENGTH; (*px)+=STEP_LENGTH; break;
		case D_SO:(*py)+=STEP_LENGTH; (*px)-=STEP_LENGTH; break;
	}

	//Calculate next cell
	if( (((*px)%32)==0) && (((*py)%32)==0))
	{
		x = (*px)>>5; *cx = x;
		y = (*py)>>5; *cy = y;

		if((nxf==-1) && (nyf==-1))
		{
			move=NextCell();
		}
		else//if((nxf>=0) || (nyf>=0))
		{
			AStar->EndPathfinder();
			delete AStar;
			AStar = NULL;
			Make(world,*cx,*cy,nxf,nyf);
			//move=CONTINUE;
		}
	}
Пример #13
0
long int
rde_ot_intern2 (RDE_STATE p,
		const char* operator,
		Tcl_Obj* detail1,
		Tcl_Obj* detail2)
{
    long int id;
    Tcl_DString buf;

    TRACE (("rde_ot_intern2 (%p, '%s' %p = '%s', %p = '%s')", p, operator,
	    detail1, Tcl_GetString(detail1)
	    detail2, Tcl_GetString(detail2)));
    if (IsCached (p, detail1, &id)) {
	return id;
    }

    TRACE (("INTERNALIZE"));

    /* Create a list of operator + detail1 + detail2.
     * Using a DString.
     */

    Tcl_DStringInit (&buf);
    Tcl_DStringAppendElement (&buf, operator);
    Tcl_DStringAppendElement (&buf, Tcl_GetString (detail1));
    Tcl_DStringAppendElement (&buf, Tcl_GetString (detail2));

    id = Make (p, detail1, Tcl_DStringValue (&buf));

    Tcl_DStringFree (&buf);
    return id;
}
Пример #14
0
void CUniformResourceLocator::Copy( const CUniversalNamingConvention& source )
{
   ASSERT_VALID( this );

   Empty();

   ProtocolName = "file";
   MachineName  = source.ServerName;
   PathName     = source.ShareName;
   PathName    += "/";
   PathName    += source.PathName;

   /*
   ** Now go through PathName to make sure it has /'s instead of \'s
   */

   int location_of_slash = 0;

   while( location_of_slash < PathName.GetLength() )
   {
      if ( PathName[ location_of_slash ] == '\\' )
      {
         PathName.SetAt( location_of_slash, '/' );
      }

      location_of_slash++;
   }

   Make();
}
Пример #15
0
uint64 PERFD (typePOS* POSITION, int n)
{
  int i;
  uint64 TOTAL = 0, TIME;
  typeMoveList LM[256], *lm;
  DrawBoard (POSITION);
  TIME = GetClock();
  Mobility (POSITION);
  if (IN_CHECK)
    lm = EvasionMoves (POSITION, LM, 0xffffffffffffffff);
  else
    {
      lm = CaptureMoves (POSITION, LM, POSITION->OccupiedBW);
      lm = OrdinaryMoves (POSITION, lm);
    }
  for (i = 0; i < lm - LM; i++)
    {
      Make (POSITION, LM[i].move);
      Mobility (POSITION);
      if (!ILLEGAL)
	{
	  printf ("%s ",Notate (LM[i].move, STRING1[POSITION->cpu]));
	  PERFT (POSITION, n - 1);
	  TOTAL += CNT[n - 1];
	}
      Undo (POSITION, LM[i].move);
    }
  printf ("TOTAL %lld  moves %ld  time: %lld us\n",
	  TOTAL, lm - LM, GetClock() - TIME);
  return TOTAL;
}
Пример #16
0
TokenPtr Scanner::ScanNumber()
{
    if (!std::isdigit(UChr()))
        Error("expected digit");
    
    /* Take first number (literals like ".0" are not allowed) */
    std::string spell;

    const auto startChr = TakeIt();
    spell += startChr;

    /* Parse integer or floating-point number */
    auto type = Token::Types::IntLiteral;

    ScanDecimalLiteral(spell);

    if (Is('.'))
    {
        spell += TakeIt();
        
        if (std::isdigit(UChr()))
            ScanDecimalLiteral(spell);
        else
            Error("floating-point literals must have a decimal on both sides of the dot (e.g. '0.0' but not '0.' or '.0')");

        type = Token::Types::FloatLiteral;
    }

    if (std::isalpha(UChr()) || Is('.'))
        ErrorLetterInNumber();

    /* Create number token */
    return Make(type, spell);
}
Пример #17
0
int FbImportZip::Save(bool progress)
{
	m_id = m_database.Int(m_filename, wxT("SELECT id FROM archives WHERE file_name=?"));

	wxString sql = m_id ?
		wxT("UPDATE archives SET file_name=?,file_path=?,file_size=?,file_count=? WHERE id=?") :
		wxT("INSERT INTO archives(file_name,file_path,file_size,file_count,id) VALUES (?,?,?,?,?)") ;

	if (!m_id) m_id = - m_database.NewId(DB_NEW_ARCHIVE);

	{
		wxLongLong count = m_zip.GetTotalEntries();
		FbSQLite3Statement stmt = m_database.PrepareStatement(sql);
		stmt.Bind(1, m_filename);
		stmt.Bind(2, m_filepath);
		stmt.Bind(3, (wxLongLong)m_filesize);
		stmt.Bind(4, count);
		stmt.Bind(5, m_id);
		stmt.ExecuteUpdate();
	}

	Make(progress);

	return m_id;
}
Пример #18
0
int main(){
	int i,j,k;
	scanf("%d %d",&n,&m);
	memset(g,0,sizeof(g));
	memset(deg,0,sizeof(deg));
	for (i=0;i<n*m>>1;i++){
		scanf("%d %d",&j,&k);
		g[j][k]=g[k][j]=1;
		b[j][k]=b[k][j]=i+1;
		deg[j]++;
		deg[k]++;
	}
	memset(a,0,sizeof(a));
	Make();
	memset(from,-1,sizeof(from));
	k=0;
	for (i=1;i<=n;i++){
		memset(tag,0,sizeof(tag));
		if (dfs(i)) k++;
	}
	if (k<n) printf("NO\n");else{
		printf("YES\n");
		for (i=1;i<=n;i++) printf("%d\n",b[from[i]][i]);
	}
	return 0;
}
Пример #19
0
ArrayData*
ProxyArray::PlusEq(ArrayData* ad, const ArrayData* elems) {
  auto const ret = ad->hasMultipleRefs() ? Make(innerArr(ad))
                                         : asProxyArray(ad);
  auto r = ret->m_ad->plusEq(elems);
  return reseatable(ad, r);
}
Пример #20
0
StringData* StringData::Make(const char* data, size_t len, CopyStringMode) {
  if (UNLIKELY(len > StringData::MaxSize)) {
    throw_string_too_large(len);
  }

  return Make(StringSlice(data, len), CopyString);
}
Пример #21
0
ArrayData*
ProxyArray::RemoveInt(ArrayData* ad, int64_t k, bool copy) {
  ad = copy ? Make(innerArr(ad)) : ad;
  auto r = innerArr(ad)->remove(k, innerArr(ad)->hasMultipleRefs());
  assert(!copy);
  return reseatable(ad, r);
}
Пример #22
0
ArrayData*
ProxyArray::AppendWithRef(ArrayData* ad, const Variant& v, bool copy) {
  ad = copy ? Make(innerArr(ad)) : ad;
  auto r = innerArr(ad)->appendWithRef(v, innerArr(ad)->hasMultipleRefs());
  assert(!copy);
  return reseatable(ad, r);
}
Пример #23
0
ArrayData*
ProxyArray::LvalNew(ArrayData* ad, Variant*& ret, bool copy) {
  ad = copy ? Make(innerArr(ad)) : ad;
  auto r = innerArr(ad)->lvalNew(ret, innerArr(ad)->hasMultipleRefs());
  assert(!copy);
  return reseatable(ad, r);
}
Пример #24
0
ArrayData* ProxyArray::SetRefStr(ArrayData* ad, StringData* k,
                                            CVarRef v, bool copy) {
  ad = copy ? Make(innerArr(ad)) : ad;
  auto r = innerArr(ad)->setRef(k, v, innerArr(ad)->hasMultipleRefs());
  assert(!copy);
  return reseatable(ad, r);
}
Пример #25
0
sk_sp<SkFlattenable> SkTileImageFilter::CreateProc(SkReadBuffer& buffer) {
    SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
    SkRect src, dst;
    buffer.readRect(&src);
    buffer.readRect(&dst);
    return Make(src, dst, common.getInput(0));
}
void CPacketADMIN_ITEM_DELETE::Make(
	DWORD dwItemID)		/* [in] アイテムID */
{
	ARRAYDWORD adwItemID;

	adwItemID.Add (dwItemID);
	Make (&adwItemID);
}
Пример #27
0
TokenPtr GLSLScanner::ScanIdentifierOrKeyword(std::string&& spell)
{
    /* Scan reserved words */
    auto it = GLSLKeywords().find(spell);
    if (it != GLSLKeywords().end())
    {
        if (it->second == Token::Types::Reserved)
            Error(R_KeywordReservedForFutureUse(spell));
        else if (it->second == Token::Types::Unsupported)
            Error(R_KeywordNotSupportedYet(spell));
        else
            return Make(it->second, spell);
    }

    /* Return as identifier */
    return Make(Tokens::Ident, spell);
}
Пример #28
0
sk_sp<SkFlattenable> SkColorCubeFilter::CreateProc(SkReadBuffer& buffer) {
    int cubeDimension = buffer.readInt();
    auto cubeData(buffer.readByteArrayAsData());
    if (!buffer.validate(is_valid_3D_lut(cubeData.get(), cubeDimension))) {
        return nullptr;
    }
    return Make(std::move(cubeData), cubeDimension);
}
Пример #29
0
SkFlattenable* SkBlurDrawLooper::CreateProc(SkReadBuffer& buffer) {
    const SkColor color = buffer.readColor();
    const SkScalar sigma = buffer.readScalar();
    const SkScalar dx = buffer.readScalar();
    const SkScalar dy = buffer.readScalar();
    const uint32_t flags = buffer.read32();
    return Make(color, sigma, dx, dy, flags).release();
}
Пример #30
0
	void Entity::MakeCube(const std::string &pMeshName, Shader &pShader){
		Vector3F position[] = { Vector3F(-1.f,-1.f,-1.f), Vector3F(-1.f,-1.f,1.f), Vector3F(1.f,-1.f,1.f), Vector3F(1.f,-1.f,-1.f),
								Vector3F(-1.f,1.f,-1.f), Vector3F(-1.f,1.f,1.f), Vector3F(1.f,1.f,1.f), Vector3F(1.f,1.f,-1.f), 
								Vector3F(-1.f,-1.f,-1.f), Vector3F(-1.f,1.f,-1.f), Vector3F(1.f,1.f,-1.f), Vector3F(1.f,-1.f,-1.f),
								Vector3F(-1.f,-1.f,1.f), Vector3F(-1.f,1.f,1.f), Vector3F(1.f,1.f,1.f), Vector3F(1.f,-1.f,1.f), 
								Vector3F(-1.f,-1.f,-1.f), Vector3F(-1.f,-1.f,1.f), Vector3F(-1.f,1.f,1.f), Vector3F(-1.f,1.f,-1.f), 
								Vector3F(1.f,-1.f,-1.f), Vector3F(1.f,-1.f,1.f), Vector3F(1.f,1.f,1.f), Vector3F(1.f,1.f,-1.f)
							  };

		Index indices[] =	  { 0, 2, 1, 0, 3, 2, 
								4, 5, 6, 4, 6, 7,
								8, 9, 10, 8, 10, 11, 
								12, 15, 14, 12, 14, 13, 
								16, 17, 18, 16, 18, 19, 
								20, 23, 22, 20, 22, 21
							  };

		Vector2F texcoords[] = {Vector2F(1.f, 1.f), Vector2F(1.f, 0.f), Vector2F(0.f, 0.f), Vector2F(0.f, 1.f),
								Vector2F(1.f, 1.F), Vector2F(1.f, 0.f), Vector2F(0.f, 0.f), Vector2F(0.f, 1.f),
								Vector2F(1.f, 1.F), Vector2F(1.f, 0.f), Vector2F(0.f, 0.f), Vector2F(0.f, 1.f),
								Vector2F(1.f, 1.F), Vector2F(1.f, 0.f), Vector2F(0.f, 0.f), Vector2F(0.f, 1.f),
								Vector2F(1.f, 1.F), Vector2F(1.f, 0.f), Vector2F(0.f, 0.f), Vector2F(0.f, 1.f),
								Vector2F(1.f, 1.F), Vector2F(1.f, 0.f), Vector2F(0.f, 0.f), Vector2F(0.f, 1.f)
		};

		Vector3F normals[] = {	Vector3F::NEGUNIT_Y, Vector3F::NEGUNIT_Y, Vector3F::NEGUNIT_Y, Vector3F::NEGUNIT_Y,
								Vector3F::UNIT_Y, Vector3F::UNIT_Y, Vector3F::UNIT_Y, Vector3F::UNIT_Y, 
								Vector3F::NEGUNIT_Z, Vector3F::NEGUNIT_Z, Vector3F::NEGUNIT_Z, Vector3F::NEGUNIT_Z,
								Vector3F::UNIT_Z, Vector3F::UNIT_Z, Vector3F::UNIT_Z, Vector3F::UNIT_Z, 
								Vector3F::NEGUNIT_X, Vector3F::NEGUNIT_X, Vector3F::NEGUNIT_X, Vector3F::NEGUNIT_X,
								Vector3F::UNIT_X, Vector3F::UNIT_X, Vector3F::UNIT_X, Vector3F::UNIT_X 
							 };

		
		CreateVAO(pMeshName, pShader, position, sizeof(position), indices, sizeof(indices));

		switch(mType){
		case ET_MESH:
			Make(normals,texcoords);break;
		case ET_OBJECT:
			Make(normals);break;
		case ET_DEBUGOBJECT:
			Make(texcoords);break;
		}
	}