Esempio n. 1
0
SkBitmapProcInfo::SkBitmapProcInfo(const SkBitmap& bm,
                                   SkShader::TileMode tmx, SkShader::TileMode tmy)
    : fProvider(SkBitmapProvider(bm))
    , fTileModeX(tmx)
    , fTileModeY(tmy)
    , fBMState(nullptr)
{}
Esempio n. 2
0
SkShaderBase::Context* SkImageShader::onMakeContext(const ContextRec& rec,
                                                    SkArenaAlloc* alloc) const {
    const auto info = as_IB(fImage)->onImageInfo();

    if (info.colorType() != kN32_SkColorType) {
        return nullptr;
    }
    if (info.alphaType() == kUnpremul_SkAlphaType) {
        return nullptr;
    }
#ifndef SK_SUPPORT_LEGACY_TILED_BITMAPS
    if (fTileModeX != fTileModeY) {
        return nullptr;
    }
#endif
    if (fTileModeX == kDecal_TileMode || fTileModeY == kDecal_TileMode) {
        return nullptr;
    }

    SkMatrix inv;
    if (!this->computeTotalInverse(*rec.fMatrix, rec.fLocalMatrix, &inv) ||
        !legacy_shader_can_handle(inv)) {
        return nullptr;
    }

    return SkBitmapProcLegacyShader::MakeContext(*this, fTileModeX, fTileModeY,
                                                 SkBitmapProvider(fImage.get(), rec.fDstColorSpace),
                                                 rec, alloc);
}
Esempio n. 3
0
SkBitmapProcState::SkBitmapProcState(const SkBitmap& bm,
                                     SkShader::TileMode tmx, SkShader::TileMode tmy)
    : fProvider(SkBitmapProvider(bm))
    , fBMState(nullptr)
{
    fTileModeX = tmx;
    fTileModeY = tmy;
}
Esempio n. 4
0
SkBitmapProcInfo::SkBitmapProcInfo(const SkBitmap& bm,
                                   SkShader::TileMode tmx, SkShader::TileMode tmy,
                                   SkSourceGammaTreatment treatment)
    : fProvider(SkBitmapProvider(bm))
    , fTileModeX(tmx)
    , fTileModeY(tmy)
    , fSrcGammaTreatment(treatment)
    , fBMState(nullptr)
{}
SkShader::Context* SkImageShader::onCreateContext(const ContextRec& rec, void* storage) const {
    return SkBitmapProcShader::MakeContext(*this, fTileModeX, fTileModeY,
                                           SkBitmapProvider(fImage), rec, storage);
}
SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, void* storage) const {
    return MakeContext(*this, (TileMode)fTileModeX, (TileMode)fTileModeY,
                       SkBitmapProvider(fRawBitmap), rec, storage);
}
Esempio n. 7
0
size_t SkImageShader::onContextSize(const ContextRec& rec) const {
    return SkBitmapProcLegacyShader::ContextSize(rec, SkBitmapProvider(fImage).info());
}