Пример #1
0
// TODO for cow
void FreePCB(PCB *pcb) {
    while (!queueIsEmpty(pcb->children)) {
        queuePop(pcb->children);
    }

    while(!queueIsEmpty(pcb->deadChildren)) {
        ZCB *zombie = queuePop(pcb->deadChildren);
        queueRemove(process_queue, zombie);
        free(zombie);
    }

    free(pcb->children);
    free(pcb->deadChildren);

    for (int i = 0; i < MAX_PT_LEN; i++) {
        if (pcb->cow.pageTable[i].valid == 1) {
            if (pcb->cow.refCount[i]) {
                if (*(pcb->cow.refCount[i]) == 1) {
                    addFrame(pcb->cow.pageTable[i].pfn);
                    free(pcb->cow.refCount[i]);
                } else {
                    *(pcb->cow.refCount[i])--;
                }
            } else {
                addFrame(pcb->cow.pageTable[i].pfn);
            }
        }
    }

    free(pcb);
}
Пример #2
0
void
TxSummary::slotProcess()
{
    unsigned int i;

    QApplication::setOverrideCursor(waitCursor);
    qApp->processEvents();

    _employees.clear();
    for (i = 0; i < _frames.size(); ++i)
	delete _frames[i];
    _frames.clear();

    for (i = 0; i < _gltxs.size(); ++i) {
	const Gltx& gltx = _gltxs[i];
	processGltx(gltx);
    }

    EmployeeInfo total;
    total.employee.setLastName(tr("Total"));

    for (i = 0; i < _employees.size(); ++i) {
	EmployeeInfo& info = _employees[i];
	addFrame(info);
	total.addInfo(info);
    }
    addFrame(total);

    QApplication::restoreOverrideCursor();
}
Пример #3
0
int  LoggerReader_byte::readConf()                                /*{{{*/
{
#if DEBUG == 1
  printf("int LoggerReader_byte::readConf()\n");
#endif
    
  // --- Zunächst alte Daten löschen ----------------------
  nMaxFrameLen = 0;
      
  // --- Die Beschreibung in el einlesen ------------------        

  // Geberframes
  addFrame(0, 0x63, 3);
  addFrame(1, 0x64, 3);
  addFrame(2, 0x65, 3);
  addFrame(3, 0x66, 3);
  addFrame(4, 0x67, 3);
  addFrame(5, 0x68, 3);
  addFrame(6, 0x69, 3);
  addFrame(7, 0x6A, 3);
  // Parameterframe
  addFrame(8, 0x62, 3);
  
#if DEBUG == 1  
  for (unsigned int n=0; n<frames.size(); n++)
  {
    printf("Frametyp: %i %i %i\n", frames[n].ID, frames[n].start, frames[n].len);
  }
#endif  
  return(0);
}
Пример #4
0
void VCFrame::slotMenuCallback(int item)
{
	switch (item)
	{
	case KVCMenuAddButton:
		addButton();
		break;
	case KVCMenuAddSlider:
		addSlider();
		break;
	case KVCMenuAddFrame:
		addFrame();
		break;
	case KVCMenuAddXYPad:
		addXYPad();
		break;
	case KVCMenuAddLabel:
		addLabel();
		break;

	default:
		VCWidget::slotMenuCallback(item);
		break;
	}
}
Пример #5
0
	Animation::Animation(const std::string& name, const std::vector<Texture*>& frames)
	{
		for (unsigned int i = 0; i < frames.size(); ++i)
		{
			addFrame(frames[i]);
		}
	}
