本文整理汇总了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 );
}
示例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());
}
示例3: ASSERT
void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer)
{
ASSERT(layer->isComposited());
GraphicsLayer* hostingLayer = layer->backing()->parentForSublayers();
hostingLayer->removeAllChildren();
}
示例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);
}
示例5: layerByID
void LayerTreeRenderer::setAnimatedTransform(uint32_t id, const WebCore::TransformationMatrix& transform)
{
GraphicsLayer* layer = layerByID(id);
ASSERT(layer);
layer->setTransform(transform);
}
示例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));
}
示例7: updateSettingsForLayer
void PageOverlayController::updateSettingsForLayer(GraphicsLayer& layer)
{
Settings& settings = m_mainFrame.settings();
layer.setAcceleratesDrawing(settings.acceleratedDrawingEnabled());
layer.setShowDebugBorder(settings.showDebugBorders());
layer.setShowRepaintCounter(settings.showRepaintCounter());
}
示例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;
}
示例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
}
示例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);
}
}
示例11: while
void GraphicsLayer::removeAllChildren()
{
while (!m_children.isEmpty()) {
GraphicsLayer* curLayer = m_children.last();
ASSERT(curLayer->parent());
curLayer->removeFromParent();
}
}
示例12: while
void GraphicsLayer::removeAllChildren()
{
while (m_children.size()) {
GraphicsLayer* curLayer = m_children[0];
ASSERT(curLayer->parent());
curLayer->removeFromParent();
}
}
示例13: layerByID
void LayerTreeRenderer::setLayerFilters(CoordinatedLayerID id, const FilterOperations& filters)
{
GraphicsLayer* layer = layerByID(id);
#if ENABLE(CSS_SHADERS)
injectCachedCustomFilterPrograms(filters);
#endif
layer->setFilters(filters);
}
示例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);
}
示例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);
}