Example #1
0
/********************************************************************************************

>	BOOL MaskedFilterExportOptions::CopyFromMasked(MaskedFilterExportOptions *pOther) 

	Author:		Stefan_Stoykov (Xara Group Ltd) <*****@*****.**>
	Created:	15/07/97
	Inputs:		pOther - the other MaskedFilterExportOptions object to copy the data from
	Purpose:	Sets the contents of this object from the passed object. This differs form the
				more general function in that it  doesn't require the two objects to be of the
				same class. Used to convert from/to PNG options and MakeBitmapExportOptions.
	See Also:	BitmapExportOptions::MakeCopy()

********************************************************************************************/
BOOL MaskedFilterExportOptions::CopyFromMasked(MaskedFilterExportOptions *pOther) 
{
	if (pOther == NULL)
		return FALSE;
	
	//BitmapExportOptions members
	m_SelectionType		= pOther->m_SelectionType;
	m_OutputSize		= pOther->m_OutputSize;
	m_PixelOutputSize	= pOther->m_PixelOutputSize;
	m_pBmpDlgParam		= pOther->m_pBmpDlgParam;		
	m_NumColsInPalette	= pOther->m_NumColsInPalette;
	m_UseSystemColours	= pOther->m_UseSystemColours;
	m_bSeparateLayerFiles = pOther->m_bSeparateLayerFiles;
	m_bTempFileFlag		= pOther->m_bTempFileFlag;

	SetDPI(pOther->GetDPI());
	SetDepth(pOther->GetDepth());
	SetTransparencyIndex(pOther->GetTransparencyIndex());
	if (pOther->IsValid())
		MarkValid();
	else
		MarkInvalid();

	//MaskedFilterExportOptions
	m_Dither		= pOther->m_Dither;
	m_bInterlaced	= pOther->m_bInterlaced;

	return TRUE;
}
Example #2
0
void gxViewElement::Validate()
{
    // Keep whether I was invalid before validating the children.
    bool iWasInvalid = IsInvalid();
    
    // Mark me as valid - notice the comment below. If MarkValid() would come
    // after the validation of the descendants, it would override them possibly
    // setting this view element to invalid.
    MarkValid();
    
    
    Iterator iChildren( GetChildren() );
    
    // Ask all children to validate themselves in case they are invalid.
    // Notice that validate on descendants may trigger invalidation and will
    // mark this view element as invalid again.
    for ( iChildren.First(); iChildren.Current(); iChildren.Next() )
    {
        if ( iChildren.Current()->IsntValid() )
            iChildren.Current()->Validate();
    }

    // If I was invalid before validating the descendants, and if I'm not
    // invalid now (because my descendants have marked me as such) - validate
    // me and perform the layout. (If I am invalid now, then the next validation
    // event will lead to my validation.
    if ( iWasInvalid && IsntInvalid() )
    {
        DoValidate();
        Layout();
    }
}
Example #3
0
ud_t *newuserdata(lua_State *L, void *ptr, const char *mt)
    {
    ud_t *ud;
    ud = (ud_t*)udata_new(L, sizeof(ud_t), ptr, mt);
    memset(ud, 0, sizeof(ud_t));
    ud->obj = ptr ? ptr : (void*)ud;
    MarkValid(ud);
    return ud;
    }
Example #4
0
nsresult
nsCacheEntry::RequestAccess(nsCacheRequest * request, nsCacheAccessMode *accessGranted)
{
    nsresult  rv = NS_OK;
    
    if (!IsInitialized()) {
        // brand new, unbound entry
        request->mKey = nsnull;  // steal ownership of the key string
        if (request->IsStreamBased())  MarkStreamBased();
        MarkInitialized();

        *accessGranted = request->AccessRequested() & nsICache::ACCESS_WRITE;
        NS_ASSERTION(*accessGranted, "new cache entry for READ-ONLY request");
        PR_APPEND_LINK(request, &mRequestQ);
        return rv;
    }
    
    if (IsDoomed()) return NS_ERROR_CACHE_ENTRY_DOOMED;

    if (IsStreamData() != request->IsStreamBased()) {
        *accessGranted = nsICache::ACCESS_NONE;
        return request->IsStreamBased() ?
            NS_ERROR_CACHE_DATA_IS_NOT_STREAM : NS_ERROR_CACHE_DATA_IS_STREAM;
    }

    if (PR_CLIST_IS_EMPTY(&mDescriptorQ)) {
        // 1st descriptor for existing bound entry
        *accessGranted = request->AccessRequested();
        if (*accessGranted & nsICache::ACCESS_WRITE) {
            MarkInvalid();
        } else {
            MarkValid();
        }
    } else {
        // nth request for existing, bound entry
        *accessGranted = request->AccessRequested() & ~nsICache::ACCESS_WRITE;
        if (!IsValid())
            rv = NS_ERROR_CACHE_WAIT_FOR_VALIDATION;
    }
    PR_APPEND_LINK(request,&mRequestQ);

    return rv;
}