diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-01-19 10:44:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-01-19 13:24:28 +0000 |
commit | 8b5e8dfed7c7c3c6669062a3db04961fe5eb1855 (patch) | |
tree | f700c06461936c8ff489a1f50668161189d85cb4 /basebmp | |
parent | 29ce905f8e8642d87780282184f9cf7991c82c36 (diff) |
drop some more stuff
Change-Id: I92eb6d136fc117f4694aa2cf88d93d4486855618
Diffstat (limited to 'basebmp')
-rw-r--r-- | basebmp/inc/colorblendaccessoradapter.hxx | 123 | ||||
-rw-r--r-- | basebmp/source/bitmapdevice.cxx | 86 | ||||
-rw-r--r-- | basebmp/source/intconversion.hxx | 88 |
3 files changed, 0 insertions, 297 deletions
diff --git a/basebmp/inc/colorblendaccessoradapter.hxx b/basebmp/inc/colorblendaccessoradapter.hxx deleted file mode 100644 index 767d55eb7491..000000000000 --- a/basebmp/inc/colorblendaccessoradapter.hxx +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- 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_COLORBLENDACCESSORADAPTER_HXX -#define INCLUDED_BASEBMP_INC_COLORBLENDACCESSORADAPTER_HXX - -#include <colortraits.hxx> - -namespace basebmp -{ - -/** Accessor adapter that blends input value against fixed color value - - Used to blend an alpha mask 'through' a fixed color value into the - destination. - - The getter functors return a constant value (usually the zero of - the value type, this preserves the original destination content - when blitting through a mask) - there really isn't no other - sensible default behaviour for these methods. - */ -template< class WrappedAccessor, - typename AlphaType, - bool polarity > class ConstantColorBlendSetterAccessorAdapter -{ -public: - typedef AlphaType alpha_type; - typedef AlphaType value_type; - typedef typename WrappedAccessor::value_type color_type; - -private: - typename ColorTraits< color_type >:: - template blend_functor<alpha_type,polarity>::type maFunctor; - WrappedAccessor maWrappee; - color_type maBlendColor; - value_type maGetterValue; - -public: - ConstantColorBlendSetterAccessorAdapter() : - maFunctor(), - maWrappee(), - maBlendColor(), - maGetterValue() - {} - - template< class T > explicit ConstantColorBlendSetterAccessorAdapter( T acc ) : - maFunctor(), - maWrappee(acc), - maBlendColor(), - maGetterValue() - {} - - template< class T > ConstantColorBlendSetterAccessorAdapter( T acc, - color_type col ) : - maFunctor(), - maWrappee(acc), - maBlendColor(col), - maGetterValue() - {} - - template< class T > ConstantColorBlendSetterAccessorAdapter( T acc, - color_type col, - value_type val ) : - maFunctor(), - maWrappee(acc), - maBlendColor(col), - maGetterValue(val) - {} - - - - void setColor( color_type col ) { maBlendColor=col; } - - - - /// @return constant value, regardless of iterator content - template< typename IteratorType > value_type operator()(SAL_UNUSED_PARAMETER IteratorType const& ) const - { - return maGetterValue; - } - /// @return constant value, regardless of iterator content - template< typename IteratorType, class Difference > - value_type operator()(SAL_UNUSED_PARAMETER IteratorType const& , SAL_UNUSED_PARAMETER Difference const& ) const - { - return maGetterValue; - } - - - - template< typename V, typename IteratorType > - void set(V const& value, IteratorType const& i) const - { - maWrappee.set( - maFunctor( - vigra::detail::RequiresExplicitCast<alpha_type>::cast(value), - maWrappee(i), - maBlendColor), - i ); - } - -}; - -} // namespace basebmp - -#endif /* INCLUDED_BASEBMP_INC_COLORBLENDACCESSORADAPTER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 32abb0527eb0..6c848600a114 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -30,11 +30,9 @@ #include <accessor.hxx> #include <accessortraits.hxx> #include <accessoradapters.hxx> -#include <colorblendaccessoradapter.hxx> #include <basebmp/color.hxx> #include <colormisc.hxx> -#include <colortraits.hxx> #include <greylevelformats.hxx> #include <paletteformats.hxx> @@ -46,7 +44,6 @@ #include <genericcolorimageaccessor.hxx> #include <tools.hxx> -#include "intconversion.hxx" #include <rtl/alloc.h> #include <sal/log.hxx> @@ -64,11 +61,6 @@ #include <basegfx/point/b2ipoint.hxx> #include <basegfx/vector/b2ivector.hxx> -#include <vigra/iteratortraits.hxx> -#include <vigra/rgbvalue.hxx> -#include <vigra/copyimage.hxx> -#include <vigra/tuple.hxx> - namespace basebmp { @@ -96,38 +88,6 @@ static const o3tl::enumarray<Format,sal_uInt8> bitsPerPixel = namespace { - /** Create the type for an accessor that takes the (mask,bitmap) - input value generated from a JoinImageAccessorAdapter, and - pipe that through a mask functor. - - @tpl DestAccessor - Destination bitmap accessor - - @tpl JoinedAccessor - Input accessor, is expected to generate a std::pair as the - value type - - @tpl MaskFunctorMode - Either FastMask or NoFastMask, depending on whether the mask - is guaranteed to contain only 0s and 1s. - */ - template< class DestAccessor, - class JoinedAccessor, - bool polarity, - typename MaskFunctorMode > struct masked_input_splitting_accessor - { - typedef BinarySetterFunctionAccessorAdapter< - DestAccessor, - BinaryFunctorSplittingWrapper< - typename outputMaskFunctorSelector< - typename JoinedAccessor::value_type::first_type, - typename JoinedAccessor::value_type::second_type, - polarity, - MaskFunctorMode >::type > > type; - }; - - - // Actual BitmapDevice implementation (templatized by accessor and iterator) /** Implementation of the BitmapDevice interface @@ -160,13 +120,8 @@ namespace typedef AccessorTraits< dest_accessor_type > accessor_traits; typedef AccessorTraits< raw_accessor_type > raw_accessor_traits; - typedef typename uInt32Converter< - typename raw_accessor_type::value_type>::to to_uint32_functor; - dest_iterator_type maBegin; - typename accessor_traits::color_lookup maColorLookup; - to_uint32_functor maToUInt32Converter; dest_accessor_type maAccessor; raw_accessor_type maRawAccessor; @@ -185,8 +140,6 @@ namespace BitmapDevice( rBounds, nScanlineFormat, nScanlineStride, pFirstScanline, rMem, rPalette ), maBegin( begin ), - maColorLookup(), - maToUInt32Converter(), maAccessor( accessor ), maRawAccessor( rawAccessor ) {} @@ -213,14 +166,6 @@ namespace return maAccessor(pixel); } - virtual sal_uInt32 getPixelData_i( const basegfx::B2IPoint& rPt ) override - { - const DestIterator pixel( maBegin + - vigra::Diff2D(rPt.getX(), - rPt.getY()) ); - return maToUInt32Converter(maRawAccessor(pixel)); - } - template< typename Iterator, typename RawAcc > void implDrawBitmap(const BitmapDeviceSharedPtr& rSrcBitmap, const Iterator& begin, @@ -325,22 +270,6 @@ struct ImplBitmapDevice /// raw ptr to 0th scanline. used for cloning a generic renderer sal_uInt8* mpFirstScanline; - - /** (Optional) device sharing the same memory, and used for input - clip masks/alpha masks/bitmaps that don't match our exact - bitmap format. - - This is to avoid the combinatorial explosion when dealing - with n bitmap formats, which could be combined with n clip - masks, alpha masks and bitmap masks (yielding a total of n^4 - combinations). Since each BitmapRenderer is specialized for - one specific combination of said formats, a lot of duplicate - code would be generated, most of which probably never - used. Therefore, only the most common combinations are - specialized templates, the remainder gets handled by this - generic renderer (via runtime polymorphism). - */ - BitmapDeviceSharedPtr mpGenericRenderer; }; @@ -401,14 +330,6 @@ Color BitmapDevice::getPixel( const basegfx::B2IPoint& rPt ) return Color(); } -sal_uInt32 BitmapDevice::getPixelData( const basegfx::B2IPoint& rPt ) -{ - if( mpImpl->maBounds.isInside(rPt) ) - return getPixelData_i(rPt); - - return 0; -} - void BitmapDevice::copyBitmap( const BitmapDeviceSharedPtr& rSrcBitmap ) { copyBitmap_i( rSrcBitmap ); @@ -756,13 +677,6 @@ BitmapDeviceSharedPtr cloneBitmapDevice( const basegfx::B2IVector& rSize, rProto->getPalette() ); } - -/// Clone our device, with GenericImageAccessor to handle all formats -BitmapDeviceSharedPtr BitmapDevice::getGenericRenderer() const -{ - return mpImpl->mpGenericRenderer; -} - } // namespace basebmp /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basebmp/source/intconversion.hxx b/basebmp/source/intconversion.hxx deleted file mode 100644 index a5360413663d..000000000000 --- a/basebmp/source/intconversion.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- 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_SOURCE_INTCONVERSION_HXX -#define INCLUDED_BASEBMP_SOURCE_INTCONVERSION_HXX - -#include <vigra/rgbvalue.hxx> -#include <functional> - -namespace basebmp -{ - // metafunctions to retrieve correct POD from/to basebmp::Color - - /// type-safe conversion from RgbValue to packed int32 - template< class RgbVal > struct UInt32FromRgbValue - { - sal_uInt32 operator()( RgbVal const& c ) const - { - return (c[0] << 16) | (c[1] << 8) | c[2]; - } - }; - - /// type-safe conversion from packed int32 to RgbValue - template< class RgbVal > struct RgbValueFromUInt32 - { - RgbVal operator()( sal_uInt32 c ) const - { - return RgbVal((c >> 16) & 0xFF, - (c >> 8) & 0xFF, - c & 0xFF); - } - }; - - //Current c++0x draft (apparently) has std::identity, but not operator() - template<typename T> struct SGI_identity : public std::unary_function<T,T> - { - T& operator()(T& x) const { return x; } - const T& operator()(const T& x) const { return x; } - }; - - /// Get converter from given data type to sal_uInt32 - template< typename DataType > struct uInt32Converter - { - typedef SGI_identity<DataType> to; - typedef SGI_identity<DataType> from; - }; - template< unsigned int RedIndex, - unsigned int GreenIndex, - unsigned int BlueIndex > struct uInt32Converter< - vigra::RGBValue< sal_uInt8, - RedIndex, - GreenIndex, - BlueIndex > > - { - typedef UInt32FromRgbValue< - vigra::RGBValue< sal_uInt8, - RedIndex, - GreenIndex, - BlueIndex > > - to; - typedef RgbValueFromUInt32< - vigra::RGBValue< sal_uInt8, - RedIndex, - GreenIndex, - BlueIndex > > - from; - }; -} - -#endif // INCLUDED_BASEBMP_SOURCE_INTCONVERSION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |