本文整理汇总了C++中FillLayer::image方法的典型用法代码示例。如果您正苦于以下问题:C++ FillLayer::image方法的具体用法?C++ FillLayer::image怎么用?C++ FillLayer::image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FillLayer
的用法示例。
在下文中一共展示了FillLayer::image方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例2: loadPendingImages
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();
}
示例3: paintFillLayer
void InlineFlowBoxPainter::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op)
{
StyleImage* img = fillLayer.image();
bool hasFillImage = img && img->canRender(m_inlineFlowBox.layoutObject(), m_inlineFlowBox.layoutObject().style()->effectiveZoom());
if ((!hasFillImage && !m_inlineFlowBox.layoutObject().style()->hasBorderRadius()) || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m_inlineFlowBox.parent()) {
BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.boxModelObject(), paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op);
} else if (m_inlineFlowBox.layoutObject().style()->boxDecorationBreak() == DCLONE) {
GraphicsContextStateSaver stateSaver(*paintInfo.context);
paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.width(), m_inlineFlowBox.height()));
BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.boxModelObject(), paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op);
} else {
// We have a fill image that spans multiple lines.
// FIXME: frameSize ought to be the same as rect.size().
LayoutSize frameSize(m_inlineFlowBox.width().toLayoutUnit(), m_inlineFlowBox.height().toLayoutUnit());
LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(), frameSize, m_inlineFlowBox.layoutObject().style()->direction());
GraphicsContextStateSaver stateSaver(*paintInfo.context);
paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), m_inlineFlowBox.width(), m_inlineFlowBox.height()));
BoxPainter::paintFillLayerExtended(*m_inlineFlowBox.boxModelObject(), paintInfo, c, fillLayer, imageStripPaintRect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op);
}
}
示例4: paintFillLayer
void InlineFlowBoxPainter::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer& fillLayer, const LayoutRect& rect, SkXfermode::Mode op)
{
LayoutBoxModelObject* boxModel = toLayoutBoxModelObject(LineLayoutAPIShim::layoutObjectFrom(m_inlineFlowBox.boxModelObject()));
StyleImage* img = fillLayer.image();
bool hasFillImage = img && img->canRender();
if ((!hasFillImage && !m_inlineFlowBox.lineLayoutItem().style()->hasBorderRadius()) || (!m_inlineFlowBox.prevLineBox() && !m_inlineFlowBox.nextLineBox()) || !m_inlineFlowBox.parent()) {
BoxPainter::paintFillLayer(*boxModel, paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op);
} else if (m_inlineFlowBox.lineLayoutItem().style()->boxDecorationBreak() == DCLONE) {
GraphicsContextStateSaver stateSaver(paintInfo.context);
paintInfo.context.clip(pixelSnappedIntRect(rect));
BoxPainter::paintFillLayer(*boxModel, paintInfo, c, fillLayer, rect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op);
} else {
// We have a fill image that spans multiple lines.
// FIXME: frameSize ought to be the same as rect.size().
LayoutSize frameSize(m_inlineFlowBox.width(), m_inlineFlowBox.height());
LayoutRect imageStripPaintRect = paintRectForImageStrip(rect.location(), frameSize, m_inlineFlowBox.lineLayoutItem().style()->direction());
GraphicsContextStateSaver stateSaver(paintInfo.context);
// TODO(chrishtr): this should likely be pixel-snapped.
paintInfo.context.clip(pixelSnappedIntRect(rect));
BoxPainter::paintFillLayer(*boxModel, paintInfo, c, fillLayer, imageStripPaintRect, BackgroundBleedNone, &m_inlineFlowBox, rect.size(), op);
}
}
示例5: GetCachedImage
Image* FixedBackgroundImageLayerAndroid::GetCachedImage(PassRefPtr<RenderStyle> aStyle)
{
RefPtr<RenderStyle> style = aStyle;
if (!style)
return 0;
if (!style->hasFixedBackgroundImage())
return 0;
FillLayer* layers = style->accessBackgroundLayers();
StyleImage* styleImage = layers->image();
if (!styleImage)
return 0;
if (!styleImage->isLoaded())
return 0;
if (!styleImage->isCachedImage())
return 0;
CachedImage* cachedImage = static_cast<StyleCachedImage*>(styleImage)->cachedImage();
Image* image = cachedImage->image();
bool willPaintBrokenImage = cachedImage->willPaintBrokenImage(); //SAMSUNG_CHANGES -- MPSG6322 & MPSG6356
if (image && !image->nativeImageForCurrentFrame())
return 0;
//SAMSUNG_CHANGES -- MPSG6322 & MPSG6356
//WAS: if (image == Image::nullImage())
if (image == Image::nullImage() || willPaintBrokenImage)
return 0;
return image;
}
示例6: loadPendingImages
void StyleResourceLoader::loadPendingImages(RenderStyle* style, const 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(static_cast<StylePendingImage*>(backgroundLayer->image()), elementStyleResources.deviceScaleFactor()));
}
break;
}
case CSSPropertyContent: {
for (ContentData* contentData = const_cast<ContentData*>(style->contentData()); contentData; contentData = contentData->next()) {
if (contentData->isImage()) {
StyleImage* image = static_cast<ImageContentData*>(contentData)->image();
if (image->isPendingImage()) {
RefPtr<StyleImage> loadedImage = loadPendingImage(static_cast<StylePendingImage*>(image), elementStyleResources.deviceScaleFactor());
if (loadedImage)
static_cast<ImageContentData*>(contentData)->setImage(loadedImage.release());
}
}
}
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(static_cast<StylePendingImage*>(image), elementStyleResources.deviceScaleFactor()));
}
}
}
break;
}
case CSSPropertyListStyleImage: {
if (style->listStyleImage() && style->listStyleImage()->isPendingImage())
style->setListStyleImage(loadPendingImage(static_cast<StylePendingImage*>(style->listStyleImage()), elementStyleResources.deviceScaleFactor()));
break;
}
case CSSPropertyBorderImageSource: {
if (style->borderImageSource() && style->borderImageSource()->isPendingImage())
style->setBorderImageSource(loadPendingImage(static_cast<StylePendingImage*>(style->borderImageSource()), elementStyleResources.deviceScaleFactor()));
break;
}
case CSSPropertyWebkitBoxReflect: {
if (StyleReflection* reflection = style->boxReflect()) {
const NinePieceImage& maskImage = reflection->mask();
if (maskImage.image() && maskImage.image()->isPendingImage()) {
RefPtr<StyleImage> loadedImage = loadPendingImage(static_cast<StylePendingImage*>(maskImage.image()), elementStyleResources.deviceScaleFactor());
reflection->setMask(NinePieceImage(loadedImage.release(), maskImage.imageSlices(), maskImage.fill(), maskImage.borderSlices(), maskImage.outset(), maskImage.horizontalRule(), maskImage.verticalRule()));
}
}
break;
}
case CSSPropertyWebkitMaskBoxImageSource: {
if (style->maskBoxImageSource() && style->maskBoxImageSource()->isPendingImage())
style->setMaskBoxImageSource(loadPendingImage(static_cast<StylePendingImage*>(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(static_cast<StylePendingImage*>(maskLayer->image()), elementStyleResources.deviceScaleFactor()));
}
break;
}
case CSSPropertyWebkitShapeInside:
loadPendingShapeImage(style, style->shapeInside());
break;
case CSSPropertyWebkitShapeOutside:
loadPendingShapeImage(style, style->shapeOutside());
break;
default:
ASSERT_NOT_REACHED();
}
}
}
示例7: loadPendingImages
void ElementStyleResources::loadPendingImages(ComputedStyle* style)
{
// We must loop over the properties and then look at the style to see if
// a pending image exists, and only load that image. For example:
//
// <style>
// div { background-image: url(a.png); }
// div { background-image: url(b.png); }
// div { background-image: none; }
// </style>
// <div></div>
//
// We call styleImage() for both a.png and b.png adding the
// CSSPropertyBackgroundImage property to the m_pendingImageProperties set,
// then we null out the background image because of the "none".
//
// If we eagerly loaded the images we'd fetch a.png, even though it's not
// used. If we didn't null check below we'd crash since the none actually
// removed all background images.
for (CSSPropertyID property : m_pendingImageProperties) {
switch (property) {
case CSSPropertyBackgroundImage: {
for (FillLayer* backgroundLayer = &style->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) {
if (backgroundLayer->image() && backgroundLayer->image()->isPendingImage())
backgroundLayer->setImage(loadPendingImage(toStylePendingImage(backgroundLayer->image())));
}
break;
}
case CSSPropertyContent: {
for (ContentData* contentData = const_cast<ContentData*>(style->contentData()); contentData; contentData = contentData->next()) {
if (contentData->isImage()) {
StyleImage* image = toImageContentData(contentData)->image();
if (image->isPendingImage())
toImageContentData(contentData)->setImage(loadPendingImage(toStylePendingImage(image)));
}
}
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)));
}
}
}
break;
}
case CSSPropertyListStyleImage: {
if (style->listStyleImage() && style->listStyleImage()->isPendingImage())
style->setListStyleImage(loadPendingImage(toStylePendingImage(style->listStyleImage())));
break;
}
case CSSPropertyBorderImageSource: {
if (style->borderImageSource() && style->borderImageSource()->isPendingImage())
style->setBorderImageSource(loadPendingImage(toStylePendingImage(style->borderImageSource())));
break;
}
case CSSPropertyWebkitBoxReflect: {
if (StyleReflection* reflection = style->boxReflect()) {
const NinePieceImage& maskImage = reflection->mask();
if (maskImage.image() && maskImage.image()->isPendingImage()) {
RefPtrWillBeRawPtr<StyleImage> loadedImage = loadPendingImage(toStylePendingImage(maskImage.image()));
reflection->setMask(NinePieceImage(loadedImage.release(), maskImage.imageSlices(), maskImage.fill(), maskImage.borderSlices(), maskImage.outset(), maskImage.horizontalRule(), maskImage.verticalRule()));
}
}
break;
}
case CSSPropertyWebkitMaskBoxImageSource: {
if (style->maskBoxImageSource() && style->maskBoxImageSource()->isPendingImage())
style->setMaskBoxImageSource(loadPendingImage(toStylePendingImage(style->maskBoxImageSource())));
break;
}
case CSSPropertyWebkitMaskImage: {
for (FillLayer* maskLayer = &style->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) {
if (maskLayer->image() && maskLayer->image()->isPendingImage())
maskLayer->setImage(loadPendingImage(toStylePendingImage(maskLayer->image())));
}
break;
}
case CSSPropertyShapeOutside:
if (style->shapeOutside() && style->shapeOutside()->image() && style->shapeOutside()->image()->isPendingImage())
style->shapeOutside()->setImage(loadPendingImage(toStylePendingImage(style->shapeOutside()->image()), CrossOriginAttributeAnonymous));
break;
default:
ASSERT_NOT_REACHED();
}
}
}
示例8: layerImagesIdentical
static inline bool layerImagesIdentical(const FillLayer& layer1, const FillLayer& layer2)
{
// We just care about pointer equivalency.
return layer1.image() == layer2.image();
}