Esempio n. 1
0
PlatformCALayerWin::PlatformCALayerWin(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
    : PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
    , m_customAppearance(GraphicsLayer::NoCustomAppearance)
    , m_customBehavior(GraphicsLayer::NoCustomBehavior)
{
    if (layer) {
        m_layer = layer;
        return;
    }

    m_layer = adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));

    // Create the PlatformCALayerWinInternal object and point to it in the userdata.
    PlatformCALayerWinInternal* intern = new PlatformCALayerWinInternal(this);
    CACFLayerSetUserData(m_layer.get(), intern);

    // Set the display callback
    CACFLayerSetDisplayCallback(m_layer.get(), displayCallback);
    CACFLayerSetLayoutCallback(m_layer.get(), layoutSublayersProc);

    if (usesTiledBackingLayer()) {
        TileController* tileController = intern->createTileController(this);
        m_customSublayers = std::make_unique<PlatformCALayerList>(tileController->containerLayers());
    }
}
Esempio n. 2
0
PlatformCALayerWin::PlatformCALayerWin(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
    : PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
    , m_customAppearance(GraphicsLayer::NoCustomAppearance)
{
    if (layer) {
        m_layer = layer;
        return;
    }

    m_layer = adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));

#if HAVE(CACFLAYER_SETCONTENTSSCALE)
    CACFLayerSetContentsScale(m_layer.get(), owner ? owner->platformCALayerDeviceScaleFactor() : deviceScaleFactorForWindow(nullptr));
#endif

    // Create the PlatformCALayerWinInternal object and point to it in the userdata.
    PlatformCALayerWinInternal* intern = nullptr;

    if (usesTiledBackingLayer()) {
        intern = new WebTiledBackingLayerWin(this);
        TileController* tileController = reinterpret_cast<WebTiledBackingLayerWin*>(intern)->createTileController(this);
        m_customSublayers = std::make_unique<PlatformCALayerList>(tileController->containerLayers());
    } else
        intern = new PlatformCALayerWinInternal(this);

    CACFLayerSetUserData(m_layer.get(), intern);

    // Set the display callback
    CACFLayerSetDisplayCallback(m_layer.get(), displayCallback);
    CACFLayerSetLayoutCallback(m_layer.get(), layoutSublayersProc);
}
Esempio n. 3
0
TileCoverageMap::TileCoverageMap(const TileController& controller)
    : m_controller(controller)
    , m_layer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeSimpleLayer, this))
    , m_visibleRectIndicatorLayer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
    , m_coverageRectIndicatorLayer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
    , m_position(FloatPoint(0, controller.topContentInset()))
{
    m_layer.get().setOpacity(0.75);
    m_layer.get().setAnchorPoint(FloatPoint3D());
    m_layer.get().setBorderColor(Color::black);
    m_layer.get().setBorderWidth(1);
    m_layer.get().setPosition(FloatPoint(2, 2));
    m_layer.get().setContentsScale(m_controller.deviceScaleFactor());

    m_visibleRectIndicatorLayer.get().setBorderWidth(2);
    m_visibleRectIndicatorLayer.get().setAnchorPoint(FloatPoint3D());
    m_visibleRectIndicatorLayer.get().setBorderColor(Color(255, 0, 0));
    
    m_coverageRectIndicatorLayer.get().setBorderWidth(2);
    m_coverageRectIndicatorLayer.get().setAnchorPoint(FloatPoint3D());
    m_coverageRectIndicatorLayer.get().setBorderColor(Color(0, 0, 128));

    m_layer.get().appendSublayer(m_coverageRectIndicatorLayer);
    m_layer.get().appendSublayer(m_visibleRectIndicatorLayer);

    update();
}
unsigned TileControllerMemoryHandler::totalUnparentedTiledLayers() const
{
    unsigned totalUnparentedLayers = 0;
    for (ListHashSet<TileController*>::const_iterator it = m_tileControllers.begin(); it != m_tileControllers.end(); ++it) {
        TileController* tileController = *it;
        totalUnparentedLayers += tileController->numberOfUnparentedTiles();
    }
    return totalUnparentedLayers;
}
void TileControllerMemoryHandler::trimUnparentedTilesToTarget(int target)
{
    while (!m_tileControllers.isEmpty()) {
        TileController* tileController = m_tileControllers.first();
        tileController->removeUnparentedTilesNow();
        m_tileControllers.removeFirst();

        if (target > 0 && totalUnparentedTiledLayers() < static_cast<unsigned>(target))
            return;
    }
}
Esempio n. 6
0
TileGrid::TileGrid(TileController& controller)
    : m_controller(controller)
    , m_containerLayer(*controller.rootLayer().createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr))
    , m_scale(1)
    , m_cohortRemovalTimer(*this, &TileGrid::cohortRemovalTimerFired)
{
    m_containerLayer.get().setName(TileController::tileGridContainerLayerName());
}