Beispiel #1
0
TEST_F(LUATest, testTextureDefinition)
{
	TextureDefinition small("small");
	ASSERT_FALSE(small.getMap().empty()) << "no texture definitions for small found";
	TextureDefinition big("big");
	ASSERT_FALSE(big.getMap().empty()) << "no texture definitions for big found";
}
int main()
{
	int t;
	scanf("%d", &t);
	sieve();
	long long int ans;
	while(t--)
	{
		int n;
		ans = 1;
		scanf("%d", &n);
		if(n==0)
		{
			printf("0\n");
			continue;
		}
		for(int i=0;i<pc;i++)
		{
			if(prime[i] > n)
				break;
			ans *= small(prime[i], log_func(n, prime[i]));
			ans %= MOD;
		}
		printf("%lld\n",ans);
	}
 	return 0;
}
    void object::test<6>()
    {
        geos::geom::Envelope empty;
        geos::geom::Envelope small(-1, 1, -1, 1);
        geos::geom::Envelope big(-5, 5, -5, 5);

        ensure( empty.isNull() );
        ensure( !small.isNull() );
        ensure( !big.isNull() );

        // Test empty envelope by reference
        ensure( "empty envelope is not empty!", !empty.contains( small ) );
        ensure( "empty envelope is not empty!", !small.contains( empty ) );

        // Test empty envelope by pointer
        ensure( "empty envelope is not empty!", !empty.contains( &small ) );
        ensure( "empty envelope is not empty!", !small.contains( &empty ) );

        // Test non-empty envelope by reference
        ensure( !small.contains( big ) );
        ensure( big.contains( small ) );

        // Test raw point
        ensure( small.contains( 0, 0 ) );
        ensure( small.contains( -1, -1 ) );
        ensure( !small.contains( 5, 5 ) );

        // Test coordinate
        geos::geom::Coordinate origin(0, 0, 0);

        ensure_equals( origin.x, 0 );
        ensure_equals( origin.y, 0 );
        ensure_equals( origin.z, 0 );
        ensure( small.contains( origin ) );
    }
Beispiel #4
0
 ListNode* partition(ListNode* head, int x)
 {
     if (head == NULL)
     {
         return NULL;
     }
     ListNode small(0);
     ListNode big(0);
     ListNode* smaller = &small;
     ListNode* bigger = &big;
     while (head)
     {
         if (head->val < x)
         {
             smaller->next = head;
             head = head->next;
             smaller = smaller->next;
         }
         else
         {
             bigger->next = head;
             head = head->next;
             bigger = bigger->next;
         }
     }
     bigger->next = NULL;
     smaller->next = big.next;
     return small.next;
 }
Beispiel #5
0
/** Constructor */
MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, std::string msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId), mMsgId(msgId), mIsHome(isHome)
{
  /* Invoke the Qt Designer generated object setup routine */
  setupUi(this);

  setAttribute ( Qt::WA_DeleteOnClose, true );

  /* general ones */
  connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
  connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
  //connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );

  /* specific ones */
  connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
  connect( deleteButton, SIGNAL( clicked( void ) ), this, SLOT( deleteMsg ( void ) ) );
  connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyMsg ( void ) ) );

  connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));

  small();
  updateItemStatic();
  updateItem();
  updateAvatar(QString::fromStdString(mPeerId));
}
Beispiel #6
0
qreal Rest::mag() const
      {
      qreal m = staff()->mag();
      if (small())
            m *= score()->styleD(StyleIdx::smallNoteMag);
      return m;
      }
