void CDmeTrack::FindAdjacentFilmClips( CDmeClip *pClip, CDmeClip *&pPrevClip, CDmeClip *&pNextClip )
{
	pPrevClip = pNextClip = NULL;

	Assert( IsFilmTrack() );
	if ( !IsFilmTrack() || !pClip || ( m_Clips.Count() == 0 ) )
		return;

	// This algorithm requires sorted clips
	SortClipsByStartTime();

	int c = GetClipCount();
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pSubClip = GetClip( i );
		if ( pSubClip == pClip )
		{
			pNextClip = ( i != c-1 ) ? GetClip( i+1 ) : NULL;
			return;
		}

		pPrevClip = pSubClip;
	}

	pPrevClip = NULL;
}
示例#2
0
void Draw::SetOrg() {
	DrawLock __;
#ifdef PLATFORM_WINCE
	::SetViewportOrgEx(handle, actual_offset.x, actual_offset.y, 0);
#else
	LLOG("Draw::SetOrg: clip = " << GetClip() << ", offset = " << actual_offset);
	::SetWindowOrgEx(handle, -actual_offset.x, -actual_offset.y, 0);
	LLOG("//Draw::SetOrg: clip = " << GetClip());
#endif
}
示例#3
0
bool SystemDraw::ClipoffOp(const Rect& r)
{
    GuiLock __;
    Begin();
    LTIMING("Clipoff");
    LLOG("ClipoffOp " << r << ", GetClip() = " << GetClip() << ", actual_offset = " << actual_offset);
    actual_offset += r.TopLeft();
    bool q = IntersectClip(r);
    drawingclip -= r.TopLeft();
    SetOrg();
    LLOG("//ClipoffOp, GetClip() = " << GetClip() << ", actual_offset = " << actual_offset);
    return q;
}
示例#4
0
void
CGLContext::BlitVUY2 (unsigned char *data)
{
	Target      *target = Top ()->GetTarget ();
	MoonSurface *ms;
	Rect        r = target->GetData (&ms);
	OpengGLSurface *dst = (OpenGLSurface *) ms;
	int         size[] = { dst->Width (), dst->Height () };
	GLuint texture = dst->Texture ();

	// no support for clipping
	g_assert (GetClip () == r);

	// no support for blit to drawable at the moment
	g_assert (!dst->HasDrawable ());

	// mark target as initialized
	target->SetInit (ms);

	glBindTexture (GL_TEXTURE_2D, texture);
	glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, size [0], size [1], 0, GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, data);
	glBindTexture (GL_TEXTURE_2D, 0);

	ms->unref ();
}
void CDmeTrack::FindClipsWithinTime( DmeTime_t startTime, DmeTime_t endTime, DmeClipSkipFlag_t flags, CUtlVector< CDmeClip * >& clips ) const
{
	if ( ( flags & DMESKIP_INVISIBLE ) && IsCollapsed() )
		return;

	if ( ( flags & DMESKIP_MUTED ) && IsMute() )
		return;

	int nClipCount = GetClipCount();
	for ( int j = 0; j < nClipCount; ++j )
	{
		CDmeClip *pSubClip = GetClip( j );
		if ( !pSubClip )
			continue;
		if ( ( flags & DMESKIP_MUTED ) && pSubClip->IsMute() )
			continue;

		DmeTime_t clipStart = pSubClip->GetStartTime();
		DmeTime_t clipEnd = pSubClip->GetEndTime();
		if ( clipStart >= startTime && clipEnd <= endTime )
		{
			clips.AddToTail( pSubClip );
		}
	}
}
CDmeClip* CDmeTrack::FindNextFilmClip( CDmeClip *pClip )
{
	Assert( IsFilmTrack() );
	if ( !IsFilmTrack() || ( m_Clips.Count() == 0 ) )
		return NULL;

	// This algorithm requires sorted clips
	SortClipsByStartTime();

	if ( !pClip )
		return m_Clips[ 0 ]; 

	CDmeClip *pNextClip = NULL;

	int c = GetClipCount();
	for ( int i = c; --i >= 0; )
	{
		CDmeClip *pSubClip = GetClip( i );
		if ( pSubClip == pClip )
			return pNextClip;

		pNextClip = pSubClip;
	}

	return NULL;
}
示例#7
0
bool WidgetList::Update(const Point2i& mousePosition,
                        const Point2i& lastMousePosition)
{
  Rectanglei clip;
  Rectanglei wlr = GetClip(clip);
  if (!wlr.GetSizeX() || !wlr.GetSizeY())
      return false;

  // Redraw the background
  bool updated = false;
  if (need_redrawing)
    RedrawBackground(wlr);

  for (std::list<Widget*>::const_iterator w=widget_list.begin();
      w != widget_list.end();
      w++)
  {
    Rectanglei r((*w)->GetPosition(), (*w)->GetSize());
    r.Clip(wlr);

    if (r.GetSizeX() && r.GetSizeY()) {
      SwapWindowClip(r);
      updated |= (*w)->Update(mousePosition, lastMousePosition);
      SwapWindowClip(r);
    }
  }

  if (updated)
    RedrawForeground();

  // Restore initial clip rectangle
  UnsetClip(clip);
  need_redrawing = false;
  return updated;
}
示例#8
0
void QTCode_ForceMovieRedraw(Movie theMovie) 
{
	OSErr 		err = noErr;
	Rect		movieRect;
	RgnHandle	clipRegion = NULL;

	
		if (theMovie == NULL) goto bail;
	
		clipRegion = NewRgn();
		if (clipRegion == NULL) goto bail;
		
		GetClip(clipRegion);
		GetMovieBox(theMovie, &movieRect); 
		ClipRect(&movieRect);
	
		UpdateMovie(theMovie);
		MoviesTask(theMovie, 0);
	
		SetClip(clipRegion);
	
			/* Closure. Clean up if we have handles. */
	bail:	
	
		if	(clipRegion != NULL)
		{
			DisposeRgn(clipRegion);
		}
}
//-----------------------------------------------------------------------------
// Returns the next/previous clip in a film track
//-----------------------------------------------------------------------------
CDmeClip* CDmeTrack::FindPrevFilmClip( CDmeClip *pClip )
{
	Assert( IsFilmTrack() );
	if ( !IsFilmTrack() || ( m_Clips.Count() == 0 ) )
		return NULL;

	// This algorithm requires sorted clips
	SortClipsByStartTime();

	if ( !pClip )
		return m_Clips[ m_Clips.Count() - 1 ];

	// FIXME: Could use a binary search here based on time.
	// Probably doesn't matter though, since there will usually not be a ton of tracks
	CDmeClip *pPrevClip = NULL;

	int c = GetClipCount();
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pSubClip = GetClip( i );
		if ( pSubClip == pClip )
			return pPrevClip;

		pPrevClip = pSubClip;
	}

	return NULL;
}
示例#10
0
//-----------------------------------------------------------------------------
// Gets the start/end time of the owning clip in local time
//-----------------------------------------------------------------------------
void CDmeTrack::FindAdjacentFilmClips( DmeTime_t localTime, CDmeClip *&pPrevClip, CDmeClip *&pNextClip )
{
	pPrevClip = pNextClip = NULL;

	Assert( IsFilmTrack() );
	if ( !IsFilmTrack() || ( m_Clips.Count() == 0 ) )
		return;

	// This algorithm requires sorted clips
	SortClipsByStartTime();

	int c = GetClipCount();
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pSubClip = GetClip( i );
		if ( localTime >= pSubClip->GetEndTime() )
		{
			pPrevClip = pSubClip;
		}
		if ( localTime < pSubClip->GetStartTime() )
		{
			pNextClip = pSubClip;
			break;
		}
	}
}
示例#11
0
void WidgetList::Draw(const Point2i &mousePosition)
{
  Rectanglei clip;
  Rectanglei wlr = GetClip(clip);
  if (!wlr.GetSizeX() || !wlr.GetSizeY())
      return;

  for (std::list<Widget*>::const_iterator w=widget_list.begin();
      w != widget_list.end();
      w++)
  {
    Rectanglei r((*w)->GetPosition(), (*w)->GetSize());
    r.Clip(wlr);

    if (r.GetSizeX() && r.GetSizeY()) {
      Rectanglei wr = r;
      SwapWindowClip(r);
      (*w)->RedrawBackground(wr);
      (*w)->Draw(mousePosition);
      (*w)->RedrawForeground();
      SwapWindowClip(r);
    }
  }

  // Restore initial clip rectangle
  UnsetClip(clip);
}
示例#12
0
void CDmeTrack::ShiftAllFilmClipsBefore( CDmeClip *pClip, DmeTime_t dt, bool bShiftClip )
{
	Assert( IsFilmTrack() );
	if ( !IsFilmTrack() || ( m_Clips.Count() == 0 ) || ( dt == DmeTime_t( 0 ) ) )
		return;
	 
	// This algorithm requires sorted clips
	SortClipsByStartTime();

	int c = GetClipCount();
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pSubClip = GetClip( i );

		if ( pSubClip == pClip )
		{
			if ( bShiftClip )
			{
				pSubClip->SetStartTime( pSubClip->GetStartTime() + dt );
			}
			return;
		}
		pSubClip->SetStartTime( pSubClip->GetStartTime() + dt );
	}

	// Clip wasn't found!
	Assert( 0 );
}
示例#13
0
bool SystemDraw::IsPaintingOp(const Rect& r) const
{
	Rect cr = r.Offseted(GetOffset());
	cr.Intersect(GetClip());
	if(cr.IsEmpty())
		return false;
	return !invalid || gdk_region_rect_in(invalid, GdkRect(cr)) != GDK_OVERLAP_RECTANGLE_OUT;
}
示例#14
0
static void DisableDrawing ( void ) {

	Rect	nullRect = { 0, 0, 0, 0 };

	GetClip ( gSaveClip );
	ClipRect ( &nullRect );
	
	return;
	} /*DisableDrawing*/
示例#15
0
文件: lcd.c 项目: CNMAT/CNMAT-Externs
void LCD_dolinesegment(Lcd *x, Symbol *s, short argc, Atom *argv)
{
	PaletteHandle pH;
	RGBColor fColor;
	GrafPort *gp;
	RgnHandle cur;
	long fromx,fromy,tox,toy,color;
	short save;
	
	EnterCallback();
	
	fromx = argv->a_w.w_long;
	fromy = (argv+1)->a_w.w_long;
	tox = (argv+2)->a_w.w_long;
	toy = (argv+3)->a_w.w_long;
	color = (argv+4)->a_w.w_long;
	
#ifdef debug
	post("Segment");
#endif
	gp = patcher_setport(x->lcd_box.b_patcher);

	if (gp) {
		if (!box_nodraw((void *)x)) {
			// save=lockout_set(1);
			MoveTo(x->lcd_box.b_rect.left+1+(short)fromx,x->lcd_box.b_rect.top+1+(short)fromy);
			x->lcd_where.h = (short)fromx;
			x->lcd_where.v = (short)fromy;
			
			if (color)
				x->lcd_pIndex = (short)color & (numPaletteColors-1);

			cur = NewRgn();
			GetClip(cur);
			SetClip(x->lcd_region);

			setUpPalette(x,&fColor,&pH);

		//	LCD_MoveTo(x,(long)(x->lcd_where.h),(long)(x->lcd_where.v));
			
			LineTo(x->lcd_box.b_rect.left+1+(short)tox,x->lcd_box.b_rect.top+1+(short)toy);
			x->lcd_where.h = (short)tox;
			x->lcd_where.v = (short)toy;

			restorePalette(x,&fColor,&pH);
			SetClip(cur);
			DisposeRgn(cur);
			// lockout_set(save);

		}
		SetPort(gp);
	}
	ExitCallback();
}
示例#16
0
void
MoonEGLContext::Blit (unsigned char *data,
		  int           stride)
{
	Target      *target = Top ()->GetTarget ();
	MoonSurface *ms;
	Rect        r = target->GetData (&ms);
	MoonEGLSurface  *dst = (MoonEGLSurface *) ms;
	unsigned char *buffer = data;
	int           buffer_stride = stride;

	ForceCurrent ();

	// no support for clipping
	g_assert (GetClip () == r);

	// no support for blit to drawable at the moment
	g_assert (!dst->GetEGLDisplay ());

	// mark target as initialized
	target->SetInit (ms);

	if (PixelRowLength (stride, dst->Width (), 4) != dst->Width ()) {
		buffer_stride = dst->Width () * 4;
		buffer =  (unsigned char *)
			g_malloc (buffer_stride * dst->Height ());

		for (int y = 0; y < dst->Height (); y++)
			memcpy (buffer + (y * buffer_stride),
				data + (y * stride),
				buffer_stride);
	}

	glPixelStorei (GL_UNPACK_ALIGNMENT, PixelAlignment (buffer_stride));
	glBindTexture (GL_TEXTURE_2D, dst->Texture ());
	glTexSubImage2D (GL_TEXTURE_2D,
			 0,
			 0,
			 0,
			 dst->Width (),
			 dst->Height (),
			 GL_RGBA,
			 GL_UNSIGNED_BYTE,
			 buffer);
	glBindTexture (GL_TEXTURE_2D, 0);
	glPixelStorei (GL_UNPACK_ALIGNMENT, 4);

	if (buffer != data)
		g_free (buffer);

	ms->unref ();
}
示例#17
0
void TextBox::Draw(const Point2i & mousePosition)
{
  Rectanglei clip;
  Rectanglei wlr = GetClip(clip);
  if (!wlr.GetSizeX() || !wlr.GetSizeY())
      return;

  Label::Draw(mousePosition);
  DrawCursor(position, cursor_pos);

  // Restore initial clip rectangle
  UnsetClip(clip);
}
// --------------------------------------------------------------------------------------
static CGRect getClipCGRect(const Rect *portBounds)
{
	RgnHandle clipRegion;
	Rect clipBounds;
	
	clipRegion = NewRgn();
	GetClip(clipRegion);
	GetRegionBounds(clipRegion, &clipBounds);
	DisposeRgn(clipRegion);
	
	return CGRectMake(clipBounds.left, 
						portBounds->bottom - portBounds->top - clipBounds.bottom, 
						clipBounds.right - clipBounds.left, clipBounds.bottom - clipBounds.top);
}
示例#19
0
文件: lcd.c 项目: CNMAT/CNMAT-Externs
void LCD_doframeOval(Lcd *x, Symbol *s, short argc, Atom *argv)
{
	long left, top, right, bottom, color;
	PaletteHandle pH;
	RGBColor fColor;
	GrafPort *gp;
	RgnHandle cur;
	Rect	 b,r;
	
	EnterCallback();
	
	// I'm suspicious of (argv++)->thing in Code Warrior
	left = argv->a_w.w_long;
	top = (argv+1)->a_w.w_long;
	right = (argv+2)->a_w.w_long;
	bottom = (argv+3)->a_w.w_long;
	color = (argv+4)->a_w.w_long;
#ifdef debug
	post("frameOval");
#endif
	gp = patcher_setport(x->lcd_box.b_patcher);

	if (gp) {
		if (!box_nodraw((void *)x)) {

			if (color)  // sde 11/1
				x->lcd_pIndex = (short)color & (numPaletteColors-1);

			cur = NewRgn();
			GetClip(cur);
			SetClip(x->lcd_region);
			setUpPalette(x,&fColor,&pH);
			
			r = x->lcd_box.b_rect;
			b.left = r.left + (short)left;
			b.top  = r.top + (short)top;
			b.right = r.left + (short)right;
			b.bottom = r.top + (short)bottom;
			FrameOval(&b);

			restorePalette(x,&fColor,&pH);
			SetClip(cur);
			DisposeRgn(cur);
		}
		SetPort(gp);
	}
	ExitCallback();
}
示例#20
0
void CDmeTrack::ShiftAllClipsAfter( DmeTime_t startTime, DmeTime_t dt, bool bTestStartingTime )
{
	if ( dt == DmeTime_t( 0 ) )
		return;

	int c = GetClipCount();
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pSubClip = GetClip( i );
		DmeTime_t testTime = bTestStartingTime ? pSubClip->GetStartTime() : pSubClip->GetEndTime();
		if ( startTime < testTime )
		{
			pSubClip->SetStartTime( pSubClip->GetStartTime() + dt );
		}
	}
}
示例#21
0
		//! draws a line from to with color
		void CImage::drawLine(const vector2di& from, const vector2di& to,
				const SColor &color)
		{
			AbsRectangle clip;
			GetClip(clip, this);

			vector2di p[2];

			if (ClipLine(clip, p[0], p[1], from, to))
			{
				u32 alpha = extractAlpha(color.color);

				switch (Format)
				{
					case ECF_A1R5G5B5:
						if (alpha == 256)
						{
							RenderLine16_Decal(this, p[0], p[1],
									SharedColorConverter::getInstance().A8R8G8B8toA1R5G5B5(
											color.color));
						}
						else
						{
							RenderLine16_Blend(this, p[0], p[1],
									SharedColorConverter::getInstance().A8R8G8B8toA1R5G5B5(
											color.color), alpha >> 3);
						}
						break;
					case ECF_A8R8G8B8:
						if (alpha == 256)
						{
							RenderLine32_Decal(this, p[0], p[1], color.color);
						}
						else
						{
							RenderLine32_Blend(this, p[0], p[1], color.color,
									alpha);
						}
						break;
					default:
					{
						break;
					}
				}
			}
		}
