本文整理汇总了C++中LayerManager类的典型用法代码示例。如果您正苦于以下问题:C++ LayerManager类的具体用法?C++ LayerManager怎么用?C++ LayerManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LayerManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG
void
nsWindow::DoDraw(void)
{
if (!hal::GetScreenEnabled()) {
gDrawRequest = true;
return;
}
if (sTopWindows.IsEmpty()) {
LOG(" no window to draw, bailing");
return;
}
nsWindow *targetWindow = (nsWindow *)sTopWindows[0];
while (targetWindow->GetLastChild())
targetWindow = (nsWindow *)targetWindow->GetLastChild();
nsIWidgetListener* listener = targetWindow->GetWidgetListener();
if (listener) {
listener->WillPaintWindow(targetWindow);
}
LayerManager* lm = targetWindow->GetLayerManager();
if (mozilla::layers::LayersBackend::LAYERS_CLIENT == lm->GetBackendType()) {
// No need to do anything, the compositor will handle drawing
} else {
NS_RUNTIMEABORT("Unexpected layer manager type");
}
listener = targetWindow->GetWidgetListener();
if (listener) {
listener->DidPaintWindow();
}
}
示例2: Thread
void nsBaseWidget::CreateCompositor()
{
mCompositorThread = new Thread("CompositorThread");
mCompositorParent = new CompositorParent(this, mCompositorThread);
if (mCompositorThread->Start()) {
LayerManager* lm = CreateBasicLayerManager();
MessageLoop *childMessageLoop = mCompositorThread->message_loop();
mCompositorChild = new CompositorChild(lm);
AsyncChannel *parentChannel = mCompositorParent->GetIPCChannel();
AsyncChannel::Side childSide = mozilla::ipc::AsyncChannel::Child;
mCompositorChild->Open(parentChannel, childMessageLoop, childSide);
PLayersChild* shadowManager =
mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_OPENGL);
if (shadowManager) {
ShadowLayerForwarder* lf = lm->AsShadowForwarder();
if (!lf) {
delete lm;
mCompositorChild = nsnull;
return;
}
lf->SetShadowManager(shadowManager);
lf->SetParentBackendType(LayerManager::LAYERS_OPENGL);
mLayerManager = lm;
} else {
NS_WARNING("fail to construct LayersChild");
delete lm;
mCompositorChild = nsnull;
}
}
}
示例3: LOG
void
nsWindow::DoDraw(void)
{
if (!hal::GetScreenEnabled()) {
gDrawRequest = true;
return;
}
if (!gWindowToRedraw) {
LOG(" no window to draw, bailing");
return;
}
StopBootAnimation();
nsIntRegion region = gWindowToRedraw->mDirtyRegion;
gWindowToRedraw->mDirtyRegion.SetEmpty();
LayerManager* lm = gWindowToRedraw->GetLayerManager();
if (mozilla::layers::LAYERS_OPENGL == lm->GetBackendType()) {
LayerManagerOGL* oglm = static_cast<LayerManagerOGL*>(lm);
oglm->SetClippingRegion(region);
oglm->SetWorldTransform(sRotationMatrix);
if (nsIWidgetListener* listener = gWindowToRedraw->GetWidgetListener())
listener->PaintWindow(gWindowToRedraw, region, 0);
} else if (mozilla::layers::LAYERS_BASIC == lm->GetBackendType()) {
MOZ_ASSERT(sFramebufferOpen || sUsingOMTC);
nsRefPtr<gfxASurface> targetSurface;
if(sUsingOMTC)
targetSurface = sOMTCSurface;
else
targetSurface = Framebuffer::BackBuffer();
{
nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface);
gfxUtils::PathFromRegion(ctx, region);
ctx->Clip();
// No double-buffering needed.
AutoLayerManagerSetup setupLayerManager(
gWindowToRedraw, ctx, mozilla::layers::BUFFER_NONE,
ScreenRotation(EffectiveScreenRotation()));
if (nsIWidgetListener* listener = gWindowToRedraw->GetWidgetListener())
listener->PaintWindow(gWindowToRedraw, region, 0);
}
if (!sUsingOMTC) {
targetSurface->Flush();
Framebuffer::Present(region);
}
} else {
NS_RUNTIMEABORT("Unexpected layer manager type");
}
}
示例4: selectionChangedSlot
void LayerTableView::selectionChangedSlot(const QItemSelection&, const QItemSelection&)
{
QModelIndexList indexes = this->selectionModel()->selection().indexes();
if (indexes.count() == 1)
{
LayerManager* pManager = LayerManager::getInstance();
pManager->selectLayer(indexes.at(0).row());
}
}
示例5: LOG
void
nsWindow::DoDraw(void)
{
if (!hal::GetScreenEnabled()) {
gDrawRequest = true;
return;
}
if (!gWindowToRedraw) {
LOG(" no window to draw, bailing");
return;
}
nsPaintEvent event(true, NS_PAINT, gWindowToRedraw);
event.region = gWindowToRedraw->mDirtyRegion;
gWindowToRedraw->mDirtyRegion.SetEmpty();
LayerManager* lm = gWindowToRedraw->GetLayerManager();
if (LayerManager::LAYERS_OPENGL == lm->GetBackendType()) {
LayerManagerOGL* oglm = static_cast<LayerManagerOGL*>(lm);
oglm->SetClippingRegion(event.region);
oglm->SetWorldTransform(sRotationMatrix);
gWindowToRedraw->mEventCallback(&event);
} else if (LayerManager::LAYERS_BASIC == lm->GetBackendType()) {
MOZ_ASSERT(sFramebufferOpen || sUsingOMTC);
nsRefPtr<gfxASurface> targetSurface;
if(sUsingOMTC)
targetSurface = sOMTCSurface;
else
targetSurface = Framebuffer::BackBuffer();
{
nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface);
gfxUtils::PathFromRegion(ctx, event.region);
ctx->Clip();
// No double-buffering needed.
AutoLayerManagerSetup setupLayerManager(
gWindowToRedraw, ctx, BasicLayerManager::BUFFER_NONE);
gWindowToRedraw->mEventCallback(&event);
}
if (!sUsingOMTC) {
targetSurface->Flush();
Framebuffer::Present(event.region);
}
} else {
NS_RUNTIMEABORT("Unexpected layer manager type");
}
}
示例6: Thread
void nsBaseWidget::CreateCompositor()
{
mCompositorThread = new Thread("CompositorThread");
if (mCompositorThread->Start()) {
bool renderToEGLSurface = false;
#ifdef MOZ_JAVA_COMPOSITOR
renderToEGLSurface = true;
#endif
nsIntRect rect;
GetBounds(rect);
mCompositorParent =
new CompositorParent(this, mCompositorThread->message_loop(), mCompositorThread->thread_id(),
renderToEGLSurface, rect.width, rect.height);
LayerManager* lm = CreateBasicLayerManager();
MessageLoop *childMessageLoop = mCompositorThread->message_loop();
mCompositorChild = new CompositorChild(lm);
AsyncChannel *parentChannel = mCompositorParent->GetIPCChannel();
AsyncChannel::Side childSide = mozilla::ipc::AsyncChannel::Child;
mCompositorChild->Open(parentChannel, childMessageLoop, childSide);
PRInt32 maxTextureSize;
PLayersChild* shadowManager;
if (mUseAcceleratedRendering) {
shadowManager = mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_OPENGL, &maxTextureSize);
} else {
shadowManager = mCompositorChild->SendPLayersConstructor(LayerManager::LAYERS_BASIC, &maxTextureSize);
}
if (shadowManager) {
ShadowLayerForwarder* lf = lm->AsShadowForwarder();
if (!lf) {
delete lm;
mCompositorChild = nsnull;
return;
}
lf->SetShadowManager(shadowManager);
if (mUseAcceleratedRendering)
lf->SetParentBackendType(LayerManager::LAYERS_OPENGL);
else
lf->SetParentBackendType(LayerManager::LAYERS_BASIC);
lf->SetMaxTextureSize(maxTextureSize);
mLayerManager = lm;
} else {
// We don't currently want to support not having a LayersChild
NS_RUNTIMEABORT("failed to construct LayersChild");
delete lm;
mCompositorChild = nsnull;
}
}
}
示例7: GetInterceptor
//--------------------------------------------------------------------------
/// Check if the newly-started frame should be automatically traced at a specific frame.
/// \returns An eTraceType value, corresponding to the value set in the server config.
//--------------------------------------------------------------------------
int MultithreadedTraceAnalyzerLayer::GetTraceTypeFlags()
{
int traceTypeFlags = kTraceType_None;
// It's time to capture a frame. Check the trace type that was requested.
InterceptorBase* interceptor = GetInterceptor();
LayerManager* thisLayerManager = interceptor->GetParentLayerManager();
if (thisLayerManager->IsAutocaptureFrame())
{
traceTypeFlags = SG_GET_INT(OptionTraceType);
}
return traceTypeFlags;
}
示例8: GetLayerManager
PLayersParent*
RenderFrameParent::AllocPLayers(LayerManager::LayersBackend* aBackendType)
{
if (!mFrameLoader || mFrameLoaderDestroyed) {
*aBackendType = LayerManager::LAYERS_NONE;
return nsnull;
}
LayerManager* lm = GetLayerManager();
ShadowLayerManager* slm = lm->AsShadowManager();
if (!slm) {
*aBackendType = LayerManager::LAYERS_NONE;
return nsnull;
}
*aBackendType = lm->GetBackendType();
return new ShadowLayersParent(slm, this);
}
示例9: SendLayersDependentApzcTargetConfirmation
static void
SendLayersDependentApzcTargetConfirmation(nsIPresShell* aShell, uint64_t aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets)
{
LayerManager* lm = aShell->GetLayerManager();
if (!lm) {
return;
}
LayerTransactionChild* shadow = lm->AsShadowForwarder()->GetShadowManager();
if (!shadow) {
return;
}
shadow->SendSetConfirmedTargetAPZC(aInputBlockId, aTargets);
}
示例10:
void Cocos2dRenderManager::releaseAllVertexBuffer()
{
LayerManager* layers = LayerManager::getInstancePtr();
if (layers != nullptr)
{
LayerManager::EnumeratorLayer layer = layers->getEnumerator();
while (layer.next())
{
EnumeratorILayerNode layerNode = layer->getEnumerator();
while (layerNode.next())
{
layerNode->releaseVertexBuffer();
}
}
}
}
示例11: NS_ABORT_IF_FALSE
bool
TabChild::InitWidget(const nsIntSize& size)
{
NS_ABORT_IF_FALSE(!mWidget && !mRemoteFrame, "CreateWidget twice?");
mWidget = nsIWidget::CreatePuppetWidget(this);
if (!mWidget) {
NS_ERROR("couldn't create fake widget");
return false;
}
mWidget->Create(
nsnull, 0, // no parents
nsIntRect(nsIntPoint(0, 0), size),
nsnull, // HandleWidgetEvent
nsnull // nsIDeviceContext
);
RenderFrameChild* remoteFrame =
static_cast<RenderFrameChild*>(SendPRenderFrameConstructor());
if (!remoteFrame) {
NS_WARNING("failed to construct RenderFrame");
return false;
}
NS_ABORT_IF_FALSE(0 == remoteFrame->ManagedPLayersChild().Length(),
"shouldn't have a shadow manager yet");
PLayersChild* shadowManager = remoteFrame->SendPLayersConstructor();
if (!shadowManager) {
NS_WARNING("failed to construct LayersChild");
// This results in |remoteFrame| being deleted.
PRenderFrameChild::Send__delete__(remoteFrame);
return false;
}
LayerManager* lm = mWidget->GetLayerManager();
NS_ABORT_IF_FALSE(LayerManager::LAYERS_BASIC == lm->GetBackendType(),
"content processes should only be using BasicLayers");
BasicShadowLayerManager* bslm = static_cast<BasicShadowLayerManager*>(lm);
NS_ABORT_IF_FALSE(!bslm->HasShadowManager(),
"PuppetWidget shouldn't have shadow manager yet");
bslm->SetShadowManager(shadowManager);
mRemoteFrame = remoteFrame;
return true;
}
示例12: GetBounds
void nsBaseWidget::CreateCompositor()
{
bool renderToEGLSurface = false;
#ifdef MOZ_ANDROID_OMTC
renderToEGLSurface = true;
#endif
nsIntRect rect;
GetBounds(rect);
mCompositorParent =
new CompositorParent(this, renderToEGLSurface, rect.width, rect.height);
LayerManager* lm = CreateBasicLayerManager();
MessageLoop *childMessageLoop = CompositorParent::CompositorLoop();
mCompositorChild = new CompositorChild(lm);
AsyncChannel *parentChannel = mCompositorParent->GetIPCChannel();
AsyncChannel::Side childSide = mozilla::ipc::AsyncChannel::Child;
mCompositorChild->Open(parentChannel, childMessageLoop, childSide);
int32_t maxTextureSize;
PLayersChild* shadowManager;
mozilla::layers::LayersBackend backendHint =
mUseLayersAcceleration ? mozilla::layers::LAYERS_OPENGL : mozilla::layers::LAYERS_BASIC;
mozilla::layers::LayersBackend parentBackend;
shadowManager = mCompositorChild->SendPLayersConstructor(
backendHint, 0, &parentBackend, &maxTextureSize);
if (shadowManager) {
ShadowLayerForwarder* lf = lm->AsShadowForwarder();
if (!lf) {
delete lm;
mCompositorChild = nullptr;
return;
}
lf->SetShadowManager(shadowManager);
lf->SetParentBackendType(parentBackend);
lf->SetMaxTextureSize(maxTextureSize);
mLayerManager = lm;
} else {
// We don't currently want to support not having a LayersChild
NS_RUNTIMEABORT("failed to construct LayersChild");
delete lm;
mCompositorChild = nullptr;
}
}
示例13: editor
void TimeLine::deleteCurrentLayer()
{
LayerManager* layerMgr = editor()->layers();
QString strLayerName = layerMgr->currentLayer()->name();
int ret = QMessageBox::warning(this,
tr("Delete Layer", "Windows title of Delete current layer pop-up."),
tr("Are you sure you want to delete layer: ") + strLayerName + " ?",
QMessageBox::Ok | QMessageBox::Cancel,
QMessageBox::Ok);
if (ret == QMessageBox::Ok)
{
Status st = layerMgr->deleteLayer(editor()->currentLayerIndex());
if (st == Status::ERROR_NEED_AT_LEAST_ONE_CAMERA_LAYER)
{
QMessageBox::information(this, "",
tr("Please keep at least one camera layer in project"));
}
}
}
示例14: updateView
void LayerTableView::updateView()
{
//Select layer at init.
model->refreshModel();
this->resizeRowsToContents();
LayerManager* pManager = LayerManager::getInstance();
QList<LayerItem>* pList = pManager->getpLayerList();
int index = 0;
for (QList<LayerItem>::iterator it = pList->begin(); it != pList->end(); it++)
{
if (it->isSelected)
{
this->selectRow(index);
break;
}
index++;
}
this->update();
}
示例15: WillPaintWindow
void nsViewManager::WillPaintWindow(nsIWidget* aWidget)
{
if (aWidget) {
nsView* view = nsView::GetViewFor(aWidget);
LayerManager *manager = aWidget->GetLayerManager();
if (view &&
(view->ForcedRepaint() || !manager->NeedsWidgetInvalidation())) {
ProcessPendingUpdates();
// Re-get the view pointer here since the ProcessPendingUpdates might have
// destroyed it during CallWillPaintOnObservers.
view = nsView::GetViewFor(aWidget);
if (view) {
view->SetForcedRepaint(false);
}
}
}
nsCOMPtr<nsIPresShell> shell = mPresShell;
if (shell) {
shell->WillPaintWindow();
}
}