Beispiel #7
0
TEST_F(LUATest, testTextureDefinition)
{
	TextureDefinition small("small");
	ASSERT_FALSE(small.getMap().empty()) << "no texture definitions for small found";
	TextureDefinition big("big");
	ASSERT_FALSE(big.getMap().empty()) << "no texture definitions for big found";
	{
		const TextureDef& td = big.getTextureDef("bones");
		ASSERT_EQ(td.id, "bones");
		ASSERT_EQ(td.textureName, "cavepacker-ui-small");
		ASSERT_FALSE(td.mirror);
		ASSERT_DOUBLE_EQ(td.texcoords.x0, 0.494140625);
		ASSERT_DOUBLE_EQ(td.texcoords.y0, 0.244140625);
		ASSERT_DOUBLE_EQ(td.texcoords.x1, 0.2392578125);
		ASSERT_DOUBLE_EQ(td.texcoords.y1, 0.0400390625);
		ASSERT_EQ(td.trim.trimmedWidth, 245);
		ASSERT_EQ(td.trim.trimmedHeight, 41);
		ASSERT_EQ(td.trim.untrimmedWidth, 245);
		ASSERT_EQ(td.trim.untrimmedHeight, 41);
		ASSERT_EQ(td.trim.trimmedOffsetX, 0);
		ASSERT_EQ(td.trim.trimmedOffsetY, 0);
	}
	{
		const TextureDef& td = big.getTextureDef("gri-campaign");
		ASSERT_EQ(td.id, "gri-campaign");
		ASSERT_EQ(td.textureName, "cavepacker-ui-small");
		ASSERT_FALSE(td.mirror);
	}
}
Beispiel #8
0
bool
ConstitutiveModel::applyThermalStrain(unsigned qp,
                                      SymmTensor & strain_increment,
                                      SymmTensor & d_strain_dT)
{
  if (_has_temp && _t_step != 0)
  {
    Real inc_thermal_strain;
    Real d_thermal_strain_d_temp;

    Real old_temp;
    if (_t_step == 1 && _has_stress_free_temp)
      old_temp = _stress_free_temp;
    else
      old_temp = _temperature_old[qp];

    Real current_temp = _temperature[qp];

    Real delta_t = current_temp - old_temp;

    Real alpha = _alpha;

    if (_alpha_function)
    {
      Point p;
      Real alpha_current_temp = _alpha_function->value(current_temp,p);
      Real alpha_old_temp = _alpha_function->value(old_temp,p);

      if (_mean_alpha_function)
      {
        Real small(1e-6);

        Real numerator = alpha_current_temp * (current_temp - _ref_temp) - alpha_old_temp * (old_temp - _ref_temp);
        Real denominator = 1.0 + alpha_old_temp * (old_temp - _ref_temp);
        if (denominator < small)
          mooseError("Denominator too small in thermal strain calculation");
        inc_thermal_strain = numerator / denominator;
        d_thermal_strain_d_temp = alpha_current_temp * (current_temp - _ref_temp);
      }
      else
      {
        inc_thermal_strain = delta_t * 0.5 * (alpha_current_temp + alpha_old_temp);
        d_thermal_strain_d_temp = alpha_current_temp;
      }
    }
    else
    {
      inc_thermal_strain = delta_t * alpha;
      d_thermal_strain_d_temp = alpha;
    }

    strain_increment.addDiag(-inc_thermal_strain);
    d_strain_dT.addDiag(-d_thermal_strain_d_temp);

  }

  bool modified = true;
  return modified;
}
Beispiel #9
0
int gcd(int a, int b){
	int i,gcd;
	for(i=1;i<small(a,b)+1;i++){
		if(a%i==0 && b%i==0)
			gcd=i;
	}
	return gcd;
}
Beispiel #10
0
void Grnn::Trainer::setDefaultParameters()
{
    error_ = mse;
    tolerance_ = 0.0001;
    minBandwidth_ = small();
    maxBandwidth_ = 5.0;
    maxIter_ = 100;
}
Beispiel #11
0
QVariant ChordRest::getProperty(P_ID propertyId) const
      {
      switch(propertyId) {
            case P_ID::SMALL:      return QVariant(small());
            case P_ID::BEAM_MODE:  return int(beamMode());
            case P_ID::STAFF_MOVE: return staffMove();
            default:               return DurationElement::getProperty(propertyId);
            }
      }
Beispiel #12
0
QVariant Clef::getProperty(P_ID propertyId) const
      {
      switch(propertyId) {
            case P_ID::SHOW_COURTESY: return showCourtesy();
            case P_ID::SMALL:         return small();
            default:
                  return Element::getProperty(propertyId);
            }
      }
