本文整理汇总了C++中CachedImage::errorOccurred方法的典型用法代码示例。如果您正苦于以下问题:C++ CachedImage::errorOccurred方法的具体用法?C++ CachedImage::errorOccurred怎么用?C++ CachedImage::errorOccurred使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CachedImage
的用法示例。
在下文中一共展示了CachedImage::errorOccurred方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeImage
void Pasteboard::writeImage(Element& element, const URL&, const String& title)
{
if (!(element.renderer() && element.renderer()->isRenderImage()))
return;
RenderImage* renderer = toRenderImage(element.renderer());
CachedImage* cachedImage = renderer->cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return;
Image* image = cachedImage->imageForRenderer(renderer);
ASSERT(image);
m_dataObject->clearAll();
URL url = getURLForImageElement(element);
if (!url.isEmpty()) {
m_dataObject->setURL(url, title);
m_dataObject->setMarkup(createMarkup(element, IncludeNode, 0, ResolveAllURLs));
}
GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->getGdkPixbuf());
m_dataObject->setImage(pixbuf.get());
if (m_gtkClipboard)
PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_gtkClipboard);
}
示例2: writeImage
void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
{
ASSERT(node);
if (!(node->renderer() && node->renderer()->isImage()))
return;
RenderImage* renderer = toRenderImage(node->renderer());
CachedImage* cachedImage = renderer->cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return;
Image* image = cachedImage->imageForRenderer(renderer);
ASSERT(image);
GtkClipboard* clipboard = gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD);
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
KURL url = getURLForImageNode(node);
if (!url.isEmpty()) {
dataObject->setURL(url, title);
dataObject->setMarkup(createMarkup(static_cast<Element*>(node), IncludeNode, 0, ResolveAllURLs));
}
GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->getGdkPixbuf());
dataObject->setImage(pixbuf.get());
PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard);
}
示例3: writeImage
void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
{
ASSERT(node);
if (!(node->renderer() && node->renderer()->isImage()))
return;
RenderImage* renderer = toRenderImage(node->renderer());
CachedImage* cachedImage = renderer->cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return;
Image* image = cachedImage->imageForRenderer(renderer);
ASSERT(image);
NativeImagePtr bitmap = image->nativeImageForCurrentFrame();
if (!bitmap)
return;
// If the image is wrapped in a link, |url| points to the target of the
// link. This isn't useful to us, so get the actual image URL.
AtomicString urlString;
if (node->hasTagName(HTMLNames::imgTag) || node->hasTagName(HTMLNames::inputTag))
urlString = static_cast<Element*>(node)->getAttribute(HTMLNames::srcAttr);
#if ENABLE(SVG)
else if (node->hasTagName(SVGNames::imageTag))
urlString = static_cast<Element*>(node)->getAttribute(XLinkNames::hrefAttr);
#endif
else if (node->hasTagName(HTMLNames::embedTag) || node->hasTagName(HTMLNames::objectTag)) {
Element* element = static_cast<Element*>(node);
urlString = element->getAttribute(element->imageSourceAttributeName());
}
KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
PlatformSupport::clipboardWriteImage(bitmap, url, title);
}
示例4: getImage
static Image* getImage(Element* element)
{
ASSERT(element);
CachedImage* cachedImage = getCachedImage(element);
// Don't use cachedImage->imageForRenderer() here as that may return BitmapImages for cached SVG Images.
// Users of getImage() want access to the SVGImage, in order to figure out the filename extensions,
// which would be empty when asking the cached BitmapImages.
return (cachedImage && !cachedImage->errorOccurred()) ?
cachedImage->image() : 0;
}
示例5: notifyFinished
void HTMLImageLoader::notifyFinished(CachedResource*)
{
CachedImage* cachedImage = image();
Element* elem = element();
ImageLoader::notifyFinished(cachedImage);
if ((cachedImage->errorOccurred() || cachedImage->httpStatusCodeErrorOccurred()) && elem->hasTagName(HTMLNames::objectTag))
static_cast<HTMLObjectElement*>(elem)->renderFallbackContent();
}
示例6: getImageForElement
static bool getImageForElement(Element& element, RefPtr<Image>& image)
{
auto* renderer = element.renderer();
if (!is<RenderImage>(renderer))
return false;
CachedImage* cachedImage = downcast<RenderImage>(*renderer).cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return false;
image = cachedImage->imageForRenderer(renderer);
return image;
}
示例7: writeImage
void Pasteboard::writeImage(Node* node, const KURL&, const String&)
{
ASSERT(node && node->renderer() && node->renderer()->isImage());
RenderImage* renderer = toRenderImage(node->renderer());
CachedImage* cachedImage = renderer->cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return;
Image* image = cachedImage->image();
ASSERT(image);
clear();
HDC dc = GetDC(0);
HDC compatibleDC = CreateCompatibleDC(0);
HDC sourceDC = CreateCompatibleDC(0);
OwnPtr<HBITMAP> resultBitmap(CreateCompatibleBitmap(dc, image->width(), image->height()));
HGDIOBJ oldBitmap = SelectObject(compatibleDC, resultBitmap.get());
BitmapInfo bmInfo = BitmapInfo::create(image->size());
HBITMAP coreBitmap = CreateDIBSection(dc, &bmInfo, DIB_RGB_COLORS, 0, 0, 0);
HGDIOBJ oldSource = SelectObject(sourceDC, coreBitmap);
image->getHBITMAP(coreBitmap);
#if !defined(NO_ALPHABLEND)
BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA};
AlphaBlend(compatibleDC, 0, 0, image->width(), image->height(),
sourceDC, 0, 0, image->width(), image->height(), bf);
#else
StretchBlt(compatibleDC, 0, 0, image->width(), image->height(),
sourceDC, 0, 0, image->width(), image->height(), SRCCOPY);
#endif
SelectObject(sourceDC, oldSource);
DeleteObject(coreBitmap);
SelectObject(compatibleDC, oldBitmap);
DeleteDC(sourceDC);
DeleteDC(compatibleDC);
ReleaseDC(0, dc);
if (::OpenClipboard(m_owner)) {
::SetClipboardData(CF_BITMAP, resultBitmap.leakPtr());
::CloseClipboard();
}
}
示例8: writeImage
void Pasteboard::writeImage(Node* node, const KURL&, const String&)
{
ASSERT(node && node->renderer() && node->renderer()->isImage());
#ifndef QT_NO_CLIPBOARD
CachedImage* cachedImage = toRenderImage(node->renderer())->cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return;
Image* image = cachedImage->image();
ASSERT(image);
QPixmap* pixmap = image->nativeImageForCurrentFrame();
if (!pixmap)
return;
QApplication::clipboard()->setPixmap(*pixmap, QClipboard::Clipboard);
#endif
}
示例9: notifyFinished
void HTMLImageLoader::notifyFinished(CachedResource*)
{
CachedImage* cachedImage = image();
RefPtr<Element> element = this->element();
ImageLoader::notifyFinished(cachedImage);
bool loadError = cachedImage->errorOccurred() || cachedImage->response().httpStatusCode() >= 400;
if (!loadError) {
if (!element->inDocument()) {
JSC::VM* vm = JSDOMWindowBase::commonVM();
JSC::JSLockHolder lock(vm);
vm->heap.reportExtraMemoryCost(cachedImage->encodedSize());
}
}
if (loadError && element->hasTagName(HTMLNames::objectTag))
static_cast<HTMLObjectElement*>(element.get())->renderFallbackContent();
}
示例10: notifyFinished
void HTMLImageLoader::notifyFinished(CachedResource*)
{
CachedImage* cachedImage = image();
RefPtr<Element> element = client()->sourceElement();
ImageLoader::notifyFinished(cachedImage);
bool loadError = cachedImage->errorOccurred() || cachedImage->response().httpStatusCode() >= 400;
#if USE(JSC)
if (!loadError) {
if (!element->inDocument()) {
JSC::JSGlobalData* globalData = JSDOMWindowBase::commonJSGlobalData();
JSC::JSLockHolder lock(globalData);
globalData->heap.reportExtraMemoryCost(cachedImage->encodedSize());
}
}
#endif
if (loadError && element->hasTagName(HTMLNames::objectTag))
static_cast<HTMLObjectElement*>(element.get())->renderFallbackContent();
}