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


C++ CachedImage类代码示例

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


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

示例1: 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;

    if (m_canvas->originClean())
        checkOrigin(KURL(cachedImage->url()));

    FloatRect sourceRect = c->roundToDevicePixels(srcRect);
    FloatRect destRect = c->roundToDevicePixels(dstRect);
    willDraw(destRect);
    c->drawImage(cachedImage->image(), destRect, sourceRect, state().m_globalComposite);
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:33,代码来源:CanvasRenderingContext2D.cpp

示例2: 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 (m_canvas->originClean())
        checkOrigin(KURL(cachedImage->url()));

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

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

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

示例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
}
开发者ID:a33g-dev,项目名称:platform_samsung,代码行数:31,代码来源:BaseLayerAndroid.cpp

示例4: 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

示例5: 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

示例6: 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 (m_canvas->originClean())
        checkOrigin(cachedImage->response().url());

    if (m_canvas->originClean() && !cachedImage->image()->hasSingleSecurityOrigin())
        m_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(), destRect, FloatRect(sx, sy, sw, sh), op);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:33,代码来源:CanvasRenderingContext2D.cpp

示例7: retrieveResourcesForCSSDeclaration

void PageSerializer::retrieveResourcesForCSSDeclaration(CSSStyleDeclaration* styleDeclaration)
{
    if (!styleDeclaration)
        return;

    if (!styleDeclaration->stylesheet()->isCSSStyleSheet())
        return;

    CSSStyleSheet* cssStyleSheet = static_cast<CSSStyleSheet*>(styleDeclaration->stylesheet());

    // The background-image and list-style-image (for ul or ol) are the CSS properties
    // that make use of images. We iterate to make sure we include any other
    // image properties there might be.
    for (unsigned i = 0; i < styleDeclaration->length(); ++i) {
        // FIXME: It's kind of ridiculous to get the property name and then get
        // the value out of the name. Ideally we would get the value out of the
        // property ID, but CSSStyleDeclaration only gives access to property
        // names, not IDs.
        RefPtr<CSSValue> cssValue = styleDeclaration->getPropertyCSSValue(styleDeclaration->item(i));
        if (!cssValue->isImageValue())
            continue;

        CSSImageValue* imageValue = static_cast<CSSImageValue*>(cssValue.get());
        StyleImage* styleImage = imageValue->cachedOrPendingImage();
        // Non cached-images are just place-holders and do not contain data.
        if (!styleImage || !styleImage->isCachedImage())
            continue;

        CachedImage* image = static_cast<StyleCachedImage*>(styleImage)->cachedImage();

        KURL url = cssStyleSheet->document()->completeURL(image->url());
        addImageToResources(image, url);
    }
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:34,代码来源:PageSerializer.cpp

示例8: computeReplacedLogicalHeight

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

示例9: ASSERT

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);
}
开发者ID:1833183060,项目名称:wke,代码行数:29,代码来源:PasteboardGtk.cpp

示例10: ASSERT

void ImageLoader::setImageWithoutConsideringPendingLoadEvent(CachedImage* newImage)
{
    ASSERT(m_failedLoadURL.isEmpty());
    CachedImage* oldImage = m_image.get();
    if (newImage != oldImage) {
        m_image = newImage;
        if (m_hasPendingBeforeLoadEvent) {
            beforeLoadEventSender().cancelEvent(this);
            m_hasPendingBeforeLoadEvent = false;
        }
        if (m_hasPendingLoadEvent) {
            loadEventSender().cancelEvent(this);
            m_hasPendingLoadEvent = false;
        }
        if (m_hasPendingErrorEvent) {
            errorEventSender().cancelEvent(this);
            m_hasPendingErrorEvent = false;
        }
        m_imageComplete = true;
        if (newImage)
            newImage->addClient(this);
        if (oldImage)
            oldImage->removeClient(this);
    }

    if (RenderImageResource* imageResource = renderImageResource())
        imageResource->resetAnimation();
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例11: toCSSImageValue

void PageSerializer::retrieveResourcesForProperties(const StyleProperties* styleDeclaration, Document* document)
{
    if (!styleDeclaration)
        return;

    // The background-image and list-style-image (for ul or ol) are the CSS properties
    // that make use of images. We iterate to make sure we include any other
    // image properties there might be.
    unsigned propertyCount = styleDeclaration->propertyCount();
    for (unsigned i = 0; i < propertyCount; ++i) {
        RefPtr<CSSValue> cssValue = styleDeclaration->propertyAt(i).value();
        if (!cssValue->isImageValue())
            continue;

        StyleImage* styleImage = toCSSImageValue(cssValue.get())->cachedOrPendingImage();
        // Non cached-images are just place-holders and do not contain data.
        if (!styleImage || !styleImage->isCachedImage())
            continue;

        CachedImage* image = toStyleCachedImage(styleImage)->cachedImage();

        URL url = document->completeURL(image->url());
        addImageToResources(image, 0, url);
    }
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例12: ASSERT

void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
{
    ASSERT(node);
    ASSERT(node->renderer());
    ASSERT(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);

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

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

示例13: finish

void ImageTokenizer::finish()
{
    if (!m_parserStopped && m_doc->imageElement()) {
        CachedImage* cachedImage = m_doc->cachedImage();
        RefPtr<SharedBuffer> data = m_doc->frame()->loader()->documentLoader()->mainResourceData();

        // If this is a multipart image, make a copy of the current part, since the resource data
        // will be overwritten by the next part.
        if (m_doc->frame()->loader()->documentLoader()->isLoadingMultipartContent())
            data = data->copy();

        cachedImage->data(data.release(), true);
        cachedImage->finish();

        cachedImage->setResponse(m_doc->frame()->loader()->documentLoader()->response());

        IntSize size = cachedImage->imageSize(m_doc->frame()->pageZoomFactor());
        if (size.width()) {
            // Compute the title, we use the decoded filename of the resource, falling
            // back on the (decoded) hostname if there is no path.
            String fileName = decodeURLEscapeSequences(m_doc->url().lastPathComponent());
            if (fileName.isEmpty())
                fileName = m_doc->url().host();
            m_doc->setTitle(imageTitle(fileName, size));
        }

        m_doc->imageChanged();
    }

    m_doc->finishedParsing();
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:31,代码来源:ImageDocument.cpp

示例14: ASSERT

void Pasteboard::writeImage(Node* node, const KURL&, const String&)
{
    ASSERT(node);

    if (!(node->renderer() && node->renderer()->isImage()))
        return;

    RenderImage* renderer = static_cast<RenderImage*>(node->renderer());
    CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage());
    ASSERT(cachedImage);
    Image* image = cachedImage->imageForRenderer(renderer);
    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:dog-god,项目名称:iptv,代码行数:32,代码来源:PasteboardWinCE.cpp

示例15: ASSERT

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);
}
开发者ID:Spencerx,项目名称:webkit,代码行数:35,代码来源:PasteboardChromium.cpp


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