Beispiel #1
0
void FilterEffect::transformResultColorSpace(ColorSpace dstColorSpace)
{
    if (!hasResult() || dstColorSpace == m_resultColorSpace)
        return;

#if ENABLE(OPENCL)
    if (openCLImage()) {
        if (m_imageBufferResult)
            m_imageBufferResult.clear();
        FilterContextOpenCL* context = FilterContextOpenCL::context();
        ASSERT(context);
        context->openCLTransformColorSpace(m_openCLImageResult, absolutePaintRect(), m_resultColorSpace, dstColorSpace);
    } else {
#endif

        // FIXME: We can avoid this potentially unnecessary ImageBuffer conversion by adding
        // color space transform support for the {pre,un}multiplied arrays.
        asImageBuffer()->transformColorSpace(m_resultColorSpace, dstColorSpace);

#if ENABLE(OPENCL)
    }
#endif

    m_resultColorSpace = dstColorSpace;

    if (m_unmultipliedImageResult)
        m_unmultipliedImageResult.clear();
    if (m_premultipliedImageResult)
        m_premultipliedImageResult.clear();
}
Beispiel #2
0
void FilterEffect::transformResultColorSpace(ColorSpace dstColorSpace)
{
    if (!hasResult() || dstColorSpace == m_resultColorSpace)
        return;

    // FIXME: We can avoid this potentially unnecessary ImageBuffer conversion by adding
    // color space transform support for the {pre,un}multiplied arrays.
    asImageBuffer()->transformColorSpace(m_resultColorSpace, dstColorSpace);

    m_resultColorSpace = dstColorSpace;

    if (m_unmultipliedImageResult)
        m_unmultipliedImageResult.clear();
    if (m_premultipliedImageResult)
        m_premultipliedImageResult.clear();
}
bool SourceAlpha::platformApplyOpenCL()
{
    FilterContextOpenCL* context = FilterContextOpenCL::context();

    if (!context)
        return false;

    platformApplySoftware();
    ImageBuffer* sourceImage = asImageBuffer();
    if (!sourceImage)
        return false;

    RefPtr<Uint8ClampedArray> sourceImageData = sourceImage->getUnmultipliedImageData(IntRect(IntPoint(), sourceImage->internalSize()));
    createOpenCLImageResult(sourceImageData->data());
    return true;
}
Beispiel #4
0
void FilterEffect::transformResultColorSpace(ColorSpace dstColorSpace)
{
#if USE(CG)
    // CG handles color space adjustments internally.
    UNUSED_PARAM(dstColorSpace);
#else
    if (!hasResult() || dstColorSpace == m_resultColorSpace)
        return;

    // FIXME: We can avoid this potentially unnecessary ImageBuffer conversion by adding
    // color space transform support for the {pre,un}multiplied arrays.
    asImageBuffer()->transformColorSpace(m_resultColorSpace, dstColorSpace);

    m_resultColorSpace = dstColorSpace;

    if (m_unmultipliedImageResult)
        m_unmultipliedImageResult = nullptr;
    if (m_premultipliedImageResult)
        m_premultipliedImageResult = nullptr;
#endif
}
Beispiel #5
0
// This function will be changed to abstract virtual when all filters are landed.
bool FilterEffect::platformApplyOpenCL()
{
    if (!FilterContextOpenCL::context())
        return false;

    unsigned size = m_inputEffects.size();
    for (unsigned i = 0; i < size; ++i) {
        FilterEffect* in = m_inputEffects.at(i).get();
        // Software code path expects that at least one of the following fileds is valid.
        if (!in->m_imageBufferResult && !in->m_unmultipliedImageResult && !in->m_premultipliedImageResult)
            in->asImageBuffer();
    }

    platformApplySoftware();
    ImageBuffer* sourceImage = asImageBuffer();
    if (sourceImage) {
        RefPtr<Uint8ClampedArray> sourceImageData = sourceImage->getUnmultipliedImageData(IntRect(IntPoint(), sourceImage->internalSize()));
        createOpenCLImageResult(sourceImageData->data());
    }
    return true;
}