本文整理汇总了C++中CachedImage::deref方法的典型用法代码示例。如果您正苦于以下问题:C++ CachedImage::deref方法的具体用法?C++ CachedImage::deref怎么用?C++ CachedImage::deref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CachedImage
的用法示例。
在下文中一共展示了CachedImage::deref方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setImage
void HTMLImageLoader::setImage(CachedImage *newImage)
{
CachedImage *oldImage = m_image;
if (newImage != oldImage) {
setLoadingImage(newImage);
m_firedLoad = true;
m_imageComplete = true;
if (newImage)
newImage->ref(this);
if (oldImage)
oldImage->deref(this);
}
if (RenderObject* renderer = element()->renderer())
if (renderer->isImage())
static_cast<RenderImage*>(renderer)->resetAnimation();
}
示例2: updateFromElement
void HTMLImageLoader::updateFromElement()
{
// If we're not making renderers for the page, then don't load images. We don't want to slow
// down the raw HTML parsing case by loading images we don't intend to display.
Element* elem = element();
Document* doc = elem->document();
if (!doc->renderer())
return;
AtomicString attr = elem->getAttribute(elem->hasLocalName(objectTag) ? dataAttr : srcAttr);
// Treat a lack of src or empty string for src as no image at all.
CachedImage *newImage = 0;
if (!attr.isEmpty()) {
if (m_loadManually) {
doc->docLoader()->setAutoLoadImages(false);
newImage = new CachedImage(doc->docLoader(), parseURL(attr), false /* not for cache */);
newImage->setLoading(true);
newImage->setDocLoader(doc->docLoader());
doc->docLoader()->m_docResources.set(newImage->url(), newImage);
} else
newImage = doc->docLoader()->requestImage(parseURL(attr));
}
CachedImage *oldImage = m_image;
if (newImage != oldImage) {
#ifdef INSTRUMENT_LAYOUT_SCHEDULING
if (!doc->ownerElement() && newImage)
printf("Image requested at %d\n", doc->elapsedTime());
#endif
setLoadingImage(newImage);
if (newImage)
newImage->ref(this);
if (oldImage)
oldImage->deref(this);
}
if (RenderObject* renderer = elem->renderer())
if (renderer->isImage())
static_cast<RenderImage*>(renderer)->resetAnimation();
}