当前位置: 首页>>代码示例>>C++>>正文


C++ GraphicsLayer类代码示例

本文整理汇总了C++中GraphicsLayer的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsLayer类的具体用法?C++ GraphicsLayer怎么用?C++ GraphicsLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GraphicsLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: resetGameState

//---------------------------------------------------------------------------------
// Name: resetGame() 
//---------------------------------------------------------------------------------
void GameplayState::resetGame()
{
    resetGameState();

    memset(m_tdata, 0, sizeof(unsigned) * 4 );
    m_map_complete_time = 0;

    BATTLE_CITY->resetMap();
    BATTLE_CITY->resetPlayers();

    // set layers position
    GraphicsLayer * tp = LAYER_MGR->findLayer(BOTTOM_LAYER);
    GraphicsLayer * bt = LAYER_MGR->findLayer(TOP_LAYER);

    assert( tp && bt );

    unsigned w, h;
    w = MAP_MGR->getMapWidthPx();
    h = MAP_MGR->getMapHeightPx();

    unsigned x, y;
    x = (BASE_SCREEN_WIDTH - w ) >> 1;
    y = (BASE_SCREEN_HEIGHT - h ) >> 1;

    tp->setPosition( x, y );
    bt->setPosition( x, y );
}
开发者ID:viktormoskalenko,项目名称:battle_city,代码行数:30,代码来源:gameplay_state.cpp

示例2: fadeKeyframes

void WebInspectorClient::showPaintRect(const FloatRect& rect)
{
    if (!m_paintRectOverlay) {
        m_paintRectOverlay = PageOverlay::create(this, PageOverlay::OverlayType::Document);
        m_page->installPageOverlay(m_paintRectOverlay, PageOverlay::FadeMode::DoNotFade);
    }

    if (!m_paintIndicatorLayerClient)
        m_paintIndicatorLayerClient = std::make_unique<RepaintIndicatorLayerClient>(*this);

    std::unique_ptr<GraphicsLayer> paintLayer = GraphicsLayer::create(m_page->drawingArea()->graphicsLayerFactory(), *m_paintIndicatorLayerClient);
    
    paintLayer->setAnchorPoint(FloatPoint3D());
    paintLayer->setPosition(rect.location());
    paintLayer->setSize(rect.size());
    paintLayer->setBackgroundColor(Color(1.0f, 0.0f, 0.0f, 0.2f));

    KeyframeValueList fadeKeyframes(AnimatedPropertyOpacity);
    OwnPtr<AnimationValue> intialValue = FloatAnimationValue::create(0, 1);
    fadeKeyframes.insert(intialValue.release());

    OwnPtr<AnimationValue> finalValue = FloatAnimationValue::create(0.25, 0);
    fadeKeyframes.insert(finalValue.release());
    
    RefPtr<Animation> opacityAnimation = Animation::create();
    opacityAnimation->setDuration(0.25);

    paintLayer->addAnimation(fadeKeyframes, FloatSize(), opacityAnimation.get(), ASCIILiteral("opacity"), 0);
    
    m_paintRectLayers.add(paintLayer.get());

    GraphicsLayer* overlayRootLayer = m_paintRectOverlay->layer();
    overlayRootLayer->addChild(paintLayer.release());
}
开发者ID:chenbk85,项目名称:webkit2-wincairo,代码行数:34,代码来源:WebInspectorClient.cpp

示例3: ASSERT

