/* -*- 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 . */ #include #include #include #include #include "randomwipe.hxx" #include "tools.hxx" namespace slideshow { namespace internal { RandomWipe::RandomWipe( sal_Int32 nElements, bool randomBars ) : m_positions( new ::basegfx::B2DPoint[ nElements ] ), m_nElements( nElements ), m_rect( createUnitRect() ) { ::basegfx::B2DHomMatrix aTransform; if (randomBars) { double edge = (1.0 / nElements); for ( sal_Int32 pos = nElements; pos--; ) m_positions[ pos ].setY( ::basegfx::pruneScaleValue( pos * edge ) ); aTransform.scale( 1.0, ::basegfx::pruneScaleValue(edge) ); } else // dissolve effect { sal_Int32 sqrtElements = static_cast( sqrt( static_cast(nElements) ) ); double edge = (1.0 / sqrtElements); for ( sal_Int32 pos = nElements; pos--; ) { m_positions[ pos ] = ::basegfx::B2DPoint( ::basegfx::pruneScaleValue( (pos % sqrtElements) * edge ), ::basegfx::pruneScaleValue( (pos / sqrtElements) * edge ) ); } const double pedge = ::basegfx::pruneScaleValue(edge); aTransform.scale( pedge, pedge ); } m_rect.transform( aTransform ); // mix up: for ( sal_Int32 pos1 = nElements ; pos1-- ; ) { const sal_Int32 pos2 = getRandomOrdinal(pos1+1); ::std::swap(m_positions[ pos1], m_positions[ pos2 ]); } } ::basegfx::B2DPolyPolygon RandomWipe::operator () ( double t ) { ::basegfx::B2DPolyPolygon res; for ( sal_Int32 pos = static_cast(t * m_nElements); pos--; ) { ::basegfx::B2DPoint const & point = m_positions[ pos ]; ::basegfx::B2DPolygon poly( m_rect ); poly.transform(basegfx::tools::createTranslateB2DHomMatrix(point.getX(), point.getY())); res.append( poly ); } return res; } } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ n> LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2019-11-06loplugin:indentation find broken if statementsNoel Grandin
2019-10-16loplugin:bufferadd loosen some constraintsNoel Grandin
2019-10-02loplugin:stringadd in vclNoel Grandin
2019-09-19improve and enable loplugin:fragiledestructorNoel Grandin
2019-09-16tdf#42949 Fix IWYU warnings in vcl/unx/generic/*Gabor Kelemen
2019-06-13tdf#42949 Fix IWYU warnings in vcl/inc/*Gabor Kelemen
2019-04-30improve loplugin:stringconstantNoel Grandin
2019-04-19optimise find/insert patternNoel Grandin
2019-02-22loplugin:unusedfields in vclNoel Grandin
2019-01-24vcl: unx: apply configuration to "Generic Printer" so it's PDF ...Michael Stahl
2019-01-13Simplify and use getToken index when possible/neededMatteo Casalin
2018-10-19clang-tidy readability-container-size-emptyNoel Grandin
2018-10-14Simplify containers iterations in vclArkadiy Illarionov
2018-09-28loplugin:unusedfieldsNoel Grandin
2018-09-27loplugin:methodcycles more graph theory for the winNoel Grandin
2018-09-14loplugin:constfields in vclNoel Grandin
2018-09-12loplugin:simplifyconstruct in ucbhelper..vclNoel Grandin
2018-09-05loplugin:useuniqueptr in PrinterInfoManagerNoel Grandin
2018-07-31Add missing sal/log.hxx headersGabor Kelemen
2018-06-05tdf#42949 remove unused compheler includes ..Jochen Nitschke
2018-01-31Modernize a bit vcl (part5)Julien Nabet
2017-12-04new loplugin salcall: remove unnecessary SAL_CALLNoel Grandin
2017-10-23loplugin:includeform: vclStephan Bergmann
2017-10-23overload std::hash for OUString and OStringNoel Grandin
2017-10-22Fix wrong use of emplace/emplace_backJulien Nabet
2017-10-20Replace list by unordered_set for m_aAlternateFiles (vcl)Julien Nabet
2017-09-14clang-tidy modernize-use-emplace in vclNoel Grandin
2017-09-12WIP: Implement Basic Common Printing BackendYash Srivastav
2017-09-02Replace lists by vectors printer part (vcl)Julien Nabet
2017-07-06use OString::operator== in preference to ::equalsNoel Grandin
2017-05-29remove some unnecessary OString constructor callsNoel Grandin
2017-05-08cleanup tools/debug.hxx includesJochen Nitschke