/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
namespace
{ // check for env var that decides for using downscale pattern constchar* pDisableDownScale(getenv("SAL_DISABLE_CAIRO_DOWNSCALE")); bool bDisableDownScale(nullptr != pDisableDownScale);
if (nullptr != pHelper)
{
cairo_surface_t* pSurface(pHelper->getSurface());
if (pSurface)
{ const tools::Long nStride(cairo_image_surface_get_stride(pSurface)); const tools::Long nHeight(cairo_image_surface_get_height(pSurface));
nRetval = nStride * nHeight;
// if we do downscale, size will grow by 1/4 + 1/16 + 1/32 + ..., // rough estimation just multiplies by 1.25, should be good enough // for estimation of buffer survival time if (!bDisableDownScale)
{
nRetval = (nRetval * 5) / 4;
}
}
}
if (bBufferSource)
{
pSystemDependentData_BitmapHelper
= rSourceBitmap.getSystemDependentData<SystemDependentData_BitmapHelper>(
basegfx::SDD_Type::SDDType_BitmapHelper);
if (pSystemDependentData_BitmapHelper)
{ // reuse buffered data
rSurface = pSystemDependentData_BitmapHelper->getBitmapHelper();
}
}
if (rSurface) return;
// create data on-demand
rSurface = std::make_shared<BitmapHelper>(rSourceBitmap);
if (bBufferSource)
{ // add to buffering mechanism to potentially reuse next time
rSourceBitmap.addOrReplaceSystemDependentData<SystemDependentData_BitmapHelper>(rSurface);
}
}
if (bBufferMask)
{
pSystemDependentData_MaskHelper
= rMaskBitmap.getSystemDependentData<SystemDependentData_MaskHelper>(
basegfx::SDD_Type::SDDType_MaskHelper);
if (pSystemDependentData_MaskHelper)
{ // reuse buffered data
rMask = pSystemDependentData_MaskHelper->getMaskHelper();
}
}
if (rMask) return;
// create data on-demand
rMask = std::make_shared<MaskHelper>(rMaskBitmap);
if (bBufferMask)
{ // add to buffering mechanism to potentially reuse next time
rMaskBitmap.addOrReplaceSystemDependentData<SystemDependentData_MaskHelper>(rMask);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.