コード例 #1
0
bool
ClientLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
                                           void* aCallbackData,
                                           EndTransactionFlags)
{
  PROFILER_LABEL("ClientLayerManager", "EndTransactionInternal",
    js::ProfileEntry::Category::GRAPHICS);

#ifdef MOZ_LAYERS_HAVE_LOG
  MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
  Log();
#endif
  profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_START);

  NS_ASSERTION(InConstruction(), "Should be in construction phase");
  mPhase = PHASE_DRAWING;

  ClientLayer* root = ClientLayer::ToClientLayer(GetRoot());

  mTransactionIncomplete = false;
      
  // Apply pending tree updates before recomputing effective
  // properties.
  GetRoot()->ApplyPendingUpdatesToSubtree();
    
  mPaintedLayerCallback = aCallback;
  mPaintedLayerCallbackData = aCallbackData;

  GetRoot()->ComputeEffectiveTransforms(Matrix4x4());

  root->RenderLayer();
  if (!mRepeatTransaction && !GetRoot()->GetInvalidRegion().IsEmpty()) {
    GetRoot()->Mutated();
  }

  if (!mIsRepeatTransaction) {
    mAnimationReadyTime = TimeStamp::Now();
    GetRoot()->StartPendingAnimations(mAnimationReadyTime);
  }

  mPaintedLayerCallback = nullptr;
  mPaintedLayerCallbackData = nullptr;

  // Go back to the construction phase if the transaction isn't complete.
  // Layout will update the layer tree and call EndTransaction().
  mPhase = mTransactionIncomplete ? PHASE_CONSTRUCTION : PHASE_NONE;

  NS_ASSERTION(!aCallback || !mTransactionIncomplete,
               "If callback is not null, transaction must be complete");

  if (gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) {
    FrameLayerBuilder::InvalidateAllLayers(this);
  }

  return !mTransactionIncomplete;
}
コード例 #2
0
ファイル: KBinaryTree.cpp プロジェクト: Artorios/rootkit.com
VOID* KBinaryTree::SearchData(VOID* data, ULONG dwCompareParam)
{
  KLocker locker(&m_KSynchroObject);
  KBinaryTreeNode* pNode = GetRoot();
  VOID*       pData = NULL;

  if (pNode != NULL)
  {  
    pNode = pNode->SearchByNode(data, m_pCompare, dwCompareParam);
    if (pNode != NULL)
      pData = pNode->m_pData;
  }

  return pData;
}
コード例 #3
0
NS_IMETHODIMP
nsHTMLEditor::ShowInlineTableEditingUI(nsIDOMElement * aCell)
{
  NS_ENSURE_ARG_POINTER(aCell);

  // do nothing if aCell is not a table cell...
  if (!nsHTMLEditUtils::IsTableCell(aCell))
    return NS_OK;

  if (mInlineEditedCell) {
    NS_ERROR("call HideInlineTableEditingUI first");
    return NS_ERROR_UNEXPECTED;
  }

  // the resizers and the shadow will be anonymous children of the body
  nsIDOMElement *bodyElement = GetRoot();
  NS_ENSURE_TRUE(bodyElement, NS_ERROR_NULL_POINTER);

  CreateAnonymousElement(NS_LITERAL_STRING("a"), bodyElement,
                         NS_LITERAL_STRING("mozTableAddColumnBefore"),
                         PR_FALSE, getter_AddRefs(mAddColumnBeforeButton));
  CreateAnonymousElement(NS_LITERAL_STRING("a"), bodyElement,
                         NS_LITERAL_STRING("mozTableRemoveColumn"),
                         PR_FALSE, getter_AddRefs(mRemoveColumnButton));
  CreateAnonymousElement(NS_LITERAL_STRING("a"), bodyElement,
                         NS_LITERAL_STRING("mozTableAddColumnAfter"),
                         PR_FALSE, getter_AddRefs(mAddColumnAfterButton));

  CreateAnonymousElement(NS_LITERAL_STRING("a"), bodyElement,
                         NS_LITERAL_STRING("mozTableAddRowBefore"),
                         PR_FALSE, getter_AddRefs(mAddRowBeforeButton));
  CreateAnonymousElement(NS_LITERAL_STRING("a"), bodyElement,
                         NS_LITERAL_STRING("mozTableRemoveRow"),
                         PR_FALSE, getter_AddRefs(mRemoveRowButton));
  CreateAnonymousElement(NS_LITERAL_STRING("a"), bodyElement,
                         NS_LITERAL_STRING("mozTableAddRowAfter"),
                         PR_FALSE, getter_AddRefs(mAddRowAfterButton));

  AddMouseClickListener(mAddColumnBeforeButton);
  AddMouseClickListener(mRemoveColumnButton);
  AddMouseClickListener(mAddColumnAfterButton);
  AddMouseClickListener(mAddRowBeforeButton);
  AddMouseClickListener(mRemoveRowButton);
  AddMouseClickListener(mAddRowAfterButton);

  mInlineEditedCell = aCell;
  return RefreshInlineTableEditingUI();
}
コード例 #4
0
void
LayerManagerComposite::BeginTransaction()
{
  mInTransaction = true;
  
  if (!mCompositor->Ready()) {
    return;
  }
  
  mIsCompositorReady = true;

  if (Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL ||
      Compositor::GetBackend() == LayersBackend::LAYERS_BASIC) {
    mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
  }
}
コード例 #5
0
	FileInfo FileSourceFS::Lookup(const std::string &path)
	{
		const std::string fullpath = JoinPathBelow(GetRoot(), path);
		const std::wstring wfullpath = transcode_utf8_to_utf16(fullpath);
		DWORD attrs = GetFileAttributesW(wfullpath.c_str());
		const FileInfo::FileType ty = file_type_for_attributes(attrs);
		Time::DateTime modtime;
		if (ty == FileInfo::FT_FILE || ty == FileInfo::FT_DIR) {
			HANDLE hfile = CreateFileW(wfullpath.c_str(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
			if (hfile != INVALID_HANDLE_VALUE) {
				modtime = file_modtime_for_handle(hfile);
				CloseHandle(hfile);
			}
		}
		return MakeFileInfo(path, ty, modtime);
	}
コード例 #6
0
ファイル: Styx.cpp プロジェクト: kotetsuy/xiq
bool Styx::Update(GameTime time)
{
    Playfield const &pf = *GetPlayfield();

    // create set of possibile directions to move in
    std::vector<Direction> choices;
    for (int n = 0; n < 4; ++n)
    {
        Direction dir = (Direction::Type)n;

        // can't reverse direction
        if (dir.Opposite() == direction)
            continue;

        Playfield::Element element = pf.At(location + dir.GetVector());
        if (element == Playfield::Line)
        {
            choices.push_back(Direction::Type(n));
        }
    }

    // if we have no where to go, reverse
    if (choices.empty())
    {
        direction = direction.Opposite();
    }
    else
    {
        // choose new random direction
        SetDirection(choices[rand() % choices.size()]);

        if (move_toward_player && choices.size() > 1)
        {
            Point pos_player = GetRoot()->GetWorld()->GetPlayer()->GetLocation();
            float min_dist = 0;
            bool first = true;
            foreach (Direction dir, choices)
            {
                float dist = (location + dir.GetVector() - pos_player).Length();
                if (first || dist < min_dist)
                {
                    first = false;
                    min_dist = dist;
                    SetDirection(dir);
                }
            }
        }
コード例 #7
0
ファイル: BlurayDirectory.cpp プロジェクト: MrMC/mrmc
bool CBlurayDirectory::GetDirectory(const CURL& url, CFileItemList &items)
{
  Dispose();
  m_url = url;
  std::string root = m_url.GetHostName();
  std::string file = m_url.GetFileName();
  URIUtils::RemoveSlashAtEnd(file);
  URIUtils::RemoveSlashAtEnd(root);

  m_dll = new DllLibbluray();
  if (!m_dll->Load())
  {
    CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to load dll");
    return false;
  }

  m_dll->bd_register_dir(DllLibbluray::dir_open);
  m_dll->bd_register_file(DllLibbluray::file_open);
  m_dll->bd_set_debug_handler(DllLibbluray::bluray_logger);
  m_dll->bd_set_debug_mask(DBG_CRIT | DBG_BLURAY | DBG_NAV);

  m_bd = m_dll->bd_open(root.c_str(), NULL);

  if(!m_bd)
  {
    CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to open %s", root.c_str());
    return false;
  }

  if(file == "root")
    GetRoot(items);
  else if(file == "root/titles")
    GetTitles(false, items);
  else
  {
    CURL url2 = GetUnderlyingCURL(url);
    CDirectory::CHints hints;
    hints.flags = m_flags;
    if (!CDirectory::GetDirectory(url2, items, hints))
      return false;
  }

  items.AddSortMethod(SortByTrackNumber,  554, LABEL_MASKS("%L", "%D", "%L", ""));    // FileName, Duration | Foldername, empty
  items.AddSortMethod(SortBySize,         553, LABEL_MASKS("%L", "%I", "%L", "%I"));  // FileName, Size | Foldername, Size

  return true;
}
コード例 #8
0
ファイル: Question10.2.c プロジェクト: PatFin/B3157
//////////////////////////////////////////////////////////////////  PUBLIC
//---------------------------------------------------- Fonctions publiques
int main ( void )
{
	InitMemoire ( );
	racine = GetRoot ( );

	FILE * lecture = fopen ( "input.txt" , "r");

	uint64_t * nombre = malloc ( sizeof ( uint64_t ) );
	while ( EOF != (fscanf ( lecture, "%" PRIu64 "", nombre ) ) )
	{
		get_prime_factors ( * nombre );
		print_prime_factors ( * nombre );
	}

	End ( racine );
	return 0;
} //----- fin de Main
コード例 #9
0
	FileInfo FileSourceFS::Lookup(const std::string &path)
	{
		const std::string fullpath = JoinPathBelow(GetRoot(), path);
		struct stat statinfo;
		FileInfo::FileType ty;
		if (stat(fullpath.c_str(), &statinfo) == 0) {
			if (S_ISREG(statinfo.st_mode)) {
				ty = FileInfo::FT_FILE;
			} else if (S_ISDIR(statinfo.st_mode)) {
				ty = FileInfo::FT_DIR;
			} else {
				ty = FileInfo::FT_SPECIAL;
			}
		} else {
			ty = FileInfo::FT_NON_EXISTENT;
		}
		return MakeFileInfo(path, ty);
	}
コード例 #10
0
ファイル: DrawTree.cpp プロジェクト: bayesiancook/coevol
void BubbleTree::PrepareDrawing()	{

	DrawTree::PrepareDrawing();
	/*
	if (minmax)	{
		double max = ComputeMaxNodeVal(root);
		double min = ComputeMinNodeVal(root);
		cerr << min << '\t' << max << '\n';
		// exit(1);
		minnodeval = min;
		nodescale = maxnodeval / sqrt(max - min);
	}
	else	{
	*/
		double max = ComputeMaxNodeVal(GetRoot());
		nodescale = maxnodeval / exp(0.5 * nodepower * log(max));
	// }
}
コード例 #11
0
ファイル: PdfPagesTree.cpp プロジェクト: yjwong/podofo
void PdfPagesTree::DeletePageFromNode( PdfObject* pParent, const PdfObjectList & rlstParents, 
                                       int nIndex, PdfObject* pPage )
{
    if( !pParent || !pPage ) 
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    // 1. Delete the reference from the kids array of pParent
    // 2. Decrease count of every node in lstParents (which also includes pParent)
    // 3. Remove empty page nodes

    // TODO: Tell cache to free page object

    // 1. Delete reference
    this->DeletePageNode( pParent, nIndex ) ;

    // 2. Decrease count
    PdfObjectList::const_reverse_iterator itParents = rlstParents.rbegin();
    while( itParents != rlstParents.rend() )
    {
        this->ChangePagesCount( *itParents, -1 );

        ++itParents;
    } 

    // 3. Remove empty pages nodes
    itParents = rlstParents.rbegin();
    while( itParents != rlstParents.rend() )
    {
        // Never delete root node
        if( IsEmptyPageNode( *itParents ) && *itParents != GetRoot() ) 
        {
            PdfObject* pParentOfNode = *(itParents + 1);
            int nKidsIndex = this->GetPosInKids( *itParents, pParentOfNode );
            DeletePageNode( pParentOfNode, nKidsIndex );

            // Delete empty page nodes
            delete this->GetObject()->GetOwner()->RemoveObject( (*itParents)->Reference() );
        }

        ++itParents;
    } 
}
コード例 #12
0
ファイル: 1420.cpp プロジェクト: AiHaibara/acm-icpc
	inline void solve(void) {
		scanf("%d%d%d", &p, &a, &k);
		Divid(p - 1);
		if (p == 2) {
			if (k == 0) printf("%d\n%d\n", 1, 0);
			else printf("%d\n%d\n",1, 1);
			return;
		}
		int g = GetRoot(p);
		int tmp = Pow(g, a, p);
		VII ret = BabyStep(tmp, k, p);
		SII Ans;
		for (VII::iterator it = ret.begin(); it != ret.end(); it++) {
			Ans.insert(Pow(g, *it, p));
		}
		printf("%d\n", Ans.size());
		for (SII::iterator it = Ans.begin(); it != Ans.end(); it++)
			printf("%d\n", *it);
	}
コード例 #13
0
ファイル: editor.cpp プロジェクト: HackLinux/chandler-1
void wxXmlRcEditDocument::Upgrade()
{
    int v1,v2,v3,v4;
    long version;
    wxXmlNode *node = GetRoot();
    wxString verstr = wxT("0.0.0.0");
    node->GetPropVal(wxT("version"),verstr);
    if (wxSscanf(verstr.c_str(), wxT("%i.%i.%i.%i"),
        &v1, &v2, &v3, &v4) == 4)
        version = v1*256*256*256+v2*256*256+v3*256+v4;
    else
        version = 0;
    if (!version)
    {
        UpgradeNode(node);
    }
    node->DeleteProperty(wxT("version"));
    node->AddProperty(wxT("version"), WX_XMLRES_CURRENT_VERSION_STRING);
}
コード例 #14
0
void CPDF_Document::DeletePage(int iPage) {
  CPDF_Dictionary* pRoot = GetRoot();
  if (!pRoot) {
    return;
  }
  CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
  if (!pPages) {
    return;
  }
  int nPages = pPages->GetInteger("Count");
  if (iPage < 0 || iPage >= nPages) {
    return;
  }
  CFX_ArrayTemplate<CPDF_Dictionary*> stack;
  stack.Add(pPages);
  if (InsertDeletePDFPage(this, pPages, iPage, NULL, FALSE, stack) < 0) {
    return;
  }
  m_PageList.RemoveAt(iPage);
}
コード例 #15
0
// GetNamespaces
void COpcXmlDocument::GetNamespaces(COpcStringMap& cNamespaces)
{
    // clear the current set.
    cNamespaces.RemoveAll();

    // check for a valid root element.
    COpcXmlElement cElement(GetRoot());

    if (cElement == NULL)
    {
        return;
    }

    // add the namespace for the root element.
    COpcString cPrefix = cElement.GetPrefix();

    if (!cPrefix.IsEmpty())
    {
        cNamespaces[cPrefix] = cElement.GetNamespace();
    }

    // fetch the attributes from the root element.
    COpcXmlAttributeList cAttributes;

    if (cElement.GetAttributes(cAttributes) > 0)
    {
        for (UINT ii = 0; ii < cAttributes.GetSize(); ii++)
        {
            if (cAttributes[ii].GetPrefix() == OPCXML_NAMESPACE_ATTRIBUTE)
            {
                COpcString cName = cAttributes[ii].GetQualifiedName().GetName();

                // don't add the default namespace.
                if (!cName.IsEmpty())
                {
                    cNamespaces[cName] = cAttributes[ii].GetValue();
                }
            }
        }
    }
}
コード例 #16
0
NS_IMETHODIMP
nsHTMLEditor::HideInlineTableEditingUI()
{
  mInlineEditedCell = nsnull;

  RemoveMouseClickListener(mAddColumnBeforeButton);
  RemoveMouseClickListener(mRemoveColumnButton);
  RemoveMouseClickListener(mAddColumnAfterButton);
  RemoveMouseClickListener(mAddRowBeforeButton);
  RemoveMouseClickListener(mRemoveRowButton);
  RemoveMouseClickListener(mAddRowAfterButton);

  // get the presshell's document observer interface.
  nsCOMPtr<nsIPresShell> ps;
  GetPresShell(getter_AddRefs(ps));
  // We allow the pres shell to be null; when it is, we presume there
  // are no document observers to notify, but we still want to
  // UnbindFromTree.

  // get the root content node.

  nsIDOMElement *bodyElement = GetRoot();

  nsCOMPtr<nsIContent> bodyContent( do_QueryInterface(bodyElement) );
  NS_ENSURE_TRUE(bodyContent, NS_ERROR_FAILURE);

  DeleteRefToAnonymousNode(mAddColumnBeforeButton, bodyContent, ps);
  mAddColumnBeforeButton = nsnull;
  DeleteRefToAnonymousNode(mRemoveColumnButton, bodyContent, ps);
  mRemoveColumnButton = nsnull;
  DeleteRefToAnonymousNode(mAddColumnAfterButton, bodyContent, ps);
  mAddColumnAfterButton = nsnull;
  DeleteRefToAnonymousNode(mAddRowBeforeButton, bodyContent, ps);
  mAddRowBeforeButton = nsnull;
  DeleteRefToAnonymousNode(mRemoveRowButton, bodyContent, ps);
  mRemoveRowButton = nsnull;
  DeleteRefToAnonymousNode(mAddRowAfterButton, bodyContent, ps);
  mAddRowAfterButton = nsnull;

  return NS_OK;
}
コード例 #17
0
ファイル: BlurayDirectory.cpp プロジェクト: cpaowner/xbmc
bool CBlurayDirectory::GetDirectory(const CStdString& path, CFileItemList &items)
{
  Dispose();
  m_url.Parse(path);
  CStdString root = m_url.GetHostName();
  CStdString file = m_url.GetFileName();
  URIUtils::RemoveSlashAtEnd(file);

  m_dll = new DllLibbluray();
  if (!m_dll->Load())
  {
    CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to load dll");
    return false;
  }

  m_dll->bd_register_dir(DllLibbluray::dir_open);
  m_dll->bd_register_file(DllLibbluray::file_open);
  m_dll->bd_set_debug_handler(DllLibbluray::bluray_logger);
  m_dll->bd_set_debug_mask(DBG_CRIT | DBG_BLURAY | DBG_NAV);

  m_bd = m_dll->bd_open(root.c_str(), NULL);

  if(!m_bd)
  {
    CLog::Log(LOGERROR, "CBlurayDirectory::GetDirectory - failed to open %s", root.c_str());
    return false;
  }

  if(file == "")
    GetRoot(items);
  else if(file == "titles")
    GetTitles(false, items);
  else
    return false;

  items.AddSortMethod(SORT_METHOD_TRACKNUM , 554, LABEL_MASKS("%L", "%D", "%L", ""));    // FileName, Duration | Foldername, empty
  items.AddSortMethod(SORT_METHOD_SIZE     , 553, LABEL_MASKS("%L", "%I", "%L", "%I"));  // FileName, Size | Foldername, Size

  return true;
}
コード例 #18
0
ファイル: Button.cpp プロジェクト: BrainDamage/spring
bool Button::HandleEventSelf(const SDL_Event& ev)
{
	switch (ev.type) {
		case SDL_MOUSEBUTTONDOWN: {
			if ((ev.button.button == SDL_BUTTON_LEFT) && MouseOver(ev.button.x, ev.button.y) && gui->MouseOverElement(GetRoot(), ev.motion.x, ev.motion.y))
			{
				clicked = true;
			};
			break;
		}
		case SDL_MOUSEBUTTONUP: {
			if ((ev.button.button == SDL_BUTTON_LEFT) && MouseOver(ev.button.x, ev.button.y) && clicked)
			{
				if (!Clicked.empty())
				{
					Clicked();
				}
				else
				{
					LogObject() << "Button " << label << " clicked without callback";
				}
				clicked = false;
				return true;
			}
		}
		case SDL_MOUSEMOTION: {
			if (MouseOver(ev.motion.x, ev.motion.y) && gui->MouseOverElement(GetRoot(), ev.motion.x, ev.motion.y))
			{
				hovered = true;
			}
			else
			{
				hovered = false;
				clicked = false;
			}
			break;
		}
	}
	return false;
}
コード例 #19
0
	//! called during the initialization of the entity
	void SFXManager::Init()
	{
		super::Init();

		m_Root = GetRoot();

		m_PlayerPulseManager = static_cast<PulseManager*>(GetChildByName("PlayerPulseManager"));
		m_PlayerLaserManager = static_cast<LaserManager*>(GetChildByName("PlayerLaserManager"));
		m_PlayerPelletManager = static_cast<PelletManager*>(GetChildByName("PlayerPelletManager"));
		m_PlayerSidePulseManager = static_cast<PulseManager*>(GetChildByName("PlayerSidePulseManager"));
		m_PlayerSideLaserManager = static_cast<LaserManager*>(GetChildByName("PlayerSideLaserManager"));
		m_PlayerSidePelletManager = static_cast<PelletManager*>(GetChildByName("PlayerSidePelletManager"));
		m_EnemyPulseManager = static_cast<PulseManager*>(GetChildByName("EnemyPulseManager"));
		m_BossPulseManager = static_cast<PulseManager*>(GetChildByName("BossPulseManager"));		
		m_EnemyLaserManager = static_cast<LaserManager*>(GetChildByName("EnemyLaserManager"));
		m_EnemyPelletManager = static_cast<PelletManager*>(GetChildByName("EnemyPelletManager"));
	
		if(Entity* pSkyBox = m_Root->GetChildByType("SkyBoxEntity"))
		{
			m_SkyBoxMaterial = pSkyBox->GetComponent<GraphicComponent>()->GetMaterial();
		}
	}
コード例 #20
0
ファイル: savedstate.cpp プロジェクト: dluobo/ingex
/// Tries to open an existing file; if not, creates a new one.
/// Clears contents if unexpected root node name.
/// Reports problems in a message box.
/// @param parent Window to parent message boxes.
/// @param filename Name only of file - will be created in standard user config directory.
SavedState::SavedState(wxWindow * parent, const wxString & filename)
{
    mFilename = wxStandardPaths::Get().GetUserConfigDir() + wxFileName::GetPathSeparator() + filename;
    bool ok = false;
    if (!wxFile::Exists(mFilename)) {
        wxMessageDialog dlg(parent, wxT("No saved preferences file found.  Default values will be used."), wxT("No saved preferences"));
        dlg.ShowModal();
    }
    else if (!Load(mFilename)) { //already produces a warning message box
    }
    else if (wxT("Ingexgui") != GetRoot()->GetName()) {
        wxMessageDialog dlg(parent, wxT("Saved preferences file \"") + mFilename + wxT("\": has unrecognised data: re-creating with default values."), wxT("Unrecognised saved preferences"), wxICON_EXCLAMATION | wxOK);
        dlg.ShowModal();
    }
    else {
        ok = true;
    }
    if (!ok) {
        SetRoot(new wxXmlNode(wxXML_ELEMENT_NODE, wxT("Ingexgui")));
        Save();
    }
}
コード例 #21
0
ファイル: xml.cpp プロジェクト: 252525fb/rpcs3
bool wxXmlDocument::Save(wxOutputStream& stream, int indentstep) const
{
    if ( !IsOk() )
        return false;

    wxString s;

    wxMBConv *convMem = NULL,
             *convFile;

#if wxUSE_UNICODE
    convFile = new wxCSConv(GetFileEncoding());
    convMem = NULL;
#else
    if ( GetFileEncoding().CmpNoCase(GetEncoding()) != 0 )
    {
        convFile = new wxCSConv(GetFileEncoding());
        convMem = new wxCSConv(GetEncoding());
    }
    else // file and in-memory encodings are the same, no conversion needed
    {
        convFile =
        convMem = NULL;
    }
#endif

    s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
             GetVersion().c_str(), GetFileEncoding().c_str());
    OutputString(stream, s);

    OutputNode(stream, GetRoot(), 0, convMem, convFile, indentstep);
    OutputString(stream, wxT("\n"));

    delete convFile;
    delete convMem;

    return true;
}
コード例 #22
0
ファイル: showroot.c プロジェクト: axelmuhr/Helios-NG
int
main(int argc, char **argv)
{
	RootStruct *root = GetRoot();
	word maxav = 0;

	while (TRUE)
	{
		word av = root->LoadAverage;

		if (av > maxav) maxav = av;

	if (argc == 1)
	{
		printf("LowPriAv:  %8lu, HiPriLat:    %8lu, MaxLat: %8lu\n",
			av ,root->Latency,root->MaxLatency);
		printf("MaxAv: %lu\n", maxav);
		printf("LocalMsgs: %8lu, BuffMsgs:    %8lu, Time:  %8lu\n",
			root->LocalMsgs,root->BufferedMsgs,root->Time);
		printf("Timer:     %#8lx, %ld\n\n",
		       root->Timer, root->Timer);
	}
	else if (argc == 2)
	{
		IOdebug("LowPriAv:  %x, HiPriLat:    %x, MaxLat: %x",
			av ,root->Latency,root->MaxLatency);
		IOdebug("MaxAv: %x", maxav);
		IOdebug("LocalMsgs: %x, BuffMsgs:    %x, Time:  %x",
			root->LocalMsgs,root->BufferedMsgs,root->Time);
		IOdebug("Timer:  %x\n", root->Timer);
	}
	else
	{
		donowt(3);
	}
		Delay(OneSec);
	}
}
コード例 #23
0
	bool FileSourceFS::ReadDirectory(const std::string &dirpath, std::vector<FileInfo> &output)
	{
		size_t output_head_size = output.size();
		const std::wstring wsearchglob = transcode_utf8_to_utf16(JoinPathBelow(GetRoot(), dirpath)) + L"/*";
		WIN32_FIND_DATAW findinfo;
		HANDLE dirhandle = FindFirstFileW(wsearchglob.c_str(), &findinfo);
		DWORD err;

		if (dirhandle == INVALID_HANDLE_VALUE) {
			err = GetLastError();
			// if the directory was empty we succeeded even though FindFirstFile failed
			return (err == ERROR_FILE_NOT_FOUND);
		}

		do {
			std::string fname = transcode_utf16_to_utf8(findinfo.cFileName, wcslen(findinfo.cFileName));
			if (fname != "." && fname != "..") {
				const FileInfo::FileType ty = file_type_for_attributes(findinfo.dwFileAttributes);
				const Time::DateTime modtime = datetime_for_filetime(findinfo.ftLastWriteTime);
				output.push_back(MakeFileInfo(JoinPath(dirpath, fname), ty, modtime));
			}

			if (! FindNextFileW(dirhandle, &findinfo)) {
				err = GetLastError();
			} else
				err = ERROR_SUCCESS;
		} while (err == ERROR_SUCCESS);
		FindClose(dirhandle);

		if (err != ERROR_NO_MORE_FILES) {
			output.resize(output_head_size);
			return false;
		}

		std::sort(output.begin() + output_head_size, output.end());
		return true;
	}
コード例 #24
0
ファイル: nuiZoomView.cpp プロジェクト: YetToCome/nui3
bool nuiZoomView::Load(const nuiXMLNode* pNode)
{
  nuiComposite::Load(pNode);
  
  mAlwaysDisplayVScrollbar = false;
  mAlwaysDisplayHScrollbar = false;

  mHorizontalZoomLevel = 1.f;
  mVerticalZoomLevel = 1.f;

  nglString hscroll = nuiGetString(pNode, _T("HorizontalScrollBar"), nglString::Empty);
  nglString vscroll = nuiGetString(pNode, _T("VerticalScrollBar"), nglString::Empty);
  nglString hslider = nuiGetString(pNode, _T("HorizontalSlider"), nglString::Empty);
  nglString vslider = nuiGetString(pNode, _T("VerticalSlider"), nglString::Empty);

  nuiContainerPtr pTop = GetRoot();

  mpHorizontalScrollbar = dynamic_cast<nuiScrollBar*>(pTop->GetChild(hscroll));
  mpVerticalScrollbar = dynamic_cast<nuiScrollBar*>(pTop->GetChild(vscroll));
  mpHorizontalSlider = dynamic_cast<nuiSlider*>(pTop->GetChild(hslider));
  mpVerticalSlider = dynamic_cast<nuiSlider*>(pTop->GetChild(vslider));

  if (mpHorizontalScrollbar)
    mSVSink.Connect(mpHorizontalScrollbar->GetRange().ValueChanged, &nuiZoomView::Scrolled);
  if (mpVerticalScrollbar)
    mSVSink.Connect(mpVerticalScrollbar->GetRange().ValueChanged,   &nuiZoomView::Scrolled);

  if (mpHorizontalSlider)
    mSVSink.Connect(mpHorizontalSlider->GetRange().Changed, &nuiZoomView::Zoomed);
  if (mpVerticalSlider)
    mSVSink.Connect(mpVerticalSlider->GetRange().Changed,   &nuiZoomView::Zoomed);

  mSVSink.Connect(ChildAdded, &nuiZoomView::OnChildAdded);
  mSVSink.Connect(ChildDeleted, &nuiZoomView::OnChildRemoved);
  
  return true;
}
コード例 #25
0
NS_IMETHODIMP
HTMLEditor::HideInlineTableEditingUI()
{
  mInlineEditedCell = nullptr;

  RemoveMouseClickListener(mAddColumnBeforeButton);
  RemoveMouseClickListener(mRemoveColumnButton);
  RemoveMouseClickListener(mAddColumnAfterButton);
  RemoveMouseClickListener(mAddRowBeforeButton);
  RemoveMouseClickListener(mRemoveRowButton);
  RemoveMouseClickListener(mAddRowAfterButton);

  // get the presshell's document observer interface.
  nsCOMPtr<nsIPresShell> ps = GetPresShell();
  // We allow the pres shell to be null; when it is, we presume there
  // are no document observers to notify, but we still want to
  // UnbindFromTree.

  // get the root content node.
  nsCOMPtr<nsIContent> bodyContent = GetRoot();

  DeleteRefToAnonymousNode(mAddColumnBeforeButton, bodyContent, ps);
  mAddColumnBeforeButton = nullptr;
  DeleteRefToAnonymousNode(mRemoveColumnButton, bodyContent, ps);
  mRemoveColumnButton = nullptr;
  DeleteRefToAnonymousNode(mAddColumnAfterButton, bodyContent, ps);
  mAddColumnAfterButton = nullptr;
  DeleteRefToAnonymousNode(mAddRowBeforeButton, bodyContent, ps);
  mAddRowBeforeButton = nullptr;
  DeleteRefToAnonymousNode(mRemoveRowButton, bodyContent, ps);
  mRemoveRowButton = nullptr;
  DeleteRefToAnonymousNode(mAddRowAfterButton, bodyContent, ps);
  mAddRowAfterButton = nullptr;

  return NS_OK;
}
コード例 #26
0
ファイル: rpc2test.c プロジェクト: krichter722/coda
int main(void)
{
    long go;

    GetRoot();  /* Also creates a child process for transcribing stdout */
    GetParms();
    MakeFiles(); /* in test directory */

    InitRPC();

    MakeWorkers();
    GetConns();
    GetVar(&go, "Say when: ");
    DoBindings();
    MakeClients();

    /* wait for all clients to get ready */
    while (ClientsReady < Clients) LWP_DispatchProcess();

    LWP_NoYieldSignal((char *)&ClientsReady);
    LWP_WaitProcess((char *)main);  /* infinite wait */
    
    return 0; /* make compiler happy */
}
コード例 #27
0
ファイル: showmi.c プロジェクト: axelmuhr/Helios-NG
int main(int argc, char **argv)
{
	int i;
	RootStruct *root = GetRoot();
	MIInfo *mi = root->MISysMem;
	RRDCommon *rrdc;
	Memory *m;


	if(argc > 1 && !strcmp(argv[1],"-p"))
		waiting = TRUE;

	printf("Memory Indirection Information:\n");

	forever {
		word	tablesize = mi->MITableSize;
		word	*mitable = (word *)mi->MITable;

		if (tablesize == 0) {
			printf("memory indirection table has not been initialised yet\n");
			break;
		}

		printf("\nMITable = %8x\n",(word)mitable);
		printf("MITableSize = %d\n",tablesize);
		printf("freehandles = %d\n",mi->MIFreeSlots);

		for ( i=0; i < tablesize; i++) {
			rrdc = (RRDCommon *)mitable[i];

			if (rrdc == NULL)
				continue; /* unused slot in MI table */

			printf("Block: %d @ %#x size: %d",i,(word)rrdc,rrdc->TotalSize);

			m = ((Memory *)rrdc)-1;
			if(m->Size & Memory_Size_Reloc)
				puts(" is unlocked");
			else
				puts(" is LOCKED");
			
			switch (rrdc->Magic) {
				case RRDFileMagic:
				{
					RRDFileBlock *rrdf = (RRDFileBlock *)rrdc;
	
					printf("Type: File,  file Id: %d, name: /ram/sys/%s\n",rrdf->FileId,rrdf->FullName);
					break;		
				}
				case RRDDirMagic:
				{
					RRDDirBlock *rrdd = (RRDDirBlock *)rrdc;
	
					printf("Type: Directory, name: /ram/sys/%s\n",rrdd->FullName);
					break;		
				}

				case RRDBuffMagic:
				{
					RRDBuffBlock *rrdb = (RRDBuffBlock *)rrdc;
	
					printf("Type: File Buffer, file Id: %d PosInFile: %d\n",rrdb->FileId,rrdb->Pos);
					break;		
				}

				case RRDSymbMagic:
				{
					RRDSymbBlock *rrds = (RRDSymbBlock *)rrdc;
		
					printf("Type: Symbolic Link, /ram/sys/%s, -> %s\n",rrds->FullName,rrds->FullName + strlen(rrds->FullName) + 1);
					break;
				}
	
				default:
					printf("Unknown block type! (%#x)\n",rrdc->Magic);
			}
			putchar('\n');
		}

		if (!waiting)
			break;
		else
			Pause();
	}
}
コード例 #28
0
ファイル: prc_impl.cpp プロジェクト: gitgun/dLabPro
/**
 * Packs <code>nArgs<code> function arguments plus the zero-th argument (the
 * function itself) from <code>iCaller</code>'s stack into the data transfer
 * object <code>iDto</code>.
 */
void CGEN_PROTECTED CProcess::Marshal
(
  CDlpObject* iDto,
  CFunction*  iCaller,
  INT32       nArgs
)
{
  CData*      idSign  = NULL;                                                   // Signature table
  StkItm*     pStkItm = NULL;                                                   // Stack item to marshal
  INT32       nArg    = 0;                                                      // Argument loop counter
#ifndef USE_FORK
  CDlpObject* iRoot   = NULL;
  CDlpObject* iSrc    = NULL;
  CDlpObject* iDst    = NULL;
  CData*      idGlob  = NULL;                                                   // Globals table
  CData*      idIncl  = NULL;                                                   // Includes table
  hscan_t     hs;
  hnode_t*    hn;
  SWord*      lpWord  = NULL;
  char*       psClsName;
  char*       psInsName;
#endif

  // Marshal function arguments                                                 // ------------------------------------
  idSign = (CData*)CDlpObject_Instantiate(iDto,"data",PRC_S_IDSIGN,FALSE);      // Create signature table
  CData_AddComp(idSign,"name",L_SSTR);                                          // Add component to table
  for (nArg=0; nArg<=nArgs; nArg++)                                             // Loop over arguments
  {                                                                             // >>
    pStkItm = iCaller->StackGet(0);                                             //   Get stack top
    Pack(iDto,idSign,pStkItm,NULL);                                             //   Pack into data transfer object
    iCaller->Pop(FALSE);                                                        //   Remove stack top
  }                                                                             // <<

#ifndef USE_FORK
  // Marshal global variables                                                   // ------------------------------------
  iRoot = GetRoot();                                                            // Get root function
  if (m_bGlobal && iRoot)                                                       // /global option set
  {                                                                             // >>
    idGlob = (CData*)CDlpObject_Instantiate(iDto,"data",PRC_S_IDGLOB,FALSE);    //   Create globals table
    CData_AddComp(idGlob,"clas",L_SSTR);                                        //   Add component to table
    CData_AddComp(idGlob,"name",L_SSTR);                                        //   Add component to table
    hash_scan_begin(&hs,iRoot->m_lpDictionary);                                 //   Initialize
    while ((hn = hash_scan_next(&hs))!=NULL)                                    //   Loop over root function's dict.
    {                                                                           //   >>
      lpWord = (SWord*)hnode_get(hn);                                           //     Get pointer to SWord struct
      if ((lpWord->nWordType == WL_TYPE_INSTANCE) && lpWord->lpData)            //     Entry is a non-NULL instance
      {                                                                         //     >>
        iSrc = (CDlpObject*)lpWord->lpData;                                     //       Get instance pointer
        psClsName = iSrc->m_lpClassName;                                        //       Get pointer to class name
        psInsName = iSrc->m_lpInstanceName;                                     //       Get pointer to instance name
        //if (CDlpObject_OfKind("function",iSrc)) continue;                     //       No functions, please
        if (iSrc==iCaller) continue;                                            //       Not the caller!
        if (iSrc->m_nClStyle & CS_SINGLETON) continue;                          //       No singletons!
        if (CDlpObject_FindInstanceWord(m_iDto,psInsName,NULL)) continue;       //       Shadowed by an argument
        iDst = CDlpObject_Instantiate(m_iDto,psClsName,psInsName,FALSE);        //       Create copy to pack
        iDst->Copy(iSrc);                                                       //       Copy content
        CData_AddRecs(idGlob,1,10);                                             //       Add index entry
        CData_Sstore(idGlob,psClsName,CData_GetNRecs(idGlob)-1,0);              //       Write index entry
        CData_Sstore(idGlob,psInsName,CData_GetNRecs(idGlob)-1,1);              //       Write index entry
      }                                                                         //     <<
    }                                                                           //   <<
  }                                                                             // <<

  // Marshal includes                                                           // ------------------------------------
  if (m_bInclude && iRoot)                                                      // /include option set
  {                                                                             // >>
    idIncl = (CData*)CDlpObject_Instantiate(iDto,"data",PRC_S_IDINCL,FALSE);    //   Create include table
    CData_Copy(idIncl,((CFunction*)iRoot)->m_idSfl);                            //   Copy includes
  }                                                                             // <<
#endif
}
コード例 #29
0
float
LayerManagerComposite::ComputeRenderIntegrity()
{
  // We only ever have incomplete rendering when progressive tiles are enabled.
  Layer* root = GetRoot();
  if (!gfxPlatform::GetPlatform()->UseProgressivePaint() || !root) {
    return 1.f;
  }

  FrameMetrics rootMetrics = LayerMetricsWrapper::TopmostScrollableMetrics(root);
  if (!rootMetrics.IsScrollable()) {
    // The root may not have any scrollable metrics, in which case rootMetrics
    // will just be an empty FrameMetrics. Instead use the actual metrics from
    // the root layer.
    rootMetrics = LayerMetricsWrapper(root).Metrics();
  }
  ParentLayerIntRect bounds = RoundedToInt(rootMetrics.GetCompositionBounds());
  IntRect screenRect(bounds.x,
                       bounds.y,
                       bounds.width,
                       bounds.height);

  float lowPrecisionMultiplier = 1.0f;
  float highPrecisionMultiplier = 1.0f;

#ifdef MOZ_WIDGET_ANDROID
  // Use the transform on the primary scrollable layer and its FrameMetrics
  // to find out how much of the viewport the current displayport covers
  nsTArray<Layer*> rootScrollableLayers;
  GetRootScrollableLayers(rootScrollableLayers);
  if (rootScrollableLayers.Length() > 0) {
    // This is derived from the code in
    // AsyncCompositionManager::TransformScrollableLayer
    Layer* rootScrollable = rootScrollableLayers[0];
    const FrameMetrics& metrics = LayerMetricsWrapper::TopmostScrollableMetrics(rootScrollable);
    Matrix4x4 transform = rootScrollable->GetEffectiveTransform();
    transform.PostScale(metrics.GetPresShellResolution(), metrics.GetPresShellResolution(), 1);

    // Clip the screen rect to the document bounds
    Rect documentBounds =
      transform.TransformBounds(Rect(metrics.GetScrollableRect().x - metrics.GetScrollOffset().x,
                                     metrics.GetScrollableRect().y - metrics.GetScrollOffset().y,
                                     metrics.GetScrollableRect().width,
                                     metrics.GetScrollableRect().height));
    documentBounds.RoundOut();
    screenRect = screenRect.Intersect(IntRect(documentBounds.x, documentBounds.y,
                                                documentBounds.width, documentBounds.height));

    // If the screen rect is empty, the user has scrolled entirely into
    // over-scroll and so we can be considered to have full integrity.
    if (screenRect.IsEmpty()) {
      return 1.0f;
    }

    // Work out how much of the critical display-port covers the screen
    bool hasLowPrecision = false;
    if (!metrics.GetCriticalDisplayPort().IsEmpty()) {
      hasLowPrecision = true;
      highPrecisionMultiplier =
        GetDisplayportCoverage(metrics.GetCriticalDisplayPort(), transform, screenRect);
    }

    // Work out how much of the display-port covers the screen
    if (!metrics.GetDisplayPort().IsEmpty()) {
      if (hasLowPrecision) {
        lowPrecisionMultiplier =
          GetDisplayportCoverage(metrics.GetDisplayPort(), transform, screenRect);
      } else {
        lowPrecisionMultiplier = highPrecisionMultiplier =
          GetDisplayportCoverage(metrics.GetDisplayPort(), transform, screenRect);
      }
    }
  }

  // If none of the screen is covered, we have zero integrity.
  if (highPrecisionMultiplier <= 0.0f && lowPrecisionMultiplier <= 0.0f) {
    return 0.0f;
  }
#endif // MOZ_WIDGET_ANDROID

  nsIntRegion screenRegion(screenRect);
  nsIntRegion lowPrecisionScreenRegion(screenRect);
  Matrix4x4 transform;
  ComputeRenderIntegrityInternal(root, screenRegion,
                                 lowPrecisionScreenRegion, transform);

  if (!screenRegion.IsEqual(screenRect)) {
    // Calculate the area of the region. All rects in an nsRegion are
    // non-overlapping.
    float screenArea = screenRect.width * screenRect.height;
    float highPrecisionIntegrity = screenRegion.Area() / screenArea;
    float lowPrecisionIntegrity = 1.f;
    if (!lowPrecisionScreenRegion.IsEqual(screenRect)) {
      lowPrecisionIntegrity = lowPrecisionScreenRegion.Area() / screenArea;
    }

    return ((highPrecisionIntegrity * highPrecisionMultiplier) +
            (lowPrecisionIntegrity * lowPrecisionMultiplier)) / 2;
  }

  return 1.f;
}
コード例 #30
0
bool
ClientLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
                                           void* aCallbackData,
                                           EndTransactionFlags)
{
  PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Rasterization);
  AutoProfilerTracing tracing("Paint", "Rasterize");

  Maybe<TimeStamp> startTime;
  if (gfxPrefs::LayersDrawFPS()) {
    startTime = Some(TimeStamp::Now());
  }

#ifdef WIN32
  if (aCallbackData) {
    // Content processes don't get OnPaint called. So update here whenever we
    // may do Thebes drawing.
    gfxDWriteFont::UpdateClearTypeUsage();
  }
#endif

  AUTO_PROFILER_LABEL("ClientLayerManager::EndTransactionInternal", GRAPHICS);

#ifdef MOZ_LAYERS_HAVE_LOG
  MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
  Log();
#endif

  NS_ASSERTION(InConstruction(), "Should be in construction phase");
  mPhase = PHASE_DRAWING;

  ClientLayer* root = ClientLayer::ToClientLayer(GetRoot());

  mTransactionIncomplete = false;

  // Apply pending tree updates before recomputing effective
  // properties.
  GetRoot()->ApplyPendingUpdatesToSubtree();

  mPaintedLayerCallback = aCallback;
  mPaintedLayerCallbackData = aCallbackData;

  GetRoot()->ComputeEffectiveTransforms(Matrix4x4());

  // Skip the painting if the device is in device-reset status.
  if (!gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) {
    if (gfxPrefs::AlwaysPaint() && XRE_IsContentProcess()) {
      TimeStamp start = TimeStamp::Now();
      root->RenderLayer();
      mLastPaintTime = TimeStamp::Now() - start;
    } else {
      root->RenderLayer();
    }
  } else {
    gfxCriticalNote << "LayerManager::EndTransaction skip RenderLayer().";
  }

  if (!mRepeatTransaction && !GetRoot()->GetInvalidRegion().IsEmpty()) {
    GetRoot()->Mutated();
  }

  if (!mIsRepeatTransaction) {
    mAnimationReadyTime = TimeStamp::Now();
    GetRoot()->StartPendingAnimations(mAnimationReadyTime);
  }

  mPaintedLayerCallback = nullptr;
  mPaintedLayerCallbackData = nullptr;

  // Go back to the construction phase if the transaction isn't complete.
  // Layout will update the layer tree and call EndTransaction().
  mPhase = mTransactionIncomplete ? PHASE_CONSTRUCTION : PHASE_NONE;

  NS_ASSERTION(!aCallback || !mTransactionIncomplete,
               "If callback is not null, transaction must be complete");

  if (gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) {
    FrameLayerBuilder::InvalidateAllLayers(this);
  }

  if (startTime) {
    PaintTiming& pt = mForwarder->GetPaintTiming();
    pt.rasterMs() = (TimeStamp::Now() - startTime.value()).ToMilliseconds();
  }

  return !mTransactionIncomplete;
}