当前位置: 首页>>代码示例>>C++>>正文


C++ CachedImage::image方法代码示例

本文整理汇总了C++中CachedImage::image方法的典型用法代码示例。如果您正苦于以下问题:C++ CachedImage::image方法的具体用法?C++ CachedImage::image怎么用?C++ CachedImage::image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CachedImage的用法示例。


在下文中一共展示了CachedImage::image方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: computeReplacedLogicalWidth

LayoutUnit RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const
{
    // If we've got an explicit width/height assigned, propagate it to the image resource.    
    if (style()->logicalWidth().isFixed() && style()->logicalHeight().isFixed()) {
        LayoutUnit width = RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth);
        m_imageResource->setContainerSizeForRenderer(IntSize(width, computeReplacedLogicalHeight()));
        return width;
    }

    IntSize containerSize;
    if (m_imageResource->imageHasRelativeWidth() || m_imageResource->imageHasRelativeHeight()) {
        // Propagate the containing block size to the image resource, otherwhise we can't compute our own intrinsic size, if it's relative.
        RenderObject* containingBlock = isPositioned() ? container() : this->containingBlock();
        if (containingBlock->isBox()) {
            RenderBox* box = toRenderBox(containingBlock);
            containerSize = IntSize(box->availableWidth(), box->availableHeight()); // Already contains zooming information.
        }
    } else {
        // Propagate the current zoomed image size to the image resource, otherwhise the image size will remain the same on-screen.
        CachedImage* cachedImage = m_imageResource->cachedImage();
        if (cachedImage && cachedImage->image()) {
            containerSize = cachedImage->image()->size();
            // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
            containerSize.setWidth(static_cast<LayoutUnit>(containerSize.width() * style()->effectiveZoom()));
            containerSize.setHeight(static_cast<LayoutUnit>(containerSize.height() * style()->effectiveZoom()));
        }
    }

    if (!containerSize.isEmpty()) {
        m_imageResource->setContainerSizeForRenderer(containerSize);
        const_cast<RenderImage*>(this)->updateIntrinsicSizeIfNeeded(containerSize, false);
    }

    return RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth);
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:35,代码来源:RenderImage.cpp

示例2: drawingContext

// FIXME: Why isn't this just another overload of drawImage? Why have a different name?
void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image,
    float sx, float sy, float sw, float sh,
    float dx, float dy, float dw, float dh,
    const String& compositeOperation)
{
    if (!image)
        return;

    CachedImage* cachedImage = image->cachedImage();
    if (!cachedImage)
        return;

    GraphicsContext* c = drawingContext();
    if (!c)
        return;

    CompositeOperator op;
    if (!parseCompositeOperator(compositeOperation, op))
        op = CompositeSourceOver;

    FloatRect destRect = FloatRect(dx, dy, dw, dh);
    willDraw(destRect);
#ifdef __OWB__
    c->drawImage(cachedImage->image()->nativeImageForCurrentFrame(), destRect, FloatRect(sx, sy, sw, sh), op);
    cachedImage->image()->startAnimation();
#else
    c->drawImage(cachedImage->image(), destRect, FloatRect(sx, sy, sw, sh), op);
#endif //__OWB__
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:30,代码来源:CanvasRenderingContext2D.cpp

示例3: writeImageToDataObject

static void writeImageToDataObject(
    DataObjectJava* dataObject,
    Element* element,
    const KURL& url)
{
    // Shove image data into a DataObject for use as a file
    CachedImage* cachedImage = getCachedImage(element);
    if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
        return;

    SharedBuffer* imageBuffer = cachedImage->image()->data();
    if (!imageBuffer || !imageBuffer->size())
        return;

    dataObject->fileContent = imageBuffer;

    // Determine the filename for the file contents of the image.  We try to
    // use the alt tag if one exists, otherwise we fall back on the suggested
    // filename in the http header, and finally we resort to using the filename
    // in the URL.
    //String title = element->getAttribute(altAttr);
    //if (title.isEmpty())
    //  title = cachedImage->response().suggestedFilename();

    //TODO: do we need it?
    dataObject->fileContentFilename = cachedImage->response().suggestedFilename();
}
开发者ID:166MMX,项目名称:openjdk.java.net-openjfx-8u40-rt,代码行数:27,代码来源:ClipboardJava.cpp

示例4: checkOrigin

// FIXME: Why isn't this just another overload of drawImage? Why have a different name?
void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image,
    float sx, float sy, float sw, float sh,
    float dx, float dy, float dw, float dh,
    const String& compositeOperation)
{
    if (!image)
        return;

    CachedImage* cachedImage = image->cachedImage();
    if (!cachedImage)
        return;

    if (canvas()->originClean())
        checkOrigin(cachedImage->response().url());

    if (canvas()->originClean() && !cachedImage->image()->hasSingleSecurityOrigin())
        canvas()->setOriginTainted();

    GraphicsContext* c = drawingContext();
    if (!c)
        return;
    if (!state().m_invertibleCTM)
        return;

    CompositeOperator op;
    if (!parseCompositeOperator(compositeOperation, op))
        op = CompositeSourceOver;

    FloatRect destRect = FloatRect(dx, dy, dw, dh);
    willDraw(destRect);
    c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, FloatRect(sx, sy, sw, sh), op);
}
开发者ID:ShouqingZhang,项目名称:webkitdriver,代码行数:33,代码来源:CanvasRenderingContext2D.cpp