示例#22
0
void CDmeTrack::ShiftAllClipsBefore( DmeTime_t endTime, DmeTime_t dt, bool bTestEndingTime )
{
	if ( dt == DmeTime_t( 0 ) )
		return;

	int c = GetClipCount();
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pSubClip = GetClip( i );
		DmeTime_t testTime = bTestEndingTime ? pSubClip->GetEndTime() : pSubClip->GetStartTime();
		if ( endTime > testTime )
		{
			DmeTime_t startTime = pSubClip->GetStartTime();
			pSubClip->SetStartTime( startTime + dt );
		}
	}
}
示例#23
0
//-----------------------------------------------------------------------------
// Fills all gaps in a film track with slugs
//-----------------------------------------------------------------------------
void CDmeTrack::FillAllGapsWithSlugs( const char *pSlugName, DmeTime_t startTime, DmeTime_t endTime )
{
	if ( !IsFilmTrack() )
		return;

	FixOverlaps();

	// Create temporary slugs to fill in the gaps
	bool bSlugAdded = false;
	int c = GetClipCount();
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pFilmClip = GetClip(i);
		DmeTime_t clipStartTime = pFilmClip->GetStartTime();
		if ( clipStartTime > startTime )
		{
			// There's a gap, create a slug
			CDmeFilmClip *pSlug = CreateSlugClip( pSlugName, startTime, clipStartTime, GetFileId() );

			// This will add the slug to the end; so we don't have to
			// worry about iterating over it (we've cached off the initial count)
			AddClip( pSlug );

			bSlugAdded = true;
		}
		startTime = pFilmClip->GetEndTime();
	}

	if ( endTime > startTime )
	{
		// There's a gap, create a temporary slug
		CDmeFilmClip *pSlug = CreateSlugClip( pSlugName, startTime, endTime, GetFileId() );

		// This will add the slug to the end; so we don't have to
		// worry about iterating over it (we've cached off the initial count)
		AddClip( pSlug );

		bSlugAdded = true;
	}

	if ( bSlugAdded )
	{
		FixOverlaps();
	}
}
示例#24
0
//-----------------------------------------------------------------------------
// Finds a clip at a particular time
//-----------------------------------------------------------------------------
CDmeClip* CDmeTrack::FindFilmClipAtTime( DmeTime_t localTime )
{
	if ( !IsFilmTrack() || ( m_Clips.Count() == 0 ) )
		return NULL;

	// This algorithm requires sorted clips
	SortClipsByStartTime();

	int c = GetClipCount();
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pSubClip = GetClip( i );
		if ( pSubClip && pSubClip->GetStartTime() <= localTime && pSubClip->GetEndTime() > localTime )
			return pSubClip;
	}

	return NULL;
}
示例#25
0
PRBool
SimplePluginInstance::StartDraw(nsPluginWindow* window)
{
    NP_Port* port;
    Rect clipRect;
    RGBColor  col;
	
    if (window == NULL)
        return FALSE;
    port = (NP_Port*) window->window;
    if (window->clipRect.left < window->clipRect.right)
    {
	/* Preserve the old port */
        GetPort((GrafPtr*)&gOldPort);
        SetPort((GrafPtr)port->port);
	/* Preserve the old drawing environment */
        gSavePort.portRect = port->port->portRect;
        gSavePort.txFont = port->port->txFont;
        gSavePort.txFace = port->port->txFace;
        gSavePort.txMode = port->port->txMode;
        gSavePort.rgbFgColor = port->port->rgbFgColor;
        gSavePort.rgbBkColor = port->port->rgbBkColor;
        GetClip(gSavePort.clipRgn);
	/* Setup our drawing environment */
        clipRect.top = window->clipRect.top + port->porty;
        clipRect.left = window->clipRect.left + port->portx;
        clipRect.bottom = window->clipRect.bottom + port->porty;
        clipRect.right = window->clipRect.right + port->portx;
        SetOrigin(port->portx,port->porty);
        ClipRect(&clipRect);
        clipRect.top = clipRect.left = 0;
        TextSize(12);
        TextFont(geneva);
        TextMode(srcCopy);
        col.red = col.green = col.blue = 0;
        RGBForeColor(&col);
        col.red = col.green = col.blue = 65000;
        RGBBackColor(&col);
        return TRUE;
    }
    else
        return FALSE;
}
示例#26
0
//-----------------------------------------------------------------------------
// Shifts all clips to be non-overlapping
//-----------------------------------------------------------------------------
void CDmeTrack::FixOverlaps()
{
	int c = GetClipCount();
	if ( c <= 1 )
		return;

	SortClipsByStartTime();

	CSuppressAutoFixup suppress( this, SUPPRESS_OVERLAP_FIXUP | SUPPRESS_DIRTY_ORDERING );

	// Cull NULL clips
	int nActualCount = 0;
	CDmeClip **pClips = (CDmeClip**)_alloca( c * sizeof(CDmeClip*) );
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pCurr = GetClip( i );
		if ( pCurr && ((i == 0) || (pClips[i-1] != pCurr)) )
		{
			pClips[nActualCount++] = pCurr;
		}
	}

	if ( nActualCount <= 1 )
		return;

	CDmeClip *pPrev = pClips[0];
	for ( int i = 1; i < nActualCount; ++i )
	{
		CDmeClip *pCurr = pClips[i];

		DmeTime_t prevEndTime = pPrev->GetEndTime();
		DmeTime_t startTime = pCurr->GetStartTime();

		if ( startTime < prevEndTime )
		{
			pCurr->SetStartTime( prevEndTime );
		}

		pPrev = pCurr;
	}
}
示例#27
0
void CDmeTrack::SortClipsByStartTime( )
{
	// If we're not a film clip, then we haven't installed callbacks to make sorting fast.
	// The IS_SORTED flag is some random state
	if ( (m_ClipType == DMECLIP_FILM) && m_Flags.IsFlagSet( IS_SORTED ) )
		return;
	m_Flags.SetFlag( IS_SORTED );

	int c = GetClipCount();
	if ( c <= 1 )
		return;

	DmeTime_t lastTime;
	SortInfo_t *pSortInfo = (SortInfo_t*)_alloca( c * sizeof(SortInfo_t) );
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pSubClip = GetClip(i);
		pSortInfo[i].m_startTime = pSubClip ? pSubClip->GetStartTime() : DmeTime_t::InvalidTime();
		pSortInfo[i].m_pClip = pSubClip;
		if ( lastTime > pSortInfo[i].m_startTime )
		{
			m_Flags.ClearFlag( IS_SORTED );
		}
		lastTime = pSortInfo[i].m_startTime;
	}
	if ( m_Flags.IsFlagSet( IS_SORTED ) )
		return;

	m_Flags.SetFlag( IS_SORTED );
	qsort( pSortInfo, c, sizeof(SortInfo_t), ClipStartLessFunc );

	CSuppressAutoFixup suppress( this, SUPPRESS_OVERLAP_FIXUP | SUPPRESS_DIRTY_ORDERING );

	m_Clips.RemoveAll();

	for ( int i = 0; i < c; ++i )
	{
		m_Clips.AddToTail( pSortInfo[i].m_pClip );
	}
}
示例#28
0
/*	DisplayDialogCmd(theDialog, dlogItemNo, cmd)

	Displays the command in an IGOR-style dialog. See GBLoadWaveDialog.c
	for an example.
	
	dlogItemNo is the item number of the dialog item in which the command
	is to be displayed. On the Macintosh, this must be a user item. On Windows,
	it must be an EDITTEXT item.

	Thread Safety: DisplayDialogCmd is not thread-safe.
*/
void
DisplayDialogCmd(DialogPtr theDialog, int dlogItemNo, const char* cmd)
{
	WindowRef theWindow;
	CGrafPtr thePort;
	Rect box;
	int font, size;
	int lineHeight;
	FontInfo info;
	RgnHandle saveClipRgnH;
	
	theWindow = GetDialogWindow(theDialog);
	thePort = GetWindowPort(theWindow);
	
	font = GetPortTextFont(thePort);		// Save text characteristics.
	size = GetPortTextSize(thePort);

	TextFont(kFontIDMonaco);
	TextSize(9);
	GetFontInfo(&info);
	lineHeight = info.ascent + info.descent + info.leading;
	
	GetDBox(theDialog, dlogItemNo, &box);
	saveClipRgnH = NewRgn();
	if (saveClipRgnH != NULL) {
		GetClip(saveClipRgnH);
		ClipRect(&box);
		InsetRect(&box, 2, 2);
		EraseRect(&box);
		if (*cmd != 0) {
			MoveTo(box.left+2, box.top + info.ascent + 2);
			DrawDialogCmd(cmd, lineHeight);
		}
		SetClip(saveClipRgnH);
		DisposeRgn(saveClipRgnH);
	}

	TextFont(font);									// Restore font, size, style.
	TextSize(size);
}
示例#29
0
//-----------------------------------------------------------------------------
// Find first clip in a specific time range
//-----------------------------------------------------------------------------
CDmeClip* CDmeTrack::FindFirstFilmClipIntesectingTime( DmeTime_t localStartTime, DmeTime_t localEndTime )
{
	if ( !IsFilmTrack() || ( m_Clips.Count() == 0 ) )
		return NULL;

	// This algorithm requires sorted clips
	SortClipsByStartTime();

	int c = GetClipCount();
	for ( int i = 0; i < c; ++i )
	{
		CDmeClip *pSubClip = GetClip( i );
		if ( !pSubClip )
			continue;
		if ( ( localStartTime < pSubClip->GetEndTime() ) && ( localEndTime >= pSubClip->GetStartTime() ) )
			return static_cast<CDmeFilmClip*>( pSubClip );
		if ( localEndTime <= pSubClip->GetStartTime() )
			break;
	}

	return NULL;
}
示例#30
0
文件: CImage.cpp 项目: RoyLab/IrrAPI
//! draws a line from to with color
void CImage::drawLine(const core::position2d<s32>& from, const core::position2d<s32>& to, const SColor &color)
{
	AbsRectangle clip;
	GetClip( clip, this );

	core::position2d<s32> p[2];

	if ( ClipLine( clip, p[0], p[1], from, to ) )
	{
		u32 alpha = extractAlpha( color.color );

		switch ( Format )
		{
			case ECF_A1R5G5B5:
				if ( alpha == 256 )
				{
					RenderLine16_Decal( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ) );
				}
				else
				{
					RenderLine16_Blend( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ), alpha >> 3 );
				}
				break;
			case ECF_A8R8G8B8:
				if ( alpha == 256 )
				{
					RenderLine32_Decal( this, p[0], p[1], color.color );
				}
				else
				{
					RenderLine32_Blend( this, p[0], p[1], color.color, alpha );
				}
				break;
			default:
				break;
		}
	}
}