1*25ea7f45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*25ea7f45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*25ea7f45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*25ea7f45SAndrew Rist * distributed with this work for additional information 6*25ea7f45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*25ea7f45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*25ea7f45SAndrew Rist * "License"); you may not use this file except in compliance 9*25ea7f45SAndrew Rist * with the License. You may obtain a copy of the License at 10*25ea7f45SAndrew Rist * 11*25ea7f45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*25ea7f45SAndrew Rist * 13*25ea7f45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*25ea7f45SAndrew Rist * software distributed under the License is distributed on an 15*25ea7f45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*25ea7f45SAndrew Rist * KIND, either express or implied. See the License for the 17*25ea7f45SAndrew Rist * specific language governing permissions and limitations 18*25ea7f45SAndrew Rist * under the License. 19*25ea7f45SAndrew Rist * 20*25ea7f45SAndrew Rist *************************************************************/ 21*25ea7f45SAndrew Rist 22*25ea7f45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_canvas.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/geometry/AffineMatrix2D.hpp> 28cdf0e10cSrcweir #include <com/sun/star/geometry/Matrix2D.hpp> 29cdf0e10cSrcweir #include <com/sun/star/geometry/RealPoint2D.hpp> 30cdf0e10cSrcweir #include <com/sun/star/geometry/RealSize2D.hpp> 31cdf0e10cSrcweir #include <com/sun/star/geometry/IntegerPoint2D.hpp> 32cdf0e10cSrcweir #include <com/sun/star/geometry/IntegerSize2D.hpp> 33cdf0e10cSrcweir #include <com/sun/star/geometry/RealRectangle2D.hpp> 34cdf0e10cSrcweir #include <com/sun/star/geometry/RealBezierSegment2D.hpp> 35cdf0e10cSrcweir #include <com/sun/star/rendering/RenderState.hpp> 36cdf0e10cSrcweir #include <com/sun/star/rendering/ViewState.hpp> 37cdf0e10cSrcweir #include <com/sun/star/rendering/XCanvas.hpp> 38cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp> 39cdf0e10cSrcweir #include <com/sun/star/rendering/TexturingMode.hpp> 40cdf0e10cSrcweir #include <com/sun/star/util/Endianness.hpp> 41cdf0e10cSrcweir #include <com/sun/star/rendering/PathCapType.hpp> 42cdf0e10cSrcweir #include <com/sun/star/rendering/PathJoinType.hpp> 43cdf0e10cSrcweir #include <com/sun/star/rendering/IntegerBitmapLayout.hpp> 44cdf0e10cSrcweir #include <com/sun/star/rendering/FloatingPointBitmapFormat.hpp> 45cdf0e10cSrcweir #include <com/sun/star/rendering/FloatingPointBitmapLayout.hpp> 46cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 47cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 50cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx> 51cdf0e10cSrcweir #include <basegfx/range/b2irange.hxx> 52cdf0e10cSrcweir #include <basegfx/range/b2drectangle.hxx> 53cdf0e10cSrcweir #include <basegfx/point/b2dpoint.hxx> 54cdf0e10cSrcweir #include <basegfx/tools/canvastools.hxx> 55cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx> 56cdf0e10cSrcweir 57cdf0e10cSrcweir #include <canvas/verifyinput.hxx> 58cdf0e10cSrcweir #include <canvas/canvastools.hxx> 59cdf0e10cSrcweir 60cdf0e10cSrcweir 61cdf0e10cSrcweir using namespace ::com::sun::star; 62cdf0e10cSrcweir 63cdf0e10cSrcweir namespace canvas 64cdf0e10cSrcweir { 65cdf0e10cSrcweir namespace tools 66cdf0e10cSrcweir { verifyInput(const geometry::RealPoint2D & rPoint,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)67cdf0e10cSrcweir void verifyInput( const geometry::RealPoint2D& rPoint, 68cdf0e10cSrcweir const char* pStr, 69cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 70cdf0e10cSrcweir ::sal_Int16 nArgPos ) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir (void)pStr; (void)xIf; (void)nArgPos; 73cdf0e10cSrcweir 74cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 75cdf0e10cSrcweir if( !::rtl::math::isFinite( rPoint.X ) ) 76cdf0e10cSrcweir { 77cdf0e10cSrcweir throw lang::IllegalArgumentException( 78cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 79cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): point X value contains infinite or NAN"), 80cdf0e10cSrcweir xIf, 81cdf0e10cSrcweir nArgPos ); 82cdf0e10cSrcweir } 83cdf0e10cSrcweir 84cdf0e10cSrcweir if( !::rtl::math::isFinite( rPoint.Y ) ) 85cdf0e10cSrcweir { 86cdf0e10cSrcweir throw lang::IllegalArgumentException( 87cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 88cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): point X value contains infinite or NAN"), 89cdf0e10cSrcweir xIf, 90cdf0e10cSrcweir nArgPos ); 91cdf0e10cSrcweir } 92cdf0e10cSrcweir #else 93cdf0e10cSrcweir if( !::rtl::math::isFinite( rPoint.X ) || 94cdf0e10cSrcweir !::rtl::math::isFinite( rPoint.Y ) ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir throw lang::IllegalArgumentException(); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir #endif 99cdf0e10cSrcweir } 100cdf0e10cSrcweir verifyInput(const geometry::RealSize2D & rSize,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)101cdf0e10cSrcweir void verifyInput( const geometry::RealSize2D& rSize, 102cdf0e10cSrcweir const char* pStr, 103cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 104cdf0e10cSrcweir ::sal_Int16 nArgPos ) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir (void)pStr; (void)xIf; (void)nArgPos; 107cdf0e10cSrcweir 108cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 109cdf0e10cSrcweir if( !::rtl::math::isFinite( rSize.Width ) ) 110cdf0e10cSrcweir { 111cdf0e10cSrcweir throw lang::IllegalArgumentException( 112cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 113cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): size.Width value contains infinite or NAN"), 114cdf0e10cSrcweir xIf, 115cdf0e10cSrcweir nArgPos ); 116cdf0e10cSrcweir } 117cdf0e10cSrcweir 118cdf0e10cSrcweir if( !::rtl::math::isFinite( rSize.Height ) ) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir throw lang::IllegalArgumentException( 121cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 122cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): size.Height value contains infinite or NAN"), 123cdf0e10cSrcweir xIf, 124cdf0e10cSrcweir nArgPos ); 125cdf0e10cSrcweir } 126cdf0e10cSrcweir #else 127cdf0e10cSrcweir if( !::rtl::math::isFinite( rSize.Width ) || 128cdf0e10cSrcweir !::rtl::math::isFinite( rSize.Height ) ) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir throw lang::IllegalArgumentException(); 131cdf0e10cSrcweir } 132cdf0e10cSrcweir #endif 133cdf0e10cSrcweir } 134cdf0e10cSrcweir verifyInput(const geometry::RealBezierSegment2D & rSegment,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)135cdf0e10cSrcweir void verifyInput( const geometry::RealBezierSegment2D& rSegment, 136cdf0e10cSrcweir const char* pStr, 137cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 138cdf0e10cSrcweir ::sal_Int16 nArgPos ) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir (void)pStr; (void)xIf; (void)nArgPos; 141cdf0e10cSrcweir 142cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 143cdf0e10cSrcweir if( !::rtl::math::isFinite( rSegment.Px ) ) 144cdf0e10cSrcweir { 145cdf0e10cSrcweir throw lang::IllegalArgumentException( 146cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 147cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bezier segment's Px value contains infinite or NAN"), 148cdf0e10cSrcweir xIf, 149cdf0e10cSrcweir nArgPos ); 150cdf0e10cSrcweir } 151cdf0e10cSrcweir 152cdf0e10cSrcweir if( !::rtl::math::isFinite( rSegment.Py ) ) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir throw lang::IllegalArgumentException( 155cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 156cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bezier segment's Py value contains infinite or NAN"), 157cdf0e10cSrcweir xIf, 158cdf0e10cSrcweir nArgPos ); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir 161cdf0e10cSrcweir if( !::rtl::math::isFinite( rSegment.C1x ) ) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir throw lang::IllegalArgumentException( 164cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 165cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bezier segment's C1x value contains infinite or NAN"), 166cdf0e10cSrcweir xIf, 167cdf0e10cSrcweir nArgPos ); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir if( !::rtl::math::isFinite( rSegment.C1y ) ) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir throw lang::IllegalArgumentException( 173cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 174cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bezier segment's C1y value contains infinite or NAN"), 175cdf0e10cSrcweir xIf, 176cdf0e10cSrcweir nArgPos ); 177cdf0e10cSrcweir } 178cdf0e10cSrcweir 179cdf0e10cSrcweir if( !::rtl::math::isFinite( rSegment.C2x ) ) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir throw lang::IllegalArgumentException( 182cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 183cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bezier segment's C2x value contains infinite or NAN"), 184cdf0e10cSrcweir xIf, 185cdf0e10cSrcweir nArgPos ); 186cdf0e10cSrcweir } 187cdf0e10cSrcweir 188cdf0e10cSrcweir if( !::rtl::math::isFinite( rSegment.C2y ) ) 189cdf0e10cSrcweir { 190cdf0e10cSrcweir throw lang::IllegalArgumentException( 191cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 192cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bezier segment's C2y value contains infinite or NAN"), 193cdf0e10cSrcweir xIf, 194cdf0e10cSrcweir nArgPos ); 195cdf0e10cSrcweir } 196cdf0e10cSrcweir #else 197cdf0e10cSrcweir if( !::rtl::math::isFinite( rSegment.Px ) || 198cdf0e10cSrcweir !::rtl::math::isFinite( rSegment.Py ) || 199cdf0e10cSrcweir !::rtl::math::isFinite( rSegment.C1x ) || 200cdf0e10cSrcweir !::rtl::math::isFinite( rSegment.C1y ) || 201cdf0e10cSrcweir !::rtl::math::isFinite( rSegment.C2x ) || 202cdf0e10cSrcweir !::rtl::math::isFinite( rSegment.C2y ) ) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir throw lang::IllegalArgumentException(); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir #endif 207cdf0e10cSrcweir } 208cdf0e10cSrcweir verifyInput(const geometry::RealRectangle2D & rRect,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)209cdf0e10cSrcweir void verifyInput( const geometry::RealRectangle2D& rRect, 210cdf0e10cSrcweir const char* pStr, 211cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 212cdf0e10cSrcweir ::sal_Int16 nArgPos ) 213cdf0e10cSrcweir { 214cdf0e10cSrcweir (void)pStr; (void)xIf; (void)nArgPos; 215cdf0e10cSrcweir 216cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 217cdf0e10cSrcweir if( !::rtl::math::isFinite( rRect.X1 ) ) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir throw lang::IllegalArgumentException( 220cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 221cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): rectangle point X1 contains infinite or NAN"), 222cdf0e10cSrcweir xIf, 223cdf0e10cSrcweir nArgPos ); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir 226cdf0e10cSrcweir if( !::rtl::math::isFinite( rRect.Y1 ) ) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir throw lang::IllegalArgumentException( 229cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 230cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): rectangle point Y1 contains infinite or NAN"), 231cdf0e10cSrcweir xIf, 232cdf0e10cSrcweir nArgPos ); 233cdf0e10cSrcweir } 234cdf0e10cSrcweir 235cdf0e10cSrcweir if( !::rtl::math::isFinite( rRect.X2 ) ) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir throw lang::IllegalArgumentException( 238cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 239cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): rectangle point X2 contains infinite or NAN"), 240cdf0e10cSrcweir xIf, 241cdf0e10cSrcweir nArgPos ); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir 244cdf0e10cSrcweir if( !::rtl::math::isFinite( rRect.Y2 ) ) 245cdf0e10cSrcweir { 246cdf0e10cSrcweir throw lang::IllegalArgumentException( 247cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 248cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): rectangle point Y2 contains infinite or NAN"), 249cdf0e10cSrcweir xIf, 250cdf0e10cSrcweir nArgPos ); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir #else 253cdf0e10cSrcweir if( !::rtl::math::isFinite( rRect.X1 ) || 254cdf0e10cSrcweir !::rtl::math::isFinite( rRect.Y1 ) || 255cdf0e10cSrcweir !::rtl::math::isFinite( rRect.X2 ) || 256cdf0e10cSrcweir !::rtl::math::isFinite( rRect.Y2 ) ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir throw lang::IllegalArgumentException(); 259cdf0e10cSrcweir } 260cdf0e10cSrcweir #endif 261cdf0e10cSrcweir } 262cdf0e10cSrcweir verifyInput(const geometry::AffineMatrix2D & matrix,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)263cdf0e10cSrcweir void verifyInput( const geometry::AffineMatrix2D& matrix, 264cdf0e10cSrcweir const char* pStr, 265cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 266cdf0e10cSrcweir ::sal_Int16 nArgPos ) 267cdf0e10cSrcweir { 268cdf0e10cSrcweir (void)pStr; (void)xIf; (void)nArgPos; 269cdf0e10cSrcweir 270cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 271cdf0e10cSrcweir const sal_Int32 nBinaryState( 272cdf0e10cSrcweir 100000 * !::rtl::math::isFinite( matrix.m00 ) + 273cdf0e10cSrcweir 10000 * !::rtl::math::isFinite( matrix.m01 ) + 274cdf0e10cSrcweir 1000 * !::rtl::math::isFinite( matrix.m02 ) + 275cdf0e10cSrcweir 100 * !::rtl::math::isFinite( matrix.m10 ) + 276cdf0e10cSrcweir 10 * !::rtl::math::isFinite( matrix.m11 ) + 277cdf0e10cSrcweir 1 * !::rtl::math::isFinite( matrix.m12 ) ); 278cdf0e10cSrcweir 279cdf0e10cSrcweir if( nBinaryState ) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir throw lang::IllegalArgumentException( 282cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 283cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): AffineMatrix2D contains infinite or NAN value(s) at the following positions (m00-m12): ") + 284cdf0e10cSrcweir ::rtl::OUString::valueOf(nBinaryState), 285cdf0e10cSrcweir xIf, 286cdf0e10cSrcweir nArgPos ); 287cdf0e10cSrcweir } 288cdf0e10cSrcweir #else 289cdf0e10cSrcweir if( !::rtl::math::isFinite( matrix.m00 ) || 290cdf0e10cSrcweir !::rtl::math::isFinite( matrix.m01 ) || 291cdf0e10cSrcweir !::rtl::math::isFinite( matrix.m02 ) || 292cdf0e10cSrcweir !::rtl::math::isFinite( matrix.m10 ) || 293cdf0e10cSrcweir !::rtl::math::isFinite( matrix.m11 ) || 294cdf0e10cSrcweir !::rtl::math::isFinite( matrix.m12 ) ) 295cdf0e10cSrcweir { 296cdf0e10cSrcweir throw lang::IllegalArgumentException(); 297cdf0e10cSrcweir } 298cdf0e10cSrcweir #endif 299cdf0e10cSrcweir } 300cdf0e10cSrcweir verifyInput(const geometry::Matrix2D & matrix,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)301cdf0e10cSrcweir void verifyInput( const geometry::Matrix2D& matrix, 302cdf0e10cSrcweir const char* pStr, 303cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 304cdf0e10cSrcweir ::sal_Int16 nArgPos ) 305cdf0e10cSrcweir { 306cdf0e10cSrcweir (void)pStr; (void)xIf; (void)nArgPos; 307cdf0e10cSrcweir 308cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 309cdf0e10cSrcweir const sal_Int32 nBinaryState( 310cdf0e10cSrcweir 1000 * !::rtl::math::isFinite( matrix.m00 ) + 311cdf0e10cSrcweir 100 * !::rtl::math::isFinite( matrix.m01 ) + 312cdf0e10cSrcweir 10 * !::rtl::math::isFinite( matrix.m10 ) + 313cdf0e10cSrcweir 1 * !::rtl::math::isFinite( matrix.m11 ) ); 314cdf0e10cSrcweir 315cdf0e10cSrcweir if( nBinaryState ) 316cdf0e10cSrcweir { 317cdf0e10cSrcweir throw lang::IllegalArgumentException( 318cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 319cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): Matrix2D contains infinite or NAN value(s) at the following positions (m00-m11): ") + 320cdf0e10cSrcweir ::rtl::OUString::valueOf(nBinaryState), 321cdf0e10cSrcweir xIf, 322cdf0e10cSrcweir nArgPos ); 323cdf0e10cSrcweir } 324cdf0e10cSrcweir #else 325cdf0e10cSrcweir if( !::rtl::math::isFinite( matrix.m00 ) || 326cdf0e10cSrcweir !::rtl::math::isFinite( matrix.m01 ) || 327cdf0e10cSrcweir !::rtl::math::isFinite( matrix.m10 ) || 328cdf0e10cSrcweir !::rtl::math::isFinite( matrix.m11 ) ) 329cdf0e10cSrcweir { 330cdf0e10cSrcweir throw lang::IllegalArgumentException(); 331cdf0e10cSrcweir } 332cdf0e10cSrcweir #endif 333cdf0e10cSrcweir } 334cdf0e10cSrcweir verifyInput(const rendering::ViewState & viewState,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)335cdf0e10cSrcweir void verifyInput( const rendering::ViewState& viewState, 336cdf0e10cSrcweir const char* pStr, 337cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 338cdf0e10cSrcweir ::sal_Int16 nArgPos ) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir verifyInput( viewState.AffineTransform, 341cdf0e10cSrcweir pStr, xIf, nArgPos ); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir verifyInput(const rendering::RenderState & renderState,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos,sal_Int32 nMinColorComponents)344cdf0e10cSrcweir void verifyInput( const rendering::RenderState& renderState, 345cdf0e10cSrcweir const char* pStr, 346cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 347cdf0e10cSrcweir ::sal_Int16 nArgPos, 348cdf0e10cSrcweir sal_Int32 nMinColorComponents ) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir verifyInput( renderState.AffineTransform, 351cdf0e10cSrcweir pStr, xIf, nArgPos ); 352cdf0e10cSrcweir 353cdf0e10cSrcweir if( renderState.DeviceColor.getLength() < nMinColorComponents ) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 356cdf0e10cSrcweir throw lang::IllegalArgumentException( 357cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 358cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): render state's device color has too few components (") + 359cdf0e10cSrcweir ::rtl::OUString::valueOf(nMinColorComponents) + 360cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" expected, ") + 361cdf0e10cSrcweir ::rtl::OUString::valueOf(renderState.DeviceColor.getLength()) + 362cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" provided)"), 363cdf0e10cSrcweir xIf, 364cdf0e10cSrcweir nArgPos ); 365cdf0e10cSrcweir #else 366cdf0e10cSrcweir throw lang::IllegalArgumentException(); 367cdf0e10cSrcweir #endif 368cdf0e10cSrcweir } 369cdf0e10cSrcweir 370cdf0e10cSrcweir if( renderState.CompositeOperation < rendering::CompositeOperation::CLEAR || 371cdf0e10cSrcweir renderState.CompositeOperation > rendering::CompositeOperation::SATURATE ) 372cdf0e10cSrcweir { 373cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 374cdf0e10cSrcweir throw lang::IllegalArgumentException( 375cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 376cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): render state's CompositeOperation value out of range (") + 377cdf0e10cSrcweir ::rtl::OUString::valueOf(sal::static_int_cast<sal_Int32>(renderState.CompositeOperation)) + 378cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" not known)"), 379cdf0e10cSrcweir xIf, 380cdf0e10cSrcweir nArgPos ); 381cdf0e10cSrcweir #else 382cdf0e10cSrcweir throw lang::IllegalArgumentException(); 383cdf0e10cSrcweir #endif 384cdf0e10cSrcweir } 385cdf0e10cSrcweir } 386cdf0e10cSrcweir verifyInput(const rendering::Texture & texture,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)387cdf0e10cSrcweir void verifyInput( const rendering::Texture& texture, 388cdf0e10cSrcweir const char* pStr, 389cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 390cdf0e10cSrcweir ::sal_Int16 nArgPos ) 391cdf0e10cSrcweir { 392cdf0e10cSrcweir verifyInput( texture.AffineTransform, 393cdf0e10cSrcweir pStr, xIf, nArgPos ); 394cdf0e10cSrcweir 395cdf0e10cSrcweir if( !::rtl::math::isFinite( texture.Alpha ) || 396cdf0e10cSrcweir texture.Alpha < 0.0 || 397cdf0e10cSrcweir texture.Alpha > 1.0 ) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 400cdf0e10cSrcweir throw lang::IllegalArgumentException( 401cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 402cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): textures' alpha value out of range (is ") + 403cdf0e10cSrcweir ::rtl::OUString::valueOf(texture.Alpha) + 404cdf0e10cSrcweir ::rtl::OUString::createFromAscii(")"), 405cdf0e10cSrcweir xIf, 406cdf0e10cSrcweir nArgPos ); 407cdf0e10cSrcweir #else 408cdf0e10cSrcweir throw lang::IllegalArgumentException(); 409cdf0e10cSrcweir #endif 410cdf0e10cSrcweir } 411cdf0e10cSrcweir 412cdf0e10cSrcweir if( texture.NumberOfHatchPolygons < 0 ) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 415cdf0e10cSrcweir throw lang::IllegalArgumentException( 416cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 417cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): textures' NumberOfHatchPolygons is negative"), 418cdf0e10cSrcweir xIf, 419cdf0e10cSrcweir nArgPos ); 420cdf0e10cSrcweir #else 421cdf0e10cSrcweir throw lang::IllegalArgumentException(); 422cdf0e10cSrcweir #endif 423cdf0e10cSrcweir } 424cdf0e10cSrcweir 425cdf0e10cSrcweir if( texture.RepeatModeX < rendering::TexturingMode::NONE || 426cdf0e10cSrcweir texture.RepeatModeX > rendering::TexturingMode::REPEAT ) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 429cdf0e10cSrcweir throw lang::IllegalArgumentException( 430cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 431cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): textures' RepeatModeX value is out of range (") + 432cdf0e10cSrcweir ::rtl::OUString::valueOf(sal::static_int_cast<sal_Int32>(texture.RepeatModeX)) + 433cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" not known)"), 434cdf0e10cSrcweir xIf, 435cdf0e10cSrcweir nArgPos ); 436cdf0e10cSrcweir #else 437cdf0e10cSrcweir throw lang::IllegalArgumentException(); 438cdf0e10cSrcweir #endif 439cdf0e10cSrcweir } 440cdf0e10cSrcweir 441cdf0e10cSrcweir if( texture.RepeatModeY < rendering::TexturingMode::NONE || 442cdf0e10cSrcweir texture.RepeatModeY > rendering::TexturingMode::REPEAT ) 443cdf0e10cSrcweir { 444cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 445cdf0e10cSrcweir throw lang::IllegalArgumentException( 446cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 447cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): textures' RepeatModeY value is out of range (") + 448cdf0e10cSrcweir ::rtl::OUString::valueOf(sal::static_int_cast<sal_Int32>(texture.RepeatModeY)) + 449cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" not known)"), 450cdf0e10cSrcweir xIf, 451cdf0e10cSrcweir nArgPos ); 452cdf0e10cSrcweir #else 453cdf0e10cSrcweir throw lang::IllegalArgumentException(); 454cdf0e10cSrcweir #endif 455cdf0e10cSrcweir } 456cdf0e10cSrcweir } 457cdf0e10cSrcweir 458cdf0e10cSrcweir namespace 459cdf0e10cSrcweir { 460cdf0e10cSrcweir struct VerifyDashValue 461cdf0e10cSrcweir { VerifyDashValuecanvas::tools::__anon798306070111::VerifyDashValue462cdf0e10cSrcweir VerifyDashValue( const char* pStr, 463cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 464cdf0e10cSrcweir ::sal_Int16 nArgPos ) : 465cdf0e10cSrcweir mpStr( pStr ), 466cdf0e10cSrcweir mrIf( xIf ), 467cdf0e10cSrcweir mnArgPos( nArgPos ) 468cdf0e10cSrcweir { 469cdf0e10cSrcweir } 470cdf0e10cSrcweir operator ()canvas::tools::__anon798306070111::VerifyDashValue471cdf0e10cSrcweir void operator()( const double& rVal ) 472cdf0e10cSrcweir { 473cdf0e10cSrcweir if( !::rtl::math::isFinite( rVal ) || rVal < 0.0 ) 474cdf0e10cSrcweir { 475cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 476cdf0e10cSrcweir throw lang::IllegalArgumentException( 477cdf0e10cSrcweir ::rtl::OUString::createFromAscii(mpStr) + 478cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): one of stroke attributes' DashArray value out of range (is ") + 479cdf0e10cSrcweir ::rtl::OUString::valueOf(rVal) + 480cdf0e10cSrcweir ::rtl::OUString::createFromAscii(")"), 481cdf0e10cSrcweir mrIf, 482cdf0e10cSrcweir mnArgPos ); 483cdf0e10cSrcweir #else 484cdf0e10cSrcweir throw lang::IllegalArgumentException(); 485cdf0e10cSrcweir #endif 486cdf0e10cSrcweir } 487cdf0e10cSrcweir } 488cdf0e10cSrcweir 489cdf0e10cSrcweir const char* mpStr; 490cdf0e10cSrcweir const uno::Reference< uno::XInterface >& mrIf; 491cdf0e10cSrcweir sal_Int16 mnArgPos; 492cdf0e10cSrcweir }; 493cdf0e10cSrcweir } 494cdf0e10cSrcweir verifyInput(const rendering::StrokeAttributes & strokeAttributes,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)495cdf0e10cSrcweir void verifyInput( const rendering::StrokeAttributes& strokeAttributes, 496cdf0e10cSrcweir const char* pStr, 497cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 498cdf0e10cSrcweir ::sal_Int16 nArgPos ) 499cdf0e10cSrcweir { 500cdf0e10cSrcweir if( !::rtl::math::isFinite( strokeAttributes.StrokeWidth ) || 501cdf0e10cSrcweir strokeAttributes.StrokeWidth < 0.0 ) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 504cdf0e10cSrcweir throw lang::IllegalArgumentException( 505cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 506cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): stroke attributes' StrokeWidth value out of range (is ") + 507cdf0e10cSrcweir ::rtl::OUString::valueOf(strokeAttributes.StrokeWidth) + 508cdf0e10cSrcweir ::rtl::OUString::createFromAscii(")"), 509cdf0e10cSrcweir xIf, 510cdf0e10cSrcweir nArgPos ); 511cdf0e10cSrcweir #else 512cdf0e10cSrcweir throw lang::IllegalArgumentException(); 513cdf0e10cSrcweir #endif 514cdf0e10cSrcweir } 515cdf0e10cSrcweir 516cdf0e10cSrcweir if( !::rtl::math::isFinite( strokeAttributes.MiterLimit ) || 517cdf0e10cSrcweir strokeAttributes.MiterLimit < 0.0 ) 518cdf0e10cSrcweir { 519cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 520cdf0e10cSrcweir throw lang::IllegalArgumentException( 521cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 522cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): stroke attributes' MiterLimit value out of range (is ") + 523cdf0e10cSrcweir ::rtl::OUString::valueOf(strokeAttributes.MiterLimit) + 524cdf0e10cSrcweir ::rtl::OUString::createFromAscii(")"), 525cdf0e10cSrcweir xIf, 526cdf0e10cSrcweir nArgPos ); 527cdf0e10cSrcweir #else 528cdf0e10cSrcweir throw lang::IllegalArgumentException(); 529cdf0e10cSrcweir #endif 530cdf0e10cSrcweir } 531cdf0e10cSrcweir 532cdf0e10cSrcweir ::std::for_each( strokeAttributes.DashArray.getConstArray(), 533cdf0e10cSrcweir strokeAttributes.DashArray.getConstArray() + strokeAttributes.DashArray.getLength(), 534cdf0e10cSrcweir VerifyDashValue( pStr, xIf, nArgPos ) ); 535cdf0e10cSrcweir 536cdf0e10cSrcweir ::std::for_each( strokeAttributes.LineArray.getConstArray(), 537cdf0e10cSrcweir strokeAttributes.LineArray.getConstArray() + strokeAttributes.LineArray.getLength(), 538cdf0e10cSrcweir VerifyDashValue( pStr, xIf, nArgPos ) ); 539cdf0e10cSrcweir 540cdf0e10cSrcweir if( strokeAttributes.StartCapType < rendering::PathCapType::BUTT || 541cdf0e10cSrcweir strokeAttributes.StartCapType > rendering::PathCapType::SQUARE ) 542cdf0e10cSrcweir { 543cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 544cdf0e10cSrcweir throw lang::IllegalArgumentException( 545cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 546cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): stroke attributes' StartCapType value is out of range (") + 547cdf0e10cSrcweir ::rtl::OUString::valueOf(sal::static_int_cast<sal_Int32>(strokeAttributes.StartCapType)) + 548cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" not known)"), 549cdf0e10cSrcweir xIf, 550cdf0e10cSrcweir nArgPos ); 551cdf0e10cSrcweir #else 552cdf0e10cSrcweir throw lang::IllegalArgumentException(); 553cdf0e10cSrcweir #endif 554cdf0e10cSrcweir } 555cdf0e10cSrcweir 556cdf0e10cSrcweir if( strokeAttributes.EndCapType < rendering::PathCapType::BUTT || 557cdf0e10cSrcweir strokeAttributes.EndCapType > rendering::PathCapType::SQUARE ) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 560cdf0e10cSrcweir throw lang::IllegalArgumentException( 561cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 562cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): stroke attributes' StartCapType value is out of range (") + 563cdf0e10cSrcweir ::rtl::OUString::valueOf(sal::static_int_cast<sal_Int32>(strokeAttributes.EndCapType)) + 564cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" not known)"), 565cdf0e10cSrcweir xIf, 566cdf0e10cSrcweir nArgPos ); 567cdf0e10cSrcweir #else 568cdf0e10cSrcweir throw lang::IllegalArgumentException(); 569cdf0e10cSrcweir #endif 570cdf0e10cSrcweir } 571cdf0e10cSrcweir 572cdf0e10cSrcweir if( strokeAttributes.JoinType < rendering::PathJoinType::NONE || 573cdf0e10cSrcweir strokeAttributes.JoinType > rendering::PathJoinType::BEVEL ) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 576cdf0e10cSrcweir throw lang::IllegalArgumentException( 577cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 578cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): stroke attributes' JoinType value is out of range (") + 579cdf0e10cSrcweir ::rtl::OUString::valueOf(sal::static_int_cast<sal_Int32>(strokeAttributes.JoinType)) + 580cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" not known)"), 581cdf0e10cSrcweir xIf, 582cdf0e10cSrcweir nArgPos ); 583cdf0e10cSrcweir #else 584cdf0e10cSrcweir throw lang::IllegalArgumentException(); 585cdf0e10cSrcweir #endif 586cdf0e10cSrcweir } 587cdf0e10cSrcweir } 588cdf0e10cSrcweir verifyInput(const rendering::IntegerBitmapLayout & bitmapLayout,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)589cdf0e10cSrcweir void verifyInput( const rendering::IntegerBitmapLayout& bitmapLayout, 590cdf0e10cSrcweir const char* pStr, 591cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 592cdf0e10cSrcweir ::sal_Int16 nArgPos ) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir (void)pStr; (void)xIf; (void)nArgPos; 595cdf0e10cSrcweir 596cdf0e10cSrcweir if( bitmapLayout.ScanLines < 0 ) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 599cdf0e10cSrcweir throw lang::IllegalArgumentException( 600cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 601cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's ScanLines is negative"), 602cdf0e10cSrcweir xIf, 603cdf0e10cSrcweir nArgPos ); 604cdf0e10cSrcweir #else 605cdf0e10cSrcweir throw lang::IllegalArgumentException(); 606cdf0e10cSrcweir #endif 607cdf0e10cSrcweir } 608cdf0e10cSrcweir 609cdf0e10cSrcweir if( bitmapLayout.ScanLineBytes < 0 ) 610cdf0e10cSrcweir { 611cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 612cdf0e10cSrcweir throw lang::IllegalArgumentException( 613cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 614cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's ScanLineBytes is negative"), 615cdf0e10cSrcweir xIf, 616cdf0e10cSrcweir nArgPos ); 617cdf0e10cSrcweir #else 618cdf0e10cSrcweir throw lang::IllegalArgumentException(); 619cdf0e10cSrcweir #endif 620cdf0e10cSrcweir } 621cdf0e10cSrcweir 622cdf0e10cSrcweir if( !bitmapLayout.ColorSpace.is() ) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 625cdf0e10cSrcweir throw lang::IllegalArgumentException( 626cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 627cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's ColorSpace is invalid"), 628cdf0e10cSrcweir xIf, 629cdf0e10cSrcweir nArgPos ); 630cdf0e10cSrcweir #else 631cdf0e10cSrcweir throw lang::IllegalArgumentException(); 632cdf0e10cSrcweir #endif 633cdf0e10cSrcweir } 634cdf0e10cSrcweir else 635cdf0e10cSrcweir { 636cdf0e10cSrcweir if( bitmapLayout.ColorSpace->getBitsPerPixel() < 0 ) 637cdf0e10cSrcweir { 638cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 639cdf0e10cSrcweir throw lang::IllegalArgumentException( 640cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 641cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's ColorSpace getBitsPerPixel() is negative"), 642cdf0e10cSrcweir xIf, 643cdf0e10cSrcweir nArgPos ); 644cdf0e10cSrcweir #else 645cdf0e10cSrcweir throw lang::IllegalArgumentException(); 646cdf0e10cSrcweir #endif 647cdf0e10cSrcweir } 648cdf0e10cSrcweir 649cdf0e10cSrcweir if( bitmapLayout.ColorSpace->getEndianness() < util::Endianness::LITTLE || 650cdf0e10cSrcweir bitmapLayout.ColorSpace->getEndianness() > util::Endianness::BIG ) 651cdf0e10cSrcweir { 652cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 653cdf0e10cSrcweir throw lang::IllegalArgumentException( 654cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 655cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's ColorSpace getEndianness() value is out of range (") + 656cdf0e10cSrcweir ::rtl::OUString::valueOf(sal::static_int_cast<sal_Int32>(bitmapLayout.ColorSpace->getEndianness())) + 657cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" not known)"), 658cdf0e10cSrcweir xIf, 659cdf0e10cSrcweir nArgPos ); 660cdf0e10cSrcweir #else 661cdf0e10cSrcweir throw lang::IllegalArgumentException(); 662cdf0e10cSrcweir #endif 663cdf0e10cSrcweir } 664cdf0e10cSrcweir } 665cdf0e10cSrcweir } 666cdf0e10cSrcweir verifyInput(const rendering::FloatingPointBitmapLayout & bitmapLayout,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)667cdf0e10cSrcweir void verifyInput( const rendering::FloatingPointBitmapLayout& bitmapLayout, 668cdf0e10cSrcweir const char* pStr, 669cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 670cdf0e10cSrcweir ::sal_Int16 nArgPos ) 671cdf0e10cSrcweir { 672cdf0e10cSrcweir (void)pStr; (void)xIf; (void)nArgPos; 673cdf0e10cSrcweir 674cdf0e10cSrcweir if( bitmapLayout.ScanLines < 0 ) 675cdf0e10cSrcweir { 676cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 677cdf0e10cSrcweir throw lang::IllegalArgumentException( 678cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 679cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's ScanLines is negative"), 680cdf0e10cSrcweir xIf, 681cdf0e10cSrcweir nArgPos ); 682cdf0e10cSrcweir #else 683cdf0e10cSrcweir throw lang::IllegalArgumentException(); 684cdf0e10cSrcweir #endif 685cdf0e10cSrcweir } 686cdf0e10cSrcweir 687cdf0e10cSrcweir if( bitmapLayout.ScanLineBytes < 0 ) 688cdf0e10cSrcweir { 689cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 690cdf0e10cSrcweir throw lang::IllegalArgumentException( 691cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 692cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's ScanLineBytes is negative"), 693cdf0e10cSrcweir xIf, 694cdf0e10cSrcweir nArgPos ); 695cdf0e10cSrcweir #else 696cdf0e10cSrcweir throw lang::IllegalArgumentException(); 697cdf0e10cSrcweir #endif 698cdf0e10cSrcweir } 699cdf0e10cSrcweir 700cdf0e10cSrcweir if( !bitmapLayout.ColorSpace.is() ) 701cdf0e10cSrcweir { 702cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 703cdf0e10cSrcweir throw lang::IllegalArgumentException( 704cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 705cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's ColorSpace is invalid"), 706cdf0e10cSrcweir xIf, 707cdf0e10cSrcweir nArgPos ); 708cdf0e10cSrcweir #else 709cdf0e10cSrcweir throw lang::IllegalArgumentException(); 710cdf0e10cSrcweir #endif 711cdf0e10cSrcweir } 712cdf0e10cSrcweir 713cdf0e10cSrcweir if( bitmapLayout.NumComponents < 0 ) 714cdf0e10cSrcweir { 715cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 716cdf0e10cSrcweir throw lang::IllegalArgumentException( 717cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 718cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's NumComponents is negative"), 719cdf0e10cSrcweir xIf, 720cdf0e10cSrcweir nArgPos ); 721cdf0e10cSrcweir #else 722cdf0e10cSrcweir throw lang::IllegalArgumentException(); 723cdf0e10cSrcweir #endif 724cdf0e10cSrcweir } 725cdf0e10cSrcweir 726cdf0e10cSrcweir if( bitmapLayout.Endianness < util::Endianness::LITTLE || 727cdf0e10cSrcweir bitmapLayout.Endianness > util::Endianness::BIG ) 728cdf0e10cSrcweir { 729cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 730cdf0e10cSrcweir throw lang::IllegalArgumentException( 731cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 732cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's Endianness value is out of range (") + 733cdf0e10cSrcweir ::rtl::OUString::valueOf(sal::static_int_cast<sal_Int32>(bitmapLayout.Endianness)) + 734cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" not known)"), 735cdf0e10cSrcweir xIf, 736cdf0e10cSrcweir nArgPos ); 737cdf0e10cSrcweir #else 738cdf0e10cSrcweir throw lang::IllegalArgumentException(); 739cdf0e10cSrcweir #endif 740cdf0e10cSrcweir } 741cdf0e10cSrcweir 742cdf0e10cSrcweir if( bitmapLayout.Format < rendering::FloatingPointBitmapFormat::HALFFLOAT || 743cdf0e10cSrcweir bitmapLayout.Format > rendering::FloatingPointBitmapFormat::DOUBLE ) 744cdf0e10cSrcweir { 745cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 746cdf0e10cSrcweir throw lang::IllegalArgumentException( 747cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 748cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): bitmap layout's Format value is out of range (") + 749cdf0e10cSrcweir ::rtl::OUString::valueOf(sal::static_int_cast<sal_Int32>(bitmapLayout.Format)) + 750cdf0e10cSrcweir ::rtl::OUString::createFromAscii(" not known)"), 751cdf0e10cSrcweir xIf, 752cdf0e10cSrcweir nArgPos ); 753cdf0e10cSrcweir #else 754cdf0e10cSrcweir throw lang::IllegalArgumentException(); 755cdf0e10cSrcweir #endif 756cdf0e10cSrcweir } 757cdf0e10cSrcweir } 758cdf0e10cSrcweir verifyInput(const rendering::FontInfo &,const char *,const uno::Reference<uno::XInterface> &,::sal_Int16)759cdf0e10cSrcweir void verifyInput( const rendering::FontInfo& /*fontInfo*/, 760cdf0e10cSrcweir const char* /*pStr*/, 761cdf0e10cSrcweir const uno::Reference< uno::XInterface >& /*xIf*/, 762cdf0e10cSrcweir ::sal_Int16 /*nArgPos*/ ) 763cdf0e10cSrcweir { 764cdf0e10cSrcweir // TODO(E3): Implement FontDescription checks, once the 765cdf0e10cSrcweir // Panose stuff is ready. 766cdf0e10cSrcweir } 767cdf0e10cSrcweir verifyInput(const rendering::FontRequest & fontRequest,const char * pStr,const uno::Reference<uno::XInterface> & xIf,::sal_Int16 nArgPos)768cdf0e10cSrcweir void verifyInput( const rendering::FontRequest& fontRequest, 769cdf0e10cSrcweir const char* pStr, 770cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf, 771cdf0e10cSrcweir ::sal_Int16 nArgPos ) 772cdf0e10cSrcweir { 773cdf0e10cSrcweir verifyInput( fontRequest.FontDescription, 774cdf0e10cSrcweir pStr, xIf, nArgPos ); 775cdf0e10cSrcweir 776cdf0e10cSrcweir if( !::rtl::math::isFinite( fontRequest.CellSize ) ) 777cdf0e10cSrcweir { 778cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 779cdf0e10cSrcweir throw lang::IllegalArgumentException( 780cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 781cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): font request's CellSize value contains infinite or NAN"), 782cdf0e10cSrcweir xIf, 783cdf0e10cSrcweir nArgPos ); 784cdf0e10cSrcweir #else 785cdf0e10cSrcweir throw lang::IllegalArgumentException(); 786cdf0e10cSrcweir #endif 787cdf0e10cSrcweir } 788cdf0e10cSrcweir 789cdf0e10cSrcweir if( !::rtl::math::isFinite( fontRequest.ReferenceAdvancement ) ) 790cdf0e10cSrcweir { 791cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 792cdf0e10cSrcweir throw lang::IllegalArgumentException( 793cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 794cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): font request's ReferenceAdvancement value contains infinite or NAN"), 795cdf0e10cSrcweir xIf, 796cdf0e10cSrcweir nArgPos ); 797cdf0e10cSrcweir #else 798cdf0e10cSrcweir throw lang::IllegalArgumentException(); 799cdf0e10cSrcweir #endif 800cdf0e10cSrcweir } 801cdf0e10cSrcweir 802cdf0e10cSrcweir if( fontRequest.CellSize != 0.0 && 803cdf0e10cSrcweir fontRequest.ReferenceAdvancement != 0.0 ) 804cdf0e10cSrcweir { 805cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 806cdf0e10cSrcweir throw lang::IllegalArgumentException( 807cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 808cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyInput(): font request's CellSize and ReferenceAdvancement are mutually exclusive, one of them must be 0.0"), 809cdf0e10cSrcweir xIf, 810cdf0e10cSrcweir nArgPos ); 811cdf0e10cSrcweir #else 812cdf0e10cSrcweir throw lang::IllegalArgumentException(); 813cdf0e10cSrcweir #endif 814cdf0e10cSrcweir } 815cdf0e10cSrcweir } 816cdf0e10cSrcweir verifyIndexRange(const geometry::IntegerRectangle2D & rect,const geometry::IntegerSize2D & size)817cdf0e10cSrcweir void verifyIndexRange( const geometry::IntegerRectangle2D& rect, 818cdf0e10cSrcweir const geometry::IntegerSize2D& size ) 819cdf0e10cSrcweir { 820cdf0e10cSrcweir const ::basegfx::B2IRange aRect( 821cdf0e10cSrcweir ::basegfx::unotools::b2IRectangleFromIntegerRectangle2D( 822cdf0e10cSrcweir rect ) ); 823cdf0e10cSrcweir 824cdf0e10cSrcweir if( aRect.getMinX() < 0 || 825cdf0e10cSrcweir aRect.getMaxX() > size.Width || 826cdf0e10cSrcweir aRect.getMinY() < 0 || 827cdf0e10cSrcweir aRect.getMaxY() > size.Height ) 828cdf0e10cSrcweir { 829cdf0e10cSrcweir throw ::com::sun::star::lang::IndexOutOfBoundsException(); 830cdf0e10cSrcweir } 831cdf0e10cSrcweir } 832cdf0e10cSrcweir verifyIndexRange(const geometry::IntegerPoint2D & pos,const geometry::IntegerSize2D & size)833cdf0e10cSrcweir void verifyIndexRange( const geometry::IntegerPoint2D& pos, 834cdf0e10cSrcweir const geometry::IntegerSize2D& size ) 835cdf0e10cSrcweir { 836cdf0e10cSrcweir if( pos.X < 0 || 837cdf0e10cSrcweir pos.X > size.Width || 838cdf0e10cSrcweir pos.Y < 0 || 839cdf0e10cSrcweir pos.Y > size.Height ) 840cdf0e10cSrcweir { 841cdf0e10cSrcweir throw ::com::sun::star::lang::IndexOutOfBoundsException(); 842cdf0e10cSrcweir } 843cdf0e10cSrcweir } 844cdf0e10cSrcweir verifyBitmapSize(const geometry::IntegerSize2D & size,const char * pStr,const uno::Reference<uno::XInterface> & xIf)845cdf0e10cSrcweir void verifyBitmapSize( const geometry::IntegerSize2D& size, 846cdf0e10cSrcweir const char* pStr, 847cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf ) 848cdf0e10cSrcweir { 849cdf0e10cSrcweir (void)pStr; (void)xIf; 850cdf0e10cSrcweir 851cdf0e10cSrcweir if( size.Width <= 0 ) 852cdf0e10cSrcweir { 853cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 854cdf0e10cSrcweir throw lang::IllegalArgumentException( 855cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 856cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyBitmapSize(): size has 0 or negative width (value: ") + 857cdf0e10cSrcweir ::rtl::OUString::valueOf(size.Width) + 858cdf0e10cSrcweir ::rtl::OUString::createFromAscii(")"), 859cdf0e10cSrcweir xIf, 860cdf0e10cSrcweir 0 ); 861cdf0e10cSrcweir #else 862cdf0e10cSrcweir throw lang::IllegalArgumentException(); 863cdf0e10cSrcweir #endif 864cdf0e10cSrcweir } 865cdf0e10cSrcweir 866cdf0e10cSrcweir if( size.Height <= 0 ) 867cdf0e10cSrcweir { 868cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 869cdf0e10cSrcweir throw lang::IllegalArgumentException( 870cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 871cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifyBitmapSize(): size has 0 or negative height (value: ") + 872cdf0e10cSrcweir ::rtl::OUString::valueOf(size.Height) + 873cdf0e10cSrcweir ::rtl::OUString::createFromAscii(")"), 874cdf0e10cSrcweir xIf, 875cdf0e10cSrcweir 0 ); 876cdf0e10cSrcweir #else 877cdf0e10cSrcweir throw lang::IllegalArgumentException(); 878cdf0e10cSrcweir #endif 879cdf0e10cSrcweir } 880cdf0e10cSrcweir } 881cdf0e10cSrcweir verifySpriteSize(const geometry::RealSize2D & size,const char * pStr,const uno::Reference<uno::XInterface> & xIf)882cdf0e10cSrcweir void verifySpriteSize( const geometry::RealSize2D& size, 883cdf0e10cSrcweir const char* pStr, 884cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xIf ) 885cdf0e10cSrcweir { 886cdf0e10cSrcweir (void)pStr; (void)xIf; 887cdf0e10cSrcweir 888cdf0e10cSrcweir if( size.Width <= 0.0 ) 889cdf0e10cSrcweir { 890cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 891cdf0e10cSrcweir throw lang::IllegalArgumentException( 892cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 893cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifySpriteSize(): size has 0 or negative width (value: ") + 894cdf0e10cSrcweir ::rtl::OUString::valueOf(size.Width) + 895cdf0e10cSrcweir ::rtl::OUString::createFromAscii(")"), 896cdf0e10cSrcweir xIf, 897cdf0e10cSrcweir 0 ); 898cdf0e10cSrcweir #else 899cdf0e10cSrcweir throw lang::IllegalArgumentException(); 900cdf0e10cSrcweir #endif 901cdf0e10cSrcweir } 902cdf0e10cSrcweir 903cdf0e10cSrcweir if( size.Height <= 0.0 ) 904cdf0e10cSrcweir { 905cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 906cdf0e10cSrcweir throw lang::IllegalArgumentException( 907cdf0e10cSrcweir ::rtl::OUString::createFromAscii(pStr) + 908cdf0e10cSrcweir ::rtl::OUString::createFromAscii(": verifySpriteSize(): size has 0 or negative height (value: ") + 909cdf0e10cSrcweir ::rtl::OUString::valueOf(size.Height) + 910cdf0e10cSrcweir ::rtl::OUString::createFromAscii(")"), 911cdf0e10cSrcweir xIf, 912cdf0e10cSrcweir 0 ); 913cdf0e10cSrcweir #else 914cdf0e10cSrcweir throw lang::IllegalArgumentException(); 915cdf0e10cSrcweir #endif 916cdf0e10cSrcweir } 917cdf0e10cSrcweir } 918cdf0e10cSrcweir 919cdf0e10cSrcweir 920cdf0e10cSrcweir } // namespace tools 921cdf0e10cSrcweir 922cdf0e10cSrcweir } // namespace canvas 923