示例5: declareAndWriteDragImage

void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame)
{
    ASSERT(frame);

    // WebCore::writeURL(m_writableDataObject.get(), url, title, true, false);
    if (!m_writableData)
        m_writableData = new QMimeData;

    CachedImage* cachedImage = getCachedImage(element);
    if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
        return;
    QPixmap* pixmap = cachedImage->image()->nativeImageForCurrentFrame();
    if (pixmap)
        m_writableData->setImageData(*pixmap);

    AtomicString imageURL = element->getAttribute(HTMLNames::srcAttr);
    if (imageURL.isEmpty())
        return;

    KURL fullURL = frame->document()->completeURL(deprecatedParseURL(imageURL));
    if (fullURL.isEmpty())
        return;

    QList<QUrl> urls;
    urls.append(url);
    urls.append(fullURL);

    m_writableData->setText(title);
    m_writableData->setUrls(urls);
#ifndef QT_NO_CLIPBOARD
    if (!isForDragging())
        QApplication::clipboard()->setMimeData(m_writableData);
#endif
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:34,代码来源:ClipboardQt.cpp

示例6: writeImageToDataObject

static void writeImageToDataObject(IDataObject* dataObject, Element* element, const KURL& url)
{
    // Shove image data into a DataObject for use as a file
    CachedImage* cachedImage = getCachedImage(element);
    if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
        return;

    SharedBuffer* imageBuffer = cachedImage->image()->data();
    if (!imageBuffer || !imageBuffer->size())
        return;

    HGLOBAL imageFileDescriptor = createGlobalImageFileDescriptor(url.string(), element->getAttribute(altAttr), cachedImage);
    if (!imageFileDescriptor)
        return;

    HGLOBAL imageFileContent = createGlobalImageFileContent(imageBuffer);
    if (!imageFileContent) {
        GlobalFree(imageFileDescriptor);
        return;
    }

    String fileName = cachedImage->response().suggestedFilename();
    HGLOBAL hDropContent = createGlobalHDropContent(url, fileName, imageBuffer);
    if (!hDropContent) {
        GlobalFree(hDropContent);
        return;
    }

    writeFileToDataObject(dataObject, imageFileDescriptor, imageFileContent, hDropContent);
}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:30,代码来源:BCClipboardEA.cpp

示例7: writeImageToDataObject

static void writeImageToDataObject(DataObject* dataObject, Element* element,
                                   const KURL& url)
{
    // Shove image data into a DataObject for use as a file
    CachedImage* cachedImage = getCachedImage(element);
    if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
        return;

    SharedBuffer* imageBuffer = cachedImage->image()->data();
    if (!imageBuffer || !imageBuffer->size())
        return;

    dataObject->fileContent = imageBuffer;

    // Determine the filename for the file contents of the image.  We try to
    // use the alt tag if one exists, otherwise we fall back on the suggested
    // filename in the http header, and finally we resort to using the filename
    // in the URL.
    /*String extension = MIMETypeRegistry::getPreferredExtensionForMIMEType(
        cachedImage->response().mimeType());*/
    String extension = "png";
    dataObject->fileExtension = extension.isEmpty() ? "" : "." + extension;
    String title = element->getAttribute(altAttr);
    if (title.isEmpty())
        title = cachedImage->response().suggestedFilename();

    //title = ClipboardBal::validateFileName(title, dataObject);
    dataObject->fileContentFilename = title + dataObject->fileExtension;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:29,代码来源:BCClipboardGeneric.cpp

示例8: ASSERT

void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRect& srcRect, const FloatRect& dstRect,
    ExceptionCode& ec)
{
    ASSERT(image);

    ec = 0;

    FloatRect imageRect = FloatRect(FloatPoint(), size(image));
    if (!(imageRect.contains(srcRect) && srcRect.width() >= 0 && srcRect.height() >= 0 
            && dstRect.width() >= 0 && dstRect.height() >= 0)) {
        ec = INDEX_SIZE_ERR;
        return;
    }

    if (srcRect.isEmpty() || dstRect.isEmpty())
        return;

    GraphicsContext* c = drawingContext();
    if (!c)
        return;

    CachedImage* cachedImage = image->cachedImage();
    if (!cachedImage)
        return;

    FloatRect sourceRect = c->roundToDevicePixels(srcRect);
    FloatRect destRect = c->roundToDevicePixels(dstRect);
    willDraw(destRect);
#ifdef __OWB__
    c->drawImage(cachedImage->image()->nativeImageForCurrentFrame(), destRect, sourceRect, state().m_globalComposite);
    cachedImage->image()->startAnimation();
#else
    c->drawImage(cachedImage->image(), destRect, sourceRect, state().m_globalComposite);
#endif //__OWB__
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:35,代码来源:CanvasRenderingContext2D.cpp

示例9: writeImageToDataObject

static void writeImageToDataObject(ChromiumDataObject* dataObject, Element* element,
                                   const KURL& url)
{
    // Shove image data into a DataObject for use as a file
    CachedImage* cachedImage = getCachedImage(element);
    if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
        return;

    SharedBuffer* imageBuffer = cachedImage->image()->data();
    if (!imageBuffer || !imageBuffer->size())
        return;

    dataObject->fileContent = imageBuffer;

    // Determine the filename for the file contents of the image.  We try to
    // use the alt tag if one exists, otherwise we fall back on the suggested
    // filename in the http header, and finally we resort to using the filename
    // in the URL.
    String extension(".");
    extension += MIMETypeRegistry::getPreferredExtensionForMIMEType(
        cachedImage->response().mimeType());
    String title = element->getAttribute(altAttr);
    if (title.isEmpty()) {
        title = cachedImage->response().suggestedFilename();
        // FIXME: If title is empty, get the filename from the URL.
    }
    dataObject->fileContentFilename = title + extension;
}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:28,代码来源:ClipboardChromium.cpp

示例10: embeddedContentBox

RenderBox* RenderImage::embeddedContentBox() const
{
    CachedImage* cachedImage = imageResource().cachedImage();
    if (cachedImage && is<SVGImage>(cachedImage->image()))
        return downcast<SVGImage>(*cachedImage->image()).embeddedContentBox();

    return nullptr;
}
开发者ID:rhythmkay,项目名称:webkit,代码行数:8,代码来源:RenderImage.cpp

示例11: computeIntrinsicRatioInformation

void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const
{
    // Assure this method is never used for SVGImages.
    ASSERT(!embeddedContentBox());
    isPercentageIntrinsicSize = false;
    CachedImage* cachedImage = m_imageResource ? m_imageResource->cachedImage() : 0;
    if (!cachedImage || !cachedImage->image())
        return;
    intrinsicSize = cachedImage->image()->size();
    intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height());
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:11,代码来源:RenderImage.cpp

示例12: embeddedContentBox

RenderBox* RenderImage::embeddedContentBox() const
{
    if (!m_imageResource)
        return 0;

#if ENABLE(SVG)
    CachedImage* cachedImage = m_imageResource->cachedImage();
    if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage())
        return static_cast<SVGImage*>(cachedImage->image())->embeddedContentBox();
#endif

    return 0;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例13: writeImage

void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
{
    ASSERT(node);
    ASSERT(node->renderer());
    ASSERT(node->renderer()->isImage());
    RenderImage* renderer = toRenderImage(node->renderer());
    CachedImage* cachedImage = renderer->cachedImage();
    ASSERT(cachedImage);
    Image* image = cachedImage->image();
    ASSERT(image);

    // 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(deprecatedParseURL(urlString));

    NativeImageSkia* bitmap = 0;
#if !PLATFORM(CG)
    bitmap = image->nativeImageForCurrentFrame();
#endif
    ChromiumBridge::clipboardWriteImage(bitmap, url, title);
}
开发者ID:boyliang,项目名称:ComponentSuperAccessor,代码行数:32,代码来源:PasteboardChromium.cpp

示例14: writeImage

void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
{
    ASSERT(node);
    ASSERT(node->renderer());
    ASSERT(node->renderer()->isImage());
    RenderImage* renderer = toRenderImage(node->renderer());
    CachedImage* cachedImage = renderer->cachedImage();
    if (!cachedImage || cachedImage->errorOccurred())
        return;
    Image* image = cachedImage->image();
    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));

    PlatformBridge::clipboardWriteImage(bitmap, url, title);
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:33,代码来源:PasteboardChromium.cpp

示例15: writeImage

void Pasteboard::writeImage(Node* node, const KURL&, const String&)
{
    ASSERT(node && node->renderer() && node->renderer()->isImage());
    RenderImage* renderer = static_cast<RenderImage*>(node->renderer());
    CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage());
    ASSERT(cachedImage);
    Image* image = cachedImage->image();
    ASSERT(image);

    clear();

    RefPtr<SharedBitmap> sourceBmp = image->nativeImageForCurrentFrame();
    if (!sourceBmp)
        return;

    IntRect rect(0, 0, sourceBmp->width(), sourceBmp->height());
    BitmapInfo bmpInfo;
    void* pixels;
    HBITMAP resultBitmap = sourceBmp->clipBitmap(rect, true, bmpInfo, pixels);
    if (!resultBitmap)
        return;

    if (::OpenClipboard(m_owner)) {
        ::SetClipboardData(CF_BITMAP, resultBitmap);
        ::CloseClipboard();
    } else
        DeleteObject(resultBitmap);
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:28,代码来源:PasteboardWinCE.cpp


注:本文中的CachedImage::image方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。