Beispiel #13
0
    TEST( Builder, String1 ) {
        const char * big = "eliot was here";
        StringData small( big, 5 );
        ASSERT_EQUALS( small, "eliot" );

        BufBuilder bb;
        bb.appendStr( small );

        ASSERT_EQUALS( 0, strcmp( bb.buf(), "eliot" ) );
        ASSERT_EQUALS( 0, strcmp( "eliot", bb.buf() ) );
    }
    bool search(vector<int>& nums, int target) {
        if(nums.size() == 0)
            return false;
        int m = nums.back();
        int j = nums.size() - 1;

        
        // 找到最左边比nums[0]大的
        while(j >= 0 && nums[j] <= m)
            j--;
        // 33112
        // 划分成左右大小数组
        if(j >= 0)
        {
            vector<int> big(nums.begin(),nums.begin() + j + 1);
            vector<int> small(nums.begin() + j + 1,nums.end());
            return binSearch(big,target) || binSearch(small,target);
        }

        // 333333
        // 从左到右找比nums[0]小的,划分成两个数组
        j = 0;
        while(j < nums.size() && nums[j] >= nums[0])
            j++;
        if(j == nums.size())
        {
            // 找不到,说明数组有序
            return binSearch(nums,target);
        }
        else
        {
            // 331133
            // 划分成两个数组
            vector<int> big(nums.begin(),nums.begin() + j);
            vector<int> small(nums.begin() + j,nums.end());
            return binSearch(big,target) || binSearch(small,target);
        }
        return false;

    }