void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer)
{
    ASSERT(layer->isComposited());

    GraphicsLayer* hostingLayer = layer->backing()->parentForSublayers();
    hostingLayer->removeAllChildren();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:7,代码来源:RenderLayerCompositor.cpp

示例4: setBackgroundBlurOnNode

void Internals::setBackgroundBlurOnNode(Node* node, int blurLength, ExceptionCode& ec)
{
    if (!node) {
        ec = INVALID_ACCESS_ERR;
        return;
    }

    RenderObject* renderObject = node->renderer();
    if (!renderObject) {
        ec = INVALID_NODE_TYPE_ERR;
        return;
    }

    RenderLayer* renderLayer = renderObject->enclosingLayer();
    if (!renderLayer || !renderLayer->isComposited()) {
        ec = INVALID_STATE_ERR;
        return;
    }

    GraphicsLayer* graphicsLayer = renderLayer->backing()->graphicsLayer();
    if (!graphicsLayer) {
        ec = INVALID_NODE_TYPE_ERR;
        return;
    }

    PlatformLayer* platformLayer = graphicsLayer->platformLayer();
    if (!platformLayer) {
        ec = INVALID_NODE_TYPE_ERR;
        return;
    }

    FilterOperations filters;
    filters.operations().append(BlurFilterOperation::create(Length(blurLength, Fixed), FilterOperation::BLUR));
    platformLayer->setBackgroundFilters(filters);
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例5: layerByID

void LayerTreeRenderer::setAnimatedTransform(uint32_t id, const WebCore::TransformationMatrix& transform)
{
    GraphicsLayer* layer = layerByID(id);
    ASSERT(layer);

    layer->setTransform(transform);
}
开发者ID:gobihun,项目名称:webkit,代码行数:7,代码来源:LayerTreeRenderer.cpp

示例6: ASSERT

void PinchViewports::setupScrollbar(WebScrollbar::Orientation orientation)
{
    bool isHorizontal = orientation == WebScrollbar::Horizontal;
    GraphicsLayer* scrollbarGraphicsLayer = isHorizontal ?
        m_overlayScrollbarHorizontal.get() : m_overlayScrollbarVertical.get();
    OwnPtr<WebScrollbarLayer>& webScrollbarLayer = isHorizontal ?
        m_webOverlayScrollbarHorizontal : m_webOverlayScrollbarVertical;

    const int overlayScrollbarThickness = m_owner->settingsImpl()->pinchOverlayScrollbarThickness();

    if (!webScrollbarLayer) {
        WebCore::ScrollingCoordinator* coordinator = m_owner->page()->scrollingCoordinator();
        ASSERT(coordinator);
        WebCore::ScrollbarOrientation webcoreOrientation = isHorizontal ? WebCore::HorizontalScrollbar : WebCore::VerticalScrollbar;
        webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(webcoreOrientation, overlayScrollbarThickness, false);

        webScrollbarLayer->setScrollLayer(m_innerViewportScrollLayer->platformLayer());
        scrollbarGraphicsLayer->setContentsToPlatformLayer(webScrollbarLayer->layer());
        scrollbarGraphicsLayer->setDrawsContent(false);
    }

    int xPosition = isHorizontal ? 0 : m_innerViewportContainerLayer->size().width() - overlayScrollbarThickness;
    int yPosition = isHorizontal ? m_innerViewportContainerLayer->size().height() - overlayScrollbarThickness : 0;
    int width = isHorizontal ? m_innerViewportContainerLayer->size().width() - overlayScrollbarThickness : overlayScrollbarThickness;
    int height = isHorizontal ? overlayScrollbarThickness : m_innerViewportContainerLayer->size().height() - overlayScrollbarThickness;

    scrollbarGraphicsLayer->setPosition(WebCore::IntPoint(xPosition, yPosition));
    scrollbarGraphicsLayer->setSize(WebCore::IntSize(width, height));
}
开发者ID:ychaim,项目名称:chromium.bb,代码行数:29,代码来源:PinchViewports.cpp

示例7: updateSettingsForLayer

void PageOverlayController::updateSettingsForLayer(GraphicsLayer& layer)
{
    Settings& settings = m_mainFrame.settings();
    layer.setAcceleratesDrawing(settings.acceleratedDrawingEnabled());
    layer.setShowDebugBorder(settings.showDebugBorders());
    layer.setShowRepaintCounter(settings.showRepaintCounter());
}
开发者ID:quanmo,项目名称:webkit,代码行数:7,代码来源:PageOverlayController.cpp

示例8: findFullscreenVideoLayoutObject

void PaintLayerCompositor::applyOverlayFullscreenVideoAdjustmentIfNeeded()
{
    m_inOverlayFullscreenVideo = false;
    if (!m_rootContentLayer)
        return;

    bool isLocalRoot = m_layoutView.frame()->isLocalRoot();
    LayoutVideo* video = findFullscreenVideoLayoutObject(m_layoutView.document());
    if (!video || !video->layer()->hasCompositedLayerMapping() || !video->videoElement()->usesOverlayFullscreenVideo()) {
        if (isLocalRoot) {
            GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer();
            if (backgroundLayer && !backgroundLayer->parent())
                rootFixedBackgroundsChanged();
        }
        return;
    }

    GraphicsLayer* videoLayer = video->layer()->compositedLayerMapping()->mainGraphicsLayer();

    // The fullscreen video has layer position equal to its enclosing frame's scroll position because fullscreen container is fixed-positioned.
    // We should reset layer position here since we are going to reattach the layer at the very top level.
    videoLayer->setPosition(IntPoint());

    // Only steal fullscreen video layer and clear all other layers if we are the main frame.
    if (!isLocalRoot)
        return;

    m_rootContentLayer->removeAllChildren();
    m_overflowControlsHostLayer->addChild(videoLayer);
    if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
        backgroundLayer->removeFromParent();
    m_inOverlayFullscreenVideo = true;
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:33,代码来源:PaintLayerCompositor.cpp

示例9: Q_UNUSED

void BGI_AirWire::paint(QPainter*                       painter,
                        const QStyleOptionGraphicsItem* option,
                        QWidget*                        widget) {
  Q_UNUSED(widget);

  bool highlight =
      mAirWire.isSelected() || mAirWire.getNetSignal().isHighlighted();
  const qreal lod =
      option->levelOfDetailFromTransform(painter->worldTransform());

  // draw line
  if (mLayer && mLayer->isVisible()) {
    qreal width = highlight ? 3 / lod : 0;  // highlighted airwires are thicker
    QPen  pen(mLayer->getColor(highlight), width, Qt::SolidLine, Qt::RoundCap);
    painter->setPen(pen);
    painter->drawLines(mLines);
    if (mLines.count() > 1) {
      painter->setBrush(Qt::NoBrush);
      painter->drawEllipse(mBoundingRect);
    }
  }

#ifdef QT_DEBUG
  GraphicsLayer* layer =
      getLayer(GraphicsLayer::sDebugGraphicsItemsBoundingRects);
  Q_ASSERT(layer);
  if (layer && layer->isVisible()) {
    // draw bounding rect
    painter->setPen(QPen(layer->getColor(highlight), 0));
    painter->setBrush(Qt::NoBrush);
    painter->drawRect(mBoundingRect);
  }
#endif
}
开发者ID:LibrePCB,项目名称:LibrePCB,代码行数:34,代码来源:bgi_airwire.cpp

示例10: buildLayerIdToNodeIdMap

void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(
    PaintLayer* root,
    LayerIdToNodeIdMap& layerIdToNodeIdMap) {
  if (root->hasCompositedLayerMapping()) {
    if (Node* node = root->layoutObject()->generatingNode()) {
      GraphicsLayer* graphicsLayer =
          root->compositedLayerMapping()->childForSuperlayers();
      layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(),
                             idForNode(node));
    }
  }
  for (PaintLayer* child = root->firstChild(); child;
       child = child->nextSibling())
    buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap);
  if (!root->layoutObject()->isLayoutIFrame())
    return;
  FrameView* childFrameView =
      toFrameView(toLayoutPart(root->layoutObject())->widget());
  LayoutViewItem childLayoutViewItem = childFrameView->layoutViewItem();
  if (!childLayoutViewItem.isNull()) {
    if (PaintLayerCompositor* childCompositor =
            childLayoutViewItem.compositor())
      buildLayerIdToNodeIdMap(childCompositor->rootLayer(), layerIdToNodeIdMap);
  }
}
开发者ID:ollie314,项目名称:chromium,代码行数:25,代码来源:InspectorLayerTreeAgent.cpp

示例11: while

void GraphicsLayer::removeAllChildren()
{
    while (!m_children.isEmpty()) {
        GraphicsLayer* curLayer = m_children.last();
        ASSERT(curLayer->parent());
        curLayer->removeFromParent();
    }
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:8,代码来源:GraphicsLayer.cpp

示例12: while

void GraphicsLayer::removeAllChildren()
{
    while (m_children.size()) {
        GraphicsLayer* curLayer = m_children[0];
        ASSERT(curLayer->parent());
        curLayer->removeFromParent();
    }
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:8,代码来源:GraphicsLayer.cpp

示例13: layerByID

void LayerTreeRenderer::setLayerFilters(CoordinatedLayerID id, const FilterOperations& filters)
{
    GraphicsLayer* layer = layerByID(id);

#if ENABLE(CSS_SHADERS)
    injectCachedCustomFilterPrograms(filters);
#endif
    layer->setFilters(filters);
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例14: ASSERT

void LayerTreeRenderer::destroyCanvas(CoordinatedLayerID id)
{
    ASSERT(m_textureMapper);
    GraphicsLayer* layer = layerByID(id);
    ASSERT(m_surfaceBackingStores.contains(id));

    m_surfaceBackingStores.remove(id);
    layer->setContentsToMedia(0);
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例15: ensureLayer

void LayerTreeRenderer::setLayerFilters(WebLayerID id, const FilterOperations& filters)
{
    ensureLayer(id);
    LayerMap::iterator it = m_layers.find(id);
    ASSERT(it != m_layers.end());

    GraphicsLayer* layer = it->second;
    layer->setFilters(filters);
}
开发者ID:kseo,项目名称:webkit,代码行数:9,代码来源:LayerTreeRenderer.cpp


注:本文中的GraphicsLayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。