Пример #6
0
void GuiTaskBar::addTask(string _title, bool _minimized) {
  if (mainFrameIdx > -1) {
    stGuiTask *task = new stGuiTask;
    task->title = _title;
    task->minimized = _minimized;

    SDL_Rect *mainFrameIRect = frames[mainFrameIdx]->getInnerRect();
    Uint16 tasksIdx = frames.size() - 1;
    GuiFrame *taskFrame = addFrame(
      mainFrameIRect->x + tasksIdx * 50,
      mainFrameIRect->y + 1,
      50, mainFrameIRect->h
    );
    if (taskBorderWidth > 0) {
      taskFrame->setBorder(
        taskBorderWidth, taskBorderColor.r, taskBorderColor.g, taskBorderColor.b
      );
      taskFrame->setBorderActive(
        false, false, true, true
      );
    }

    task->frameIdx = frames.size() - 1;
    tasks.push_back(task);
  }
}
Пример #7
0
void ID3v2_Tag::setComment(const wxString &s)
{
	//if(s.IsEmpty()) {
	//  removeFrames("COMM");
	//  return;
	//}

	//if(!d->frameListMap["COMM"].isEmpty())
	//  d->frameListMap["COMM"].front()->setText(s);

	// we do not remove all frames as this will remove MusicMatch etc.

	ID3v2_CommentsFrame* f = findCommentFrame();
	if( f )
	{
		if( s.IsEmpty() )
		{
			removeFrame(f);
		}
		else
		{
			f->setText(s);
		}
	}
	else if( !s.IsEmpty() )
	{
		f = new ID3v2_CommentsFrame(m_factory->defaultTextEncoding());
		addFrame(f);
		f->setText(s);
	}
}
Пример #8
0
void ID3v2_Tag::setTextFrame(const wxString &id, const wxString &value)
{
	if(value.IsEmpty()) {
		removeFrames(id);
		return;
	}

	//if(!d->frameListMap[id].isEmpty())
	//  d->frameListMap[id].front()->setText(value);
	ID3v2_FrameList* it = frameList(id);
	if( it )
	{
		ID3v2_FrameList::Node* l = it->GetFirst();
		if( l )
		{
			l->GetData()->setText(value);
		}
	}
	else
	{
		const SjStringType encoding = m_factory->defaultTextEncoding();

		SjByteVector idBv;
		idBv.appendString(id, SJ_LATIN1);
		ID3v2_TextIdentificationFrame *f = new ID3v2_TextIdentificationFrame(idBv, encoding);

		addFrame(f);
		f->setText(value);
	}
}
Пример #9
0
void Timeline::setup(int x, int y, int _width, int _height) {
    _x = x;
    _y = y;
    width = _width;
    height = _height;
    // TODO: Get rid of frameWidth and frameHeight?
    frameWidth = ofGetWindowWidth();
    frameHeight = ofGetWindowHeight();
    
    addFrame();
    
    curlayerNum = 0;
    numLayers = 1;
    inPoint = 0;
    outPoint = 0;
    curFrame = 0;
    
    isPlaying = false;
    frameRate = 3;

    font.load("Arial.ttf", 8);
    parameters.setName("Timeline");
    parameters.add(showOnionSkin.set("showOnionSkin", false));
    parameters.add(autoFrameHandleMode.set("autoFrameHandleMode", 0, 0, 2));
    parameters.add(onionSkinAlpha.set("autoFrameHandleMode", 200, 0, 255));
}
Пример #10
0
void MovieMaker::EndCapture()
{
	OSStatus	error = noErr;

	if (movie && movieResRef)
	{
		if (media && track)
		{
			// Errors adding the frame aren't too important here.
			(void)addFrame();
			
			error = EndMediaEdits(media);
			if (error == noErr)
			{
				error = SCCompressSequenceEnd(ci);
			}

			if (error == noErr)
			{
				error = InsertMediaIntoTrack(track, 0, 0, GetMediaDuration(media), fixed1);
			}
			media = NULL;
			track = NULL;
		}
		
		short resId = movieInDataForkResID;
		error = AddMovieResource(movie, movieResRef, &resId, "\pSecond Life");
		CloseMovieFile(movieResRef);
		movieResRef = 0;
		movie = NULL;
	}
	
	// NOTE:  idh is disposed by SCCompressSequenceEnd.
	idh = NULL;
	
	if(ci)
	{
		CloseComponent(ci);
		ci = NULL;
	}
	
	if(gworld)
	{
		DisposeGWorld(gworld);
		gworld = NULL;
	}

	if(buffer)
	{
		free(buffer);
		buffer = NULL;
	}

	if(invertedBuffer)
	{
		free(invertedBuffer);
		invertedBuffer = NULL;
	}
}
Пример #11
0
void MarianneAnimation :: load()
{
	for( int i=0; i<102; i++ )
	{
		string imagePath = "animations/marianne/marianne_win" + ofToString( i ) + ".png";
		addFrame( imagePath );
	}
}
Пример #12
0
int Mosaic::addFrameRGB(ImageType imageRGB)
{
    ImageType imageYVU;
    // Convert to YVU24 which is used by blending
    imageYVU = ImageUtils::allocateImage(this->width, this->height, ImageUtils::IMAGE_TYPE_NUM_CHANNELS);
    ImageUtils::rgb2yvu(imageYVU, imageRGB, width, height);

    return addFrame(imageYVU);
}
Пример #13
0
 Animation::Animation(const vector<fzSpriteFrame>& frames, fzFloat delay)
 : m_loops(1)
 , m_delayPerUnit(delay)
 , m_frames()
 {
     vector<fzSpriteFrame>::const_iterator it(frames.begin());
     for(; it != frames.end(); ++it)
         addFrame(*it); 
 }