Beispiel #15
0
void skill_menu_t::build()
{
	halign = ALIGN_CENTER;
	xoffs = 0.5;
	medium();
	label("Select Skill Level");
	space(1);

	big();
	button("Classic", SKILL_CLASSIC + 10);
	small();
	space();
	big();
	button("Newbie", SKILL_NEWBIE + 10);
	button("Gamer", SKILL_GAMER + 10);
	button("Elite", SKILL_ELITE + 10);
	button("God", SKILL_GOD + 10);

	space();
	small();
	switch(skill)
	{
	  case SKILL_CLASSIC:
		label("\"I want the original XKobo, dammit!\"");
		break;
	  case SKILL_NEWBIE:
		label("\"Damn, this is hard...!\"");
		break;
	  case SKILL_GAMER:
		label("\"Classic is too retro for me!\"");
		break;
	  case SKILL_ELITE:
		label("\"Bah! Gimme some resistance here.\"");
		break;
	  case SKILL_GOD:
		label("\"The dark is afraid of me.\"");
		break;
	}
}
Beispiel #16
0
int main()
{ 
	int i;
	int two = 0 , three = 0 ,five = 0;
	a[0] = 1;
	for(i=1 ; i<1500;i++) {
		a[i] = small( a[two]*2 , a[three]*3 ,a[five]*5 );
		if( a[i] % 2 == 0 ) two++;
		if( a[i] % 3 == 0 ) three++;
		if( a[i] % 5 == 0 ) five++;
		printf("%d\n" , a[i] );
	}

	return 0;
}
Beispiel #17
0
double
gsl_cdf_ugaussian_Pinv (const double P)
{
  double r, x, pp;

  double dP = P - 0.5;

  if (P == 1.0)
    {
      return GSL_POSINF;
    }
  else if (P == 0.0)
    {
      return GSL_NEGINF;
    }

  if (fabs (dP) <= 0.425)
    {
      x = small (dP);

      return x;
    }

  pp = (P < 0.5) ? P : 1.0 - P;

  r = sqrt (-log (pp));

  if (r <= 5.0)
    {
      x = intermediate (r);
    }
  else
    {
      x = tail (r);
    }

  if (P < 0.5)
    {
      return -x;
    }
  else
    {
      return x;
    }

}
Beispiel #18
0
void main_menu_t::build()
{
	if(manage.game_stopped())
	{
		prefs->last_profile = scorefile.current_profile();
		if(last_level < 0)
			manage.select_scene(scorefile.last_scene());
		else
			manage.select_scene(last_level);
	}

	halign = ALIGN_CENTER;
	xoffs = 0.5;
	big();
	if(manage.game_stopped())
	{
		space();
	        if(scorefile.numProfiles > 0)
		{
			button("Start Game!", 1);
			space();
			list("Player", &prefs->last_profile, 4);
			for(int i = 0; i < scorefile.numProfiles; ++i)
				item(scorefile.name(i), i);
			small();
			buildStartLevel(prefs->last_profile);
			big();
		}
		else
			space(2);
		button("New Player...", 3);
	}
	else
	{
		space(2);
		button("Return to Game", 0);
	}
	space();
	button("Options", 2);
	space();
	if(manage.game_stopped())
		button("Return to Intro", 0);
	else
		button("Abort Current Game", 101);
	button("Quit Kobo Deluxe", MENU_TAG_CANCEL);
}
Beispiel #19
0
// When the canvas clip covers the full picture, we don't need to call the BBH.
DEF_TEST(Picture_SkipBBH, r) {
    SkRect bound = SkRect::MakeWH(320, 240);
    CountingBBH bbh(bound);
    SpoonFedBBHFactory factory(&bbh);

    SkPictureRecorder recorder;
    recorder.beginRecording(bound, &factory);
    SkAutoTUnref<const SkPicture> picture(recorder.endRecording());

    SkCanvas big(640, 480), small(300, 200);

    picture->playback(&big);
    REPORTER_ASSERT(r, bbh.searchCalls == 0);

    picture->playback(&small);
    REPORTER_ASSERT(r, bbh.searchCalls == 1);
}
Beispiel #20
0
double
gsl_cdf_ugaussian_Qinv (const double Q)
{
  double r, x, pp;

  double dQ = Q - 0.5;

  if (Q == 1.0)
    {
      return GSL_NEGINF;
    }
  else if (Q == 0.0)
    {
      return GSL_POSINF;
    }

  if (fabs (dQ) <= 0.425)
    {
      x = small (dQ);

      return -x;
    }

  pp = (Q < 0.5) ? Q : 1.0 - Q;

  r = sqrt (-log (pp));

  if (r <= 5.0)
    {
      x = intermediate (r);
    }
  else
    {
      x = tail (r);
    }

  if (Q < 0.5)
    {
      return x;
    }
  else
    {
      return -x;
    }
}
Beispiel #21
0
/** Constructor */
SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, std::string gpgId, std::string sslId, uint32_t type, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
	mSslId(sslId), mGpgId(gpgId), mType(type), mIsHome(isHome)
{
    /* Invoke the Qt Designer generated object setup routine */
    setupUi(this);
  
    messageframe->setVisible(false);
    sendmsgButton->setEnabled(false);
    quickmsgButton->setEnabled(false);
    chatButton->setEnabled(false);
    addFriendButton->setEnabled(false);
    removeFriendButton->setEnabled(false);
    removeFriendButton->hide();
    peerDetailsButton->setEnabled(false);

    /* general ones */
    connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
    connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );

    /* specific ones */
    connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
    connect( actionNew_Message, SIGNAL( triggered( ) ), this, SLOT( sendMsg ( void ) ) );

    connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) );
    connect( cancelButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) );

    connect( sendmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) );
    connect(addFriendButton, SIGNAL(clicked()), this, SLOT(addFriend()));
    connect(removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend()));
    connect(peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));

    connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));

    QMenu *msgmenu = new QMenu();
    msgmenu->addAction(actionNew_Message);

    quickmsgButton->setMenu(msgmenu);

    avatar->setId(mSslId, false);

    small();
    updateItemStatic();
    updateItem();
}
Beispiel #22
0
int main(int argc, const char *argv[]) 
{
    int num1, num2, maior, menor, val;

    printf("Insira um numero: \n");
    scanf("%d", &num1); //insercao do primeiro numero
    printf("Insira um numero: \n");
    scanf("%d", &num2); //insercao do segundo numero
            
    maior = big(num1, num2); //funcao para verificar o maior numero
    menor = small(num1, num2);//funcao para verificar o menor numero

    val = 0;
    while (maior >= menor) //condicao de parada
    {
        if (fits(maior,menor) == 1) //chamada da funcao "encaixa"
            val = 1;
        maior/=10;
    }
    if (val == 1) //se a funcao retornar "verdadeiro" o menor numero encaixa no maior
    {
        if(num1 > num2)
        {
            printf("%d é segmento de %d \n",num2, num1);
        }
        else
        {
            printf("%d é segmento de %d \n",num1, num2);
        }
    }

    else
    {
        if(num1 > num2)
        {
            printf("%d nao é segmento de %d \n",num2, num1);
        }
        else
        {
            printf("%d nao é segmento de %d \n",num1, num2);
        }
    }

    return 0;
}
Beispiel #23
0
int main()
{
box small("small box "),           //Three boxes to work with
    medium("medium box "),
    large("large box ");

   small.set(5, 7);
   large.set(15, 20);
   
   cout << "The area of the ";
   cout << small.get_area() << "\n";
   cout << "The area of the ";
   cout << medium.get_area() << "\n";
   cout << "The area of the ";
   cout << large.get_area() << "\n";

   return 0;
}
Beispiel #24
0
// the original angle is too short to get meaningful sector information
// lengthen it until it is long enough to be meaningful or leave it unset if lengthening it
// would cause it to intersect one of the adjacent angles
bool SkOpAngle::computeSector() {
    if (fComputedSector) {
        // FIXME: logically, this should return !fUnorderable, but doing so breaks testQuadratic51
        // -- but in general, this code may not work so this may be the least of problems
        // adding the bang fixes testQuads46x in release, however
        return !fUnorderable;
    }
    SkASSERT(fSegment->verb() != SkPath::kLine_Verb && small());
    fComputedSector = true;
    int step = fStart < fEnd ? 1 : -1;
    int limit = step > 0 ? fSegment->count() : -1;
    int checkEnd = fEnd;
    do {
// advance end
        const SkOpSpan& span = fSegment->span(checkEnd);
        const SkOpSegment* other = span.fOther;
        int oCount = other->count();
        for (int oIndex = 0; oIndex < oCount; ++oIndex) {
            const SkOpSpan& oSpan = other->span(oIndex);
            if (oSpan.fOther != fSegment) {
                continue;
            }
            if (oSpan.fOtherIndex == checkEnd) {
                continue;
            }
            if (!approximately_equal(oSpan.fOtherT, span.fT)) {
                continue;
            }
            goto recomputeSector;
        }
        checkEnd += step;
    } while (checkEnd != limit);
recomputeSector:
    if (checkEnd == fEnd || checkEnd - step == fEnd) {
        fUnorderable = true;
        return false;
    }
    int saveEnd = fEnd;
    fComputedEnd = fEnd = checkEnd - step;
    setSpans();
    setSector();
    fEnd = saveEnd;
    return !fUnorderable;
}
Beispiel #25
0
TEST_F(LUATest, testSpriteDefinition)
{
	TextureDefinition small("small");
	SpriteDefinition::get().init(small);
	SpriteDefPtr spriteDef = SpriteDefinition::get().getSpriteDefinition("test");
	const bool found = !!spriteDef;
	ASSERT_TRUE(found) << "no sprite definitions found for test";
	ASSERT_TRUE(spriteDef->hasShape());
	ASSERT_TRUE(spriteDef->isStatic());
	ASSERT_FALSE(spriteDef->hasNoTextures());
	ASSERT_EQ("test", spriteDef->id);
	ASSERT_DOUBLE_EQ(14, spriteDef->fps);
	ASSERT_DOUBLE_EQ(1, spriteDef->rotateable);
	ASSERT_EQ(2u, spriteDef->polygons.size());
	ASSERT_EQ(1u, spriteDef->circles.size());
	ASSERT_TRUE(spriteDef->textures[LAYER_BACK].empty());
	ASSERT_FALSE(spriteDef->textures[LAYER_MIDDLE].empty());
	ASSERT_TRUE(spriteDef->textures[LAYER_FRONT].empty());
}
Beispiel #26
0
// When the canvas clip covers the full picture, we don't need to call the BBH.
DEF_TEST(Picture_SkipBBH, r) {
    SkRect bound = SkRect::MakeWH(320, 240);
    CountingBBH bbh(bound);
    SpoonFedBBHFactory factory(&bbh);

    SkPictureRecorder recorder;
    SkCanvas* c = recorder.beginRecording(bound, &factory);
    // Record a few ops so we don't hit a small- or empty- picture optimization.
        c->drawRect(bound, SkPaint());
        c->drawRect(bound, SkPaint());
    sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());

    SkCanvas big(640, 480), small(300, 200);

    picture->playback(&big);
    REPORTER_ASSERT(r, bbh.searchCalls == 0);

    picture->playback(&small);
    REPORTER_ASSERT(r, bbh.searchCalls == 1);
}
Beispiel #27
0
/** Constructor */
ChanNewItem::ChanNewItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, bool isHome, bool isNew)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
	mChanId(chanId), mIsHome(isHome), mIsNew(isNew)
{
  /* Invoke the Qt Designer generated object setup routine */
  setupUi(this);

  setAttribute ( Qt::WA_DeleteOnClose, true );

  /* general ones */
  connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
  connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );

  /* specific ones */
  connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) );

  small();
  updateItemStatic();
  updateItem();
}
Beispiel #28
0
/** Constructor */
BlogMsgItem::BlogMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
	mPeerId(peerId), mMsgId(msgId), mIsHome(isHome)
{
  /* Invoke the Qt Designer generated object setup routine */
  setupUi(this);

  setAttribute ( Qt::WA_DeleteOnClose, true );

  /* general ones */
  connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
  connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
  //connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );

  /* specific ones */
  connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );

  small();
  updateItemStatic();
  updateItem();
}
Beispiel #29
0
void SkOpAngle::setSector() {
    SkPath::Verb verb = fSegment->verb();
    if (SkPath::kLine_Verb != verb && small()) {
        fSectorStart = fSectorEnd = -1;
        fSectorMask = 0;
        fComputeSector = true;  // can't determine sector until segment length can be found
        return;
    }
    fSectorStart = findSector(verb, fSweep[0].fX, fSweep[0].fY);
    if (!fIsCurve) {  // if it's a line or line-like, note that both sectors are the same
        SkASSERT(fSectorStart >= 0);
        fSectorEnd = fSectorStart;
        fSectorMask = 1 << fSectorStart;
        return;
    }
    SkASSERT(SkPath::kLine_Verb != verb);
    fSectorEnd = findSector(verb, fSweep[1].fX, fSweep[1].fY);
    if (fSectorEnd == fSectorStart) {
        SkASSERT((fSectorStart & 3) != 3);  // if the sector has no span, it can't be an exact angle
        fSectorMask = 1 << fSectorStart;
        return;
    }
    bool crossesZero = checkCrossesZero();
    int start = SkTMin(fSectorStart, fSectorEnd);
    bool curveBendsCCW = (fSectorStart == start) ^ crossesZero;
    // bump the start and end of the sector span if they are on exact compass points
    if ((fSectorStart & 3) == 3) {
        fSectorStart = (fSectorStart + (curveBendsCCW ? 1 : 31)) & 0x1f;
    }
    if ((fSectorEnd & 3) == 3) {
        fSectorEnd = (fSectorEnd + (curveBendsCCW ? 31 : 1)) & 0x1f;
    }
    crossesZero = checkCrossesZero();
    start = SkTMin(fSectorStart, fSectorEnd);
    int end = SkTMax(fSectorStart, fSectorEnd);
    if (!crossesZero) {
        fSectorMask = (unsigned) -1 >> (31 - end + start) << start;
    } else {
Beispiel #30
0
void test()
{
    int s1Init[] = {1,6,7,3,99};
    VSet<int> s1(s1Init, ARRAYEND(s1Init));
    int s2Init[] = {1,-4,42,7,100};
    VSet<int> s2(s2Init, ARRAYEND(s2Init));
    std::cout << s1 << "\n";

    std::cout << "s1.contains(1) = " << s1.contains(1) << "\n";
    std::cout << "s1.contains(-1) = " << s1.contains(-1) << "\n";

    int smallInit[] = {1,6};
    VSet<int> small(smallInit, ARRAYEND(smallInit));
    std::cout << s1 << ".includes(" << small << ") = " << s1.includes(small) << "\n";


    VSet<int> u;
    setUnion(s1, s2, u);
    std::cout << "union(" << s1 << ", " << s2 << ") = " << u << "\n";
    VSet<int> i;
    setIntersection(s1, s2, i);
    std::cout << "intersection(" << s1 << ", " << s2 << ") = " << i << "\n";
}