Kaydet (Commit) 4ebe2491 authored tarafından Caolán McNamara's avatar Caolán McNamara

drop basebmp entirely now

Change-Id: I534848c4be8eadf86b7f31ac742a80982405f56f
üst 62ea0ef8
......@@ -63,7 +63,6 @@ There are several other libraries that are helpful from a graphical perspective:
Module | Description
----------|-------------------------------------------------
basebmp/ | enables a VCL compatible rendering API to render to bitmaps, as used for LibreOffice Online, Android, iOS, etc.
basegfx/ | algorithms and data-types for graphics as used in the canvas
canvas/ | new (UNO) canvas rendering model with various backends
cppcanvas/ | C++ helper classes for using the UNO canvas
......
......@@ -281,9 +281,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
basctl \
basprov \
) \
$(if $(filter $(OS),ANDROID),, \
basebmp \
) \
basegfx \
bib \
$(if $(ENABLE_CAIRO_CANVAS),cairocanvas) \
......
......@@ -59,7 +59,6 @@ $(eval $(call gb_Module_add_moduledirs,cross_toolset,\
$(call gb_Helper_optional_for_host,DESKTOP, \
$(if $(WITH_GALLERY_BUILD), \
avmedia \
basebmp \
basic \
canvas \
configmgr \
......
......@@ -27,7 +27,6 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
apple_remote \
$(call gb_Helper_optional,AVMEDIA,avmedia) \
basctl \
basebmp \
basegfx \
basic \
bean \
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_CppunitTest_CppunitTest,basebmp))
$(eval $(call gb_CppunitTest_use_sdk_api,basebmp))
$(eval $(call gb_CppunitTest_use_external,basebmp,boost_headers))
$(eval $(call gb_CppunitTest_use_libraries,basebmp,\
basebmp \
))
$(eval $(call gb_CppunitTest_use_libraries,basebmp,\
basegfx \
sal \
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_add_exception_objects,basebmp,\
basebmp/test/basictest \
basebmp/test/tools \
))
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_Library_Library,basebmp))
$(eval $(call gb_Library_use_sdk_api,basebmp))
$(eval $(call gb_Library_set_include,basebmp,\
-I$(SRCDIR)/basebmp/inc \
$$(INCLUDE) \
))
$(eval $(call gb_Library_use_externals,basebmp,\
boost_headers \
vigra_headers \
))
$(eval $(call gb_Library_use_libraries,basebmp,\
basegfx \
sal \
$(gb_UWINAPI) \
))
$(eval $(call gb_Library_add_defs,basebmp,\
-DBASEBMP_DLLIMPLEMENTATION \
))
# TODO(davido): This is failing only in release mode with:
#
# Compilation of bitmapdevice.cxx is failing in release mode:
#
# Fatal Error C1128: number of sections exceeded object file
# format limit : compile with /bigobj
#
ifeq ($(COM),MSC)
ifeq ($(CPUNAME),X86_64)
$(eval $(call gb_Library_add_cxxflags,basebmp, \
-bigobj \
))
endif
endif
$(eval $(call gb_Library_add_exception_objects,basebmp,\
basebmp/source/bitmapdevice \
))
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
include $(module_directory)/../solenv/gbuild/partial_build.mk
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_Module_Module,basebmp))
ifeq ($(OS),ANDROID)
$(eval $(call gb_Module_add_targets,basebmp,\
StaticLibrary_basebmp \
))
else
$(eval $(call gb_Module_add_targets,basebmp,\
Library_basebmp \
))
endif
$(eval $(call gb_Module_add_check_targets,basebmp,\
CppunitTest_basebmp \
))
# vim: set noet sw=4 ts=4:
Provides a BitmapDevice: the vcl software renderer
Provides algorithms and data types for bitmap graphics e.g. line and fill
polygon scan conversion, bitmap format iterators, and a SalGraphics-compatible
software renderer
Used for example for wmf / svm files. E.g. used when you do --headless, and
have no DISPLAY set - it's an all-software backend for the LibO graphic
backend. also see [git:vcl/headless].
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_StaticLibrary_StaticLibrary,basebmp))
$(eval $(call gb_StaticLibrary_use_sdk_api,basebmp))
$(eval $(call gb_StaticLibrary_set_include,basebmp,\
-I$(SRCDIR)/basebmp/inc \
$$(INCLUDE) \
))
$(eval $(call gb_StaticLibrary_use_externals,basebmp,\
boost_headers \
vigra_headers \
))
$(eval $(call gb_StaticLibrary_use_libraries,basebmp,\
basegfx \
sal \
$(gb_UWINAPI) \
))
$(eval $(call gb_StaticLibrary_add_defs,basebmp,\
-DBASEBMP_DLLIMPLEMENTATION \
))
$(eval $(call gb_StaticLibrary_add_exception_objects,basebmp,\
basebmp/source/bitmapdevice \
))
# vim: set noet sw=4 ts=4:
/* -*- 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 .
*/
#ifndef INCLUDED_BASEBMP_INC_ACCESSOR_HXX
#define INCLUDED_BASEBMP_INC_ACCESSOR_HXX
#include <vigra/numerictraits.hxx>
namespace basebmp
{
/** Standard accessor type
Accesses the iterator values the standard way (i.e. via
*operator()/operator[])
*/
template<typename ValueType> class StandardAccessor
{
public:
typedef ValueType value_type;
template< class Iterator >
value_type operator()(Iterator const& i) const
{
return *i;
}
template< class Iterator, class Difference >
value_type operator()(Iterator const& i, Difference const& diff) const
{
return i[diff];
}
template< typename V, class Iterator >
void set(V const& value, Iterator const& i) const
{
*i = vigra::detail::RequiresExplicitCast<value_type>::cast(value);
}
};
/** Non-standard accessor type
Uses getter/setter methods at the given iterator type, to access
the underlying values.
*/
template<typename ValueType> class NonStandardAccessor
{
public:
typedef ValueType value_type;
template< class Iterator >
value_type operator()(Iterator const& i) const
{
return i.get();
}
template< class Iterator, class Difference >
value_type operator()(Iterator const& i, Difference const& diff) const
{
return i.get(diff);
}
template< typename V, class Iterator >
void set(V const& value, Iterator const& i) const
{
i.set( vigra::detail::RequiresExplicitCast<value_type>::cast(value) );
}
};
} // namespace basebmp
#endif /* INCLUDED_BASEBMP_INC_ACCESSOR_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
/* -*- 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 .
*/
#ifndef INCLUDED_BASEBMP_INC_ACCESSORFUNCTORS_HXX
#define INCLUDED_BASEBMP_INC_ACCESSORFUNCTORS_HXX
#include <osl/diagnose.h>
#include <metafunctions.hxx>
#include <functional>
namespace basebmp
{
/// Base class, passing on the arg types
template< typename T, typename M > struct MaskFunctorBase :
public TernaryFunctorBase<T,M,T,T> {};
/** Let a mask flag decide between two values
@tpl polarity
Mask polarity. When true, a false in the mask denotes
transparency, i.e. the original value will display. And vice
versa.
*/
template< typename T,
typename M,
bool polarity > struct GenericOutputMaskFunctor : public MaskFunctorBase<T,M>
{
/// Ternary mask operation - selects v1 for !m == polarity, v2 otherwise
T operator()( T v1, M m, T v2 ) const
{
return !m == polarity ? v1 : v2;
}
};
/** Let a mask bit decide between two values (specialization for
integer mask types)
*/
template< typename T,
typename M,
bool polarity > struct IntegerOutputMaskFunctor;
template< typename T,
typename M > struct IntegerOutputMaskFunctor<T,M,true> : public MaskFunctorBase<T,M>
{
/** Mask v with state of m
@return v2, if m != 0, v1 otherwise.
*/
T operator()( T v1, M m, T v2 ) const
{
typedef typename make_unsigned<T>::type unsigned_T;
// mask will be 0, iff m == 0, and 1 otherwise
const T mask( unsigned_cast<T>(m | -m) >> (sizeof(unsigned_T)*8 - 1) );
return v1*static_cast<M>(1-mask) + v2*mask;
}
};
template< typename T,
typename M > struct IntegerOutputMaskFunctor<T,M,false> : public MaskFunctorBase<T,M>
{
/** Mask v with state of m
@return v2, if m != 0, v1 otherwise.
*/
T operator()( T v1, M m, T v2 ) const
{
typedef typename make_unsigned<T>::type unsigned_T;
// mask will be 0, iff m == 0, and 1 otherwise
const T mask( unsigned_cast<T>(m | -m) >> (sizeof(unsigned_T)*8 - 1) );
return v1*mask + v2*static_cast<M>(1-mask);
}
};
/** Let a mask bit decide between two values (specialization for
binary-valued mask types)
*/
template< typename T, typename M, bool polarity > struct FastIntegerOutputMaskFunctor;
template< typename T, typename M > struct FastIntegerOutputMaskFunctor<T,M,true> :
public MaskFunctorBase<T,M>
{
/// Specialization, only valid if mask can only attain 0 or 1
T operator()( T v1, M m, T v2 ) const
{
OSL_ASSERT(m<=1);
return v1*static_cast<M>(1-m) + v2*m;
}
};
template< typename T, typename M > struct FastIntegerOutputMaskFunctor<T,M,false> :
public MaskFunctorBase<T,M>
{
/// Specialization, only valid if mask can only attain 0 or 1
T operator()( T v1, M m, T v2 ) const
{
OSL_ASSERT(m<=1);
return v1*m + v2*static_cast<M>(1-m);
}
};
/** Split a pair value from a JoinImageAccessorAdapter into its
individual values, and pass it on to a ternary functor
This wrapper is an adaptable binary functor, and can thus be used
with a BinarySetterFunctionAccessorAdapter. Useful e.g. for
out-of-image alpha channel, or a masked image.
@tpl Functor
An adaptable ternary functor (as can e.g. be passed to the
TernarySetterFunctionAccessorAdapter)
*/
template< typename Functor > struct BinaryFunctorSplittingWrapper :
public std::binary_function<typename Functor::first_argument_type,
std::pair<typename Functor::third_argument_type,
typename Functor::second_argument_type>,
typename Functor::result_type>
{
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
// making all members public, if no member template friends
private:
template<class A> friend struct BinaryFunctorSplittingWrapper;
#endif
Functor maFunctor;
public:
BinaryFunctorSplittingWrapper() : maFunctor() {}
template< class A > explicit
BinaryFunctorSplittingWrapper(
BinaryFunctorSplittingWrapper<A> const& src ) : maFunctor(src.maFunctor) {}
template< class F > explicit
BinaryFunctorSplittingWrapper( F const& func ) : maFunctor(func) {}
typename Functor::result_type operator()(
typename Functor::first_argument_type v1,
std::pair< typename Functor::third_argument_type,
typename Functor::second_argument_type > const& v2 ) const
{
return maFunctor( v1, v2.second, v2.first );
}
};
} // namespace basebmp
#endif /* INCLUDED_BASEBMP_INC_ACCESSORFUNCTORS_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef INCLUDED_BASEBMP_INC_ACCESSORTRAITS_HXX
#define INCLUDED_BASEBMP_INC_ACCESSORTRAITS_HXX
#include <accessorfunctors.hxx>
#include <accessoradapters.hxx>
#include <metafunctions.hxx>
namespace basebmp
{
struct FastMask;
struct NoFastMask;
/// Metafunction to select output mask functor from iterator and mask value type
template< typename T, typename M, bool polarity, typename DUMMY > struct outputMaskFunctorSelector : public
ifBothScalarIntegral< T, M,
IntegerOutputMaskFunctor< T, M, polarity >,
GenericOutputMaskFunctor< T, M, polarity > >
{
};
template< typename T, typename M, bool polarity > struct outputMaskFunctorSelector< T, M, polarity, FastMask > : public
ifBothScalarIntegral< T, M,
FastIntegerOutputMaskFunctor< T, M, polarity >,
GenericOutputMaskFunctor< T, M, polarity > >
{
};
/** Metafunction providing a point of configuration for iterators
capable of employing the fast output mask functor.
Specialize this metafunction for your case, and pass FastMask to
the outputMaskFunctorSelector.
*/
template< class Accessor,
class MaskAccessor,
class Iterator,
class MaskIterator,
bool polarity > struct maskedAccessorSelector
{
typedef TernarySetterFunctionAccessorAdapter<
Accessor,
MaskAccessor,
typename outputMaskFunctorSelector<
typename Accessor::value_type,
typename MaskAccessor::value_type,
polarity,
NoFastMask > ::type >
type;
};
/// given an Accessor and its value type return its value_type
template< typename Accessor > struct ColorPassThrough
{
typename Accessor::value_type operator()( const Accessor&,
const typename Accessor::value_type& x ) const
{
return x;
}
};
/** Traits template for Accessor
Provides wrapped types for color lookup, raw pixel access, xor and
mask accessors.
*/
template< class Accessor > struct AccessorTraits
{
/// value type of described accessor
typedef typename Accessor::value_type value_type;
/// Retrieve stand-alone color lookup function for given Accessor type
typedef ColorPassThrough< Accessor > color_lookup;
/// Retrieve raw pixel data accessor for given Accessor type
typedef Accessor raw_accessor;
/** Retrieve masked accessor for given types
A masked accessor works like a filter, where the mask gates
the accessor's setter methods (if the mask contains a 0 at a
given iterator position, the original value is
preserved. Otherwise, the new value gets set).
@attention be careful when retrieving a masked accessor for a
set of types, and using it for a different one - there are
partial specializations that take an optimized functor for
certain mask accessors.
*/
template< class MaskAccessor,
class Iterator,
class MaskIterator,
bool polarity > struct masked_accessor :
public maskedAccessorSelector< Accessor,
MaskAccessor,
Iterator,
MaskIterator,
polarity >
{};
};
} // namespace basebmp
#endif /* INCLUDED_BASEBMP_INC_ACCESSORTRAITS_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef INCLUDED_BASEBMP_INC_COLORMISC_HXX
#define INCLUDED_BASEBMP_INC_COLORMISC_HXX
#include <osl/diagnose.h>
#include <basebmp/color.hxx>
#include <colortraits.hxx>
#include <accessortraits.hxx>
#include <vigra/mathutil.hxx>
// Contents of this header moved out of color.hxx, as it is not useful
// for the general public (drags in vigra and other template
// functionality, that shouldn't be necessary for the ordinary client
// of BitmapDevice etc.)
namespace basebmp
{
template< bool polarity > struct ColorBitmaskOutputMaskFunctor;
template<> struct ColorBitmaskOutputMaskFunctor<true> : MaskFunctorBase<Color,sal_uInt8>
{
Color operator()( Color v1, sal_uInt8 m, Color v2 ) const
{
OSL_ASSERT(m<=1);
return Color(v1.toInt32()*(sal_uInt8)(1-m) + v2.toInt32()*m);
}
};
template<> struct ColorBitmaskOutputMaskFunctor<false> : MaskFunctorBase<Color,sal_uInt8>
{
Color operator()( Color v1, sal_uInt8 m, Color v2 ) const
{
OSL_ASSERT(m<=1);
return Color(v1.toInt32()*m + v2.toInt32()*(sal_uInt8)(1-m));
}
};
/// Specialized output mask functor for Color value type
template<bool polarity> struct outputMaskFunctorSelector< Color, sal_uInt8, polarity, FastMask >
{
typedef ColorBitmaskOutputMaskFunctor<polarity> type;
};
template< bool polarity > struct ColorBlendFunctor8
: public TernaryFunctorBase<sal_uInt8,Color,Color,Color>
{
Color operator()( sal_uInt8 alpha,
Color v1,
Color v2 ) const
{
alpha = polarity ? alpha : 255 - alpha;
const sal_uInt8 v1_red( v1.getRed() );
const sal_uInt8 v1_green( v1.getGreen() );
const sal_uInt8 v1_blue( v1.getBlue() );
// using '>> 8' instead of '/ 0x100' is ill-advised (shifted
// value might be negative). Better rely on decent optimizer
// here...
return Color(((((sal_Int32)v2.getRed() - v1_red)*alpha) / 0x100) + v1_red,
((((sal_Int32)v2.getGreen() - v1_green)*alpha) / 0x100) + v1_green,
((((sal_Int32)v2.getBlue() - v1_blue)*alpha) / 0x100) + v1_blue);
}
};
template< bool polarity > struct ColorBlendFunctor32
: public TernaryFunctorBase<Color,Color,Color,Color>
{
Color operator()( Color input,
Color v1,
Color v2 ) const
{
sal_uInt8 alpha = input.getGreyscale();
alpha = polarity ? alpha : 255 - alpha;
const sal_uInt8 v1_red( v1.getRed() );
const sal_uInt8 v1_green( v1.getGreen() );
const sal_uInt8 v1_blue( v1.getBlue() );
// using '>> 8' instead of '/ 0x100' is ill-advised (shifted
// value might be negative). Better rely on decent optimizer
// here...
return Color(((((sal_Int32)v2.getRed() - v1_red)*alpha) / 0x100) + v1_red,
((((sal_Int32)v2.getGreen() - v1_green)*alpha) / 0x100) + v1_green,
((((sal_Int32)v2.getBlue() - v1_blue)*alpha) / 0x100) + v1_blue);
}
};
template<> struct ColorTraits< Color >
{
/// Type of a color component (i.e. the type of an individual channel)
typedef sal_uInt8 component_type;