Пример #14
0
void ofxGifEncoder::addFrame(ofImage & img, float _duration) {

    if(img.width != w || img.height != h) {
        ofLog(OF_LOG_WARNING, "ofxGifEncoder::addFrame image dimensions don't match, skipping frame");
        return;
    }
    
    addFrame(img.getPixels(), w, h, img.bpp,  _duration);
}
Пример #15
0
void Animation::addFrameLine(int numFrames_x, int numFrames_y, int line)
{
    const sf::Vector2u size = mTexture->getSize();
    const float delta_x = size.x / float(numFrames_x);
    const float delta_y = size.y / float(numFrames_y);

    for(int i = 0; i< numFrames_x; ++i)
        addFrame(sf::IntRect(i*delta_x, line*delta_y, delta_x, delta_y));
}
Пример #16
0
//--------------------------------------------------------------
void testApp::setup()
{
	ofSetFrameRate(30);
	fbo.allocate(WIDTH, HEIGHT, GL_RGB, 0);
	frame_number = 0;
	recorder1.play();
	/*recorder2.preAllocate(WIDTH, HEIGHT);
	recorder2.play();*/
	addFrame();
}
Пример #17
0
void Letter::fireworks()
{
    if (!fireworkTimer) {
        fireworkTimer = new QTimer(this);
        fireworkTimer->start(100);
    }
    Firework *firework = new Firework();
    connect(fireworkTimer, SIGNAL(timeout()), firework, SLOT(addFrame()));
    firework->show();
}
Пример #18
0
void ReplayWindow::update()
{
  for (int i = 0; i < REPLAY_NUM_TABS; i++)
    frametab[i] = -1;
  clear();
  if (replay)
  {
    failure->hide();
    failureInfo->hide();

    DotaInfo const* dotaInfo = replay->getDotaInfo();

    addFrame(REPLAY_GAMEINFO);
    addFrame(REPLAY_GAMECHAT);
    if (dotaInfo)
    {
      addFrame(REPLAY_TIMELINE);
      addFrame(REPLAY_PLAYERINFO);
    }
    addFrame(REPLAY_ACTIONS);
    if (dotaInfo)
    {
      addFrame(REPLAY_PLAYERGOLD);
      addFrame(REPLAY_PLAYEREXP);
    }
    addFrame(REPLAY_PRESENT);

    if (dotaInfo && (dotaInfo->draft.numPool || dotaInfo->draft.numPicks[0] ||
        dotaInfo->draft.numPicks[1] || dotaInfo->draft.numBans[0] || dotaInfo->draft.numBans[1]))
      addFrame(REPLAY_DRAFT);

    addFrame(REPLAY_ACTIONLOG);
  }
  else
  {
    failure->show();
    failureInfo->show();
  }
  for (int i = 0; i < REPLAY_NUM_TABS; i++)
    frames[i]->setReplay(replay);
}
Пример #19
0
uint32_t CB_SpriteSheet::addFrame(uint32_t textureId, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t xOrig, uint32_t yOrig)
{
    CB_SpriteFrame frame;
    frame.texture = textureId;
    frame.x = x;
    frame.y = y;
    frame.width = width;
    frame.height = height;
    frame.xOrig = xOrig;
    frame.yOrig = yOrig;
    return addFrame(frame);
}
Пример #20
0
    void Animation::addFrames(Texture *t) {
        if(t != nullptr) {
            int ix = (int)t->frames().x();
            int jy = (int)t->frames().y();

            for(int j = 1; j <= jy; j++) {
                for(int i = 1; i <= ix; i++) {
                    addFrame(t, {i,j});
                }
            }
        } else {
            Debug::warning("NULL texture in Animation::addFrames");
        }
    }
