本文整理汇总了C++中FillLayer类的典型用法代码示例。如果您正苦于以下问题:C++ FillLayer类的具体用法?C++ FillLayer怎么用?C++ FillLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FillLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setRepeatY
void BackgroundImageGeometry::setRepeatY(const FillLayer& fillLayer,
LayoutUnit unsnappedTileHeight,
LayoutUnit snappedAvailableHeight,
LayoutUnit unsnappedAvailableHeight,
LayoutUnit extraOffset) {
// We would like to identify the phase as a fraction of the image size in the
// absence of snapping, then re-apply it to the snapped values. This is to
// handle large positions.
if (unsnappedTileHeight) {
LayoutUnit computedYPosition = roundedMinimumValueForLength(
fillLayer.yPosition(), unsnappedAvailableHeight);
if (fillLayer.backgroundYOrigin() == BottomEdge) {
float numberOfTilesInPosition =
(snappedAvailableHeight - computedYPosition + extraOffset).toFloat() /
unsnappedTileHeight.toFloat();
float fractionalPositionWithinTile =
numberOfTilesInPosition - truncf(numberOfTilesInPosition);
setPhaseY(LayoutUnit(
roundf(fractionalPositionWithinTile * tileSize().height())));
} else {
float numberOfTilesInPosition =
(computedYPosition + extraOffset).toFloat() /
unsnappedTileHeight.toFloat();
float fractionalPositionWithinTile =
1.0f - (numberOfTilesInPosition - truncf(numberOfTilesInPosition));
setPhaseY(LayoutUnit(
roundf(fractionalPositionWithinTile * tileSize().height())));
}
} else {
setPhaseY(LayoutUnit());
}
setSpaceSize(LayoutSize(spaceSize().width(), LayoutUnit()));
}
示例2: mapFillSize
void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer& layer, const CSSValue& value)
{
if (value.isInitialValue()) {
layer.setSize(FillLayer::initialFillSize(layer.type()));
return;
}
if (!is<CSSPrimitiveValue>(value))
return;
auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
FillSize fillSize;
switch (primitiveValue.getValueID()) {
case CSSValueContain:
fillSize.type = Contain;
break;
case CSSValueCover:
fillSize.type = Cover;
break;
default:
ASSERT(fillSize.type == SizeLength);
if (!convertToLengthSize(primitiveValue, m_resolver->state().cssToLengthConversionData(), fillSize.size))
return;
break;
}
layer.setSize(fillSize);
}
示例3: LayerAndroid
FixedBackgroundImageLayerAndroid::FixedBackgroundImageLayerAndroid(PassRefPtr<RenderStyle> aStyle,
int w, int h)
: LayerAndroid((RenderLayer*)0)
, m_width(w)
, m_height(h)
{
RefPtr<RenderStyle> style = aStyle;
FillLayer* layers = style->accessBackgroundLayers();
StyleImage* styleImage = layers->image();
CachedImage* cachedImage = static_cast<StyleCachedImage*>(styleImage)->cachedImage();
WebCore::Image* image = cachedImage->image();
setContentsImage(image->nativeImageForCurrentFrame());
setSize(image->width(), image->height());
setIntrinsicallyComposited(true);
SkLength left, top;
left = SkLength::convertLength(style->backgroundXPosition());
top = SkLength::convertLength(style->backgroundYPosition());
BackgroundImagePositioning* position = new BackgroundImagePositioning(this);
position->setRepeatX(style->backgroundRepeatX() != WebCore::NoRepeatFill);
position->setRepeatY(style->backgroundRepeatY() != WebCore::NoRepeatFill);
setFixedPosition(position);
position->setPosition(left, top);
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("FixedBackgroundImageLayerAndroid");
#endif
}
示例4: applyInitialValue
virtual void applyInitialValue(CSSStyleSelector* selector) const
{
FillLayer* currChild = (selector->style()->*m_accessLayers)();
(currChild->*m_set)((*m_initial)(m_fillLayerType));
for (currChild = currChild->next(); currChild; currChild = currChild->next())
(currChild->*m_clear)();
}
示例5: mapFillYPosition
void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
{
if (value.isInitialValue()) {
layer.setYPosition(FillLayer::initialFillYPosition(layer.type()));
return;
}
if (!is<CSSPrimitiveValue>(value))
return;
auto* primitiveValue = &downcast<CSSPrimitiveValue>(value);
Pair* pair = primitiveValue->getPairValue();
if (pair) {
ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPositionY || propertyID == CSSPropertyWebkitMaskPositionY);
primitiveValue = pair->second();
}
Length length;
if (primitiveValue->isLength())
length = primitiveValue->computeLength<Length>(m_resolver->state().cssToLengthConversionData());
else if (primitiveValue->isPercentage())
length = Length(primitiveValue->getDoubleValue(), Percent);
else if (primitiveValue->isCalculatedPercentageWithLength())
length = Length(primitiveValue->cssCalcValue()->createCalculationValue(m_resolver->state().cssToLengthConversionData()));
else
return;
layer.setYPosition(length);
if (pair)
layer.setBackgroundYOrigin(*pair->first());
}
示例6: mapFillMaskSourceType
void CSSToStyleMap::mapFillMaskSourceType(CSSPropertyID, FillLayer& layer, const CSSValue& value)
{
EMaskSourceType type = FillLayer::initialFillMaskSourceType(layer.type());
if (value.isInitialValue()) {
layer.setMaskSourceType(type);
return;
}
if (!is<CSSPrimitiveValue>(value))
return;
switch (downcast<CSSPrimitiveValue>(value).getValueID()) {
case CSSValueAlpha:
type = EMaskSourceType::MaskAlpha;
break;
case CSSValueLuminance:
type = EMaskSourceType::MaskLuminance;
break;
case CSSValueAuto:
break;
default:
ASSERT_NOT_REACHED();
}
layer.setMaskSourceType(type);
}
示例7: paintFillLayers
void InlineFlowBoxPainter::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op)
{
// FIXME: This should be a for loop or similar. It's a little non-trivial to do so, however, since the layers need to be
// painted in reverse order.
if (fillLayer.next())
paintFillLayers(paintInfo, c, *fillLayer.next(), rect, op);
paintFillLayer(paintInfo, c, fillLayer, rect, op);
}
示例8: switch
void StyleResourceLoader::loadPendingImages(RenderStyle* style, ElementStyleResources& elementStyleResources)
{
if (elementStyleResources.pendingImageProperties().isEmpty())
return;
PendingImagePropertyMap::const_iterator::Keys end = elementStyleResources.pendingImageProperties().end().keys();
for (PendingImagePropertyMap::const_iterator::Keys it = elementStyleResources.pendingImageProperties().begin().keys(); it != end; ++it) {
CSSPropertyID currentProperty = *it;
switch (currentProperty) {
case CSSPropertyBackgroundImage: {
for (FillLayer* backgroundLayer = &style->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) {
if (backgroundLayer->image() && backgroundLayer->image()->isPendingImage())
backgroundLayer->setImage(loadPendingImage(toStylePendingImage(backgroundLayer->image()), elementStyleResources.deviceScaleFactor()));
}
break;
}
case CSSPropertyCursor: {
if (CursorList* cursorList = style->cursors()) {
for (size_t i = 0; i < cursorList->size(); ++i) {
CursorData& currentCursor = cursorList->at(i);
if (StyleImage* image = currentCursor.image()) {
if (image->isPendingImage())
currentCursor.setImage(loadPendingImage(toStylePendingImage(image), elementStyleResources.deviceScaleFactor()));
}
}
}
break;
}
case CSSPropertyListStyleImage: {
if (style->listStyleImage() && style->listStyleImage()->isPendingImage())
style->setListStyleImage(loadPendingImage(toStylePendingImage(style->listStyleImage()), elementStyleResources.deviceScaleFactor()));
break;
}
case CSSPropertyBorderImageSource: {
if (style->borderImageSource() && style->borderImageSource()->isPendingImage())
style->setBorderImageSource(loadPendingImage(toStylePendingImage(style->borderImageSource()), elementStyleResources.deviceScaleFactor()));
break;
}
case CSSPropertyWebkitMaskBoxImageSource: {
if (style->maskBoxImageSource() && style->maskBoxImageSource()->isPendingImage())
style->setMaskBoxImageSource(loadPendingImage(toStylePendingImage(style->maskBoxImageSource()), elementStyleResources.deviceScaleFactor()));
break;
}
case CSSPropertyWebkitMaskImage: {
for (FillLayer* maskLayer = &style->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) {
if (maskLayer->image() && maskLayer->image()->isPendingImage())
maskLayer->setImage(loadPendingImage(toStylePendingImage(maskLayer->image()), elementStyleResources.deviceScaleFactor()));
}
break;
}
default:
ASSERT_NOT_REACHED();
}
}
elementStyleResources.clearPendingImageProperties();
}
示例9: mapFillImage
void CSSToStyleMap::mapFillImage(CSSPropertyID property, FillLayer& layer, CSSValue& value)
{
if (value.isInitialValue()) {
layer.setImage(FillLayer::initialFillImage(layer.type()));
return;
}
layer.setImage(styleImage(property, value));
}
示例10: mapFillRepeatY
void CSSToStyleMap::mapFillRepeatY(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
{
if (value.treatAsInitialValue(propertyID)) {
layer.setRepeatY(FillLayer::initialFillRepeatY(layer.type()));
return;
}
if (!is<CSSPrimitiveValue>(value))
return;
layer.setRepeatY(downcast<CSSPrimitiveValue>(value));
}
示例11: mapFillClip
void CSSToStyleMap::mapFillClip(CSSPropertyID, FillLayer& layer, const CSSValue& value)
{
if (value.isInitialValue()) {
layer.setClip(FillLayer::initialFillClip(layer.type()));
return;
}
if (!is<CSSPrimitiveValue>(value))
return;
layer.setClip(downcast<CSSPrimitiveValue>(value));
}
示例12: cullEmptyLayers
void FillLayer::cullEmptyLayers()
{
FillLayer* next;
for (FillLayer* p = this; p; p = next) {
next = p->m_next;
if (next && !next->isImageSet()) {
delete next;
p->m_next = 0;
break;
}
}
}
示例13: updateStyle
void FillAnnotationImpl::updateStyle(Style& style) const {
Layer* layer = style.getLayer(layerID);
if (!layer) {
auto newLayer = std::make_unique<FillLayer>(layerID, AnnotationManager::SourceID);
newLayer->setSourceLayer(layerID);
layer = style.addLayer(std::move(newLayer), AnnotationManager::PointLayerID);
}
FillLayer* fillLayer = layer->as<FillLayer>();
fillLayer->setFillOpacity(annotation.opacity);
fillLayer->setFillColor(annotation.color);
fillLayer->setFillOutlineColor(annotation.outlineColor);
}
示例14: applyValue
virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
{
FillLayer* currChild = (selector->style()->*m_accessLayers)();
FillLayer* prevChild = 0;
if (value->isValueList()) {
/* Walk each value and put it into a layer, creating new layers as needed. */
CSSValueList* valueList = static_cast<CSSValueList*>(value);
for (unsigned int i = 0; i < valueList->length(); i++) {
if (!currChild) {
/* Need to make a new layer to hold this value */
currChild = new FillLayer(m_fillLayerType);
prevChild->setNext(currChild);
}
(selector->*m_mapFill)(m_propertyId, currChild, valueList->itemWithoutBoundsCheck(i));
prevChild = currChild;
currChild = currChild->next();
}
} else {
(selector->*m_mapFill)(m_propertyId, currChild, value);
currChild = currChild->next();
}
while (currChild) {
/* Reset all remaining layers to not have the property set. */
(currChild->*m_clear)();
currChild = currChild->next();
}
}
示例15: applyInheritValue
virtual void applyInheritValue(CSSStyleSelector* selector) const
{
FillLayer* currChild = (selector->style()->*m_accessLayers)();
FillLayer* prevChild = 0;
const FillLayer* currParent = (selector->parentStyle()->*m_layers)();
while (currParent && (currParent->*m_test)()) {
if (!currChild) {
/* Need to make a new layer.*/
currChild = new FillLayer(m_fillLayerType);
prevChild->setNext(currChild);
}
(currChild->*m_set)((currParent->*m_get)());
prevChild = currChild;
currChild = prevChild->next();
currParent = currParent->next();
}
while (currChild) {
/* Reset any remaining layers to not have the property set. */
(currChild->*m_clear)();
currChild = currChild->next();
}
}