Пример #21
0
CAnimation * CBaseChar::makeAnimation(const char * charpath, const char * aniname, bool loop, int count)
{
	auto ani = new CAnimation();
	ani->init(150,loop);

	for(int i = 0; i<count; i++)
	{
		char buf[128];
		sprintf_s(buf, "%s%s_%d.png", charpath, aniname, i);
		ani->addFrame(buf);
	}

	return ani;
}
Пример #22
0
 void Animation::init(std::string basePath, int numImgs) {
     // So we don't have to hard code in all of the filenames
     for (int i = 1; i <= numImgs; i++) {
         std::stringstream ss;
         ss << i;
         
         sf::Image* image = new sf::Image();
         if (!image->LoadFromFile(basePath + ss.str() + ".png")) {
             printf("Error loading resource - init\n");
         }
         if (!addFrame(image)) {
             printf("Error adding frame to animation - init\n");
         }
     }
 }
Пример #23
0
CTextureAnim::CTextureAnim(ITextureAnim* other) 
	: FirstTime(true), m_Format(ETF_TEXTURE_2D)
{	
#if MY_DEBUG_MODE 
	setClassName("CTextureAnim");
#endif

	if (other)
	{
		setParameters(other->getParameters());
		s32 fr_cnt = other->getFramesCount();
		for (s32 f=0; f<fr_cnt; f++)
			addFrame(other->getFrame(f));
	}
}
Пример #24
0
QDomElement KWDWriter::createTableCell(int tableno, int nrow,
				int ncol, int colspan, QRect rect) {
	QDomElement parent=docroot().elementsByTagName("FRAMESETS").item(0).toElement();

	QDomElement fs=addFrameSet(parent,1,0,
			QString("Table %1 - %2,%3").arg(tableno).arg(nrow).arg(ncol),
			1);
	fs.setAttribute("grpMgr",QString("Table %1").arg(tableno));
	fs.setAttribute("row",nrow);
	fs.setAttribute("col",ncol);
	fs.setAttribute("cols",colspan); // FIXME do colspan in finishTable
					 // so we don't have to give it as an argument
	fs.setAttribute("rows",1);	// FIXME support rowspan ?
	addFrame(fs,rect);
	return fs;
}
Пример #25
0
    void Animation::addFrames(Texture *t, Vector from, Vector to) {
        if(t != nullptr) {
            int imin = (int)from.x();
            int imax = (int)to.x();
            int jmin = (int)from.y();
            int jmax = (int)to.y();

            for(int j = jmin; j <= jmax; j++) {
                for(int i = imin; i <= imax; i++) {
                    addFrame(t, {i,j});
                }
            }
        } else {
            Debug::warning("NULL texture in Animation::addFrames");
        }
    }
bool QgsComposerMultiFrame::_readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames )
{
  mResizeMode = ( ResizeMode )itemElem.attribute( "resizeMode", "0" ).toInt();
  if ( !ignoreFrames )
  {
    QDomNodeList frameList = itemElem.elementsByTagName( "ComposerFrame" );
    for ( int i = 0; i < frameList.size(); ++i )
    {
      QDomElement frameElem = frameList.at( i ).toElement();
      QgsComposerFrame* newFrame = new QgsComposerFrame( mComposition, this, 0, 0, 0, 0 );
      newFrame->readXML( frameElem, doc );
      addFrame( newFrame );
    }
  }
  return true;
}
void AnimatedShadow::addFrame( ofxBlob &_blob, float _widht, float _height ){
    
    if (nId == 0 ){
        nId = _blob.id;
    }
    
    if (nId == _blob.id){
        ofPolyline contourLine;
        
        for (int i = 0; i < _blob.pts.size(); i++){
            contourLine.addVertex(_blob.pts[i].x * _widht, _blob.pts[i].y * _height);
        }
        
        addFrame(contourLine, _blob.nFingers);
    }
}
Пример #28
0
AnimatedSprite::AnimatedSprite(Uint image, SDL_Rect frame, int frames, int defaultFrame)
{
	speed = Interval<Uint32>(65);
	
	if ( !image ) { return; }
	this->image = image;
	
	SDL_Rect clip = {0,0,0,0};
	clip = Engine::getImageSheetDimensions(image);
	
	// Calculate the amount of frames that can fit in the space of the image.
	int framesWide = ( clip.w - frame.x ) / frame.w;
	int framesHigh = ( clip.h - frame.y ) / frame.h;
	
	//if ( (framesWide * framesHigh) < frames )
	//	printf("Not enough space inside %s image to create %s animation\n",imagefile.c_str(), id.c_str());
	
	// Get the absolute coordinates of the start frame.
	// This allows the frame to be relative of the image box.	
	frame.x += clip.x;
	frame.y += clip.y;
	int startX = frame.x;
	
	int curRow = 0;
	int curCol = 0;
	
	// Assign the frames to the sprite from the image.
	for (int currentFrame = 0; currentFrame < frames; ++currentFrame) {
		// If the current frame doesn't fit on the image (x-axis).
		// Go to the next line and reset the X cooridinate.
 		// Currently disabled
 		if ( (frame.x + (currentFrame * frame.w)) > (clip.x + clip.w) ) {
			break;
			//frame.y += frame.h;
			//frame.x = startX;
			//curCol = 0; curRow++;
			//if ( (frame.y + frame.h) > (clip.y + clip.h) ) {
				//printf("Warning %s sprite does not fit inside image correctly.\n", id.c_str());
			//}
		}
		addFrame( Engine::setClip(image,
							frame.x + curCol*frame.w, frame.y + curRow*frame.h, 
							frame.w, frame.h)	);
		curCol++;
	}
	setDefault(defaultFrame);
}
Пример #29
0
int Mosaic::addFrameRGB(ImageType imageRGB)
{
    ImageType imageYVU;
    // Convert to YVU24 which is used by blending
    imageYVU = ImageUtils::allocateImage(this->width, this->height, ImageUtils::IMAGE_TYPE_NUM_CHANNELS);
    ImageUtils::rgb2yvu(imageYVU, imageRGB, width, height);

    int existing_frames_size = frames_size;
    int ret = addFrame(imageYVU);

    if (frames_size > existing_frames_size)
        owned_frames[owned_size++] = imageYVU;
    else
        ImageUtils::freeImage(imageYVU);

    return ret;
}
Пример #30
0
//--------------------------------------------------------------
void testApp::keyReleased(int key)
{
	switch(key) {
	case 'a':
		addFrame();
		break;
	case 'c':
		recorder1.clear();
		break;
	case 'f':
		recorder1.firstFrame();
		break;
	case 'n':
		recorder1.nextFrame();
		break;
	}
}