fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / slideshow / source / engine / animationnodes / animationcolornode.cxx
blobc1b47d86ec24be22e0dcd38c35151339bda71c8e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 // must be first
22 #include <canvas/debug.hxx>
23 #include <canvas/verbosetrace.hxx>
24 #include <com/sun/star/animations/AnimationColorSpace.hpp>
26 #include "coloranimation.hxx"
27 #include "hslcoloranimation.hxx"
28 #include "animationcolornode.hxx"
29 #include "animationfactory.hxx"
30 #include "activitiesfactory.hxx"
32 using namespace com::sun::star;
34 namespace slideshow {
35 namespace internal {
37 namespace {
38 /** Little wrapper for HSL to RGB mapping.
40 This class implements the HSLColorAnimation interface,
41 internally converting to RGB and forwarding to
42 ColorAnimation.
44 class HSLWrapper : public HSLColorAnimation
46 public:
47 HSLWrapper( const ColorAnimationSharedPtr& rAnimation )
48 : mpAnimation( rAnimation )
50 ENSURE_OR_THROW(
51 mpAnimation,
52 "HSLWrapper::HSLWrapper(): Invalid color animation delegate" );
55 virtual void prefetch( const AnimatableShapeSharedPtr&,
56 const ShapeAttributeLayerSharedPtr& ) SAL_OVERRIDE
59 virtual void start( const AnimatableShapeSharedPtr& rShape,
60 const ShapeAttributeLayerSharedPtr& rAttrLayer ) SAL_OVERRIDE
62 mpAnimation->start( rShape, rAttrLayer );
65 virtual void end() SAL_OVERRIDE
67 mpAnimation->end();
70 virtual bool operator()( const HSLColor& rColor ) SAL_OVERRIDE
72 return (*mpAnimation)( RGBColor( rColor ) );
75 virtual HSLColor getUnderlyingValue() const SAL_OVERRIDE
77 return HSLColor( mpAnimation->getUnderlyingValue() );
80 private:
81 ColorAnimationSharedPtr mpAnimation;
84 } // anon namespace
86 AnimationActivitySharedPtr AnimationColorNode::createActivity() const
88 ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
90 switch( mxColorNode->getColorInterpolation() )
92 case animations::AnimationColorSpace::RGB:
93 return ActivitiesFactory::createAnimateActivity(
94 aParms,
95 AnimationFactory::createColorPropertyAnimation(
96 mxColorNode->getAttributeName(),
97 getShape(),
98 getContext().mpSubsettableShapeManager,
99 getSlideSize() ),
100 getXAnimateNode() );
102 case animations::AnimationColorSpace::HSL:
103 // Wrap a plain ColorAnimation with the HSL
104 // wrapper, which implements the HSLColorAnimation
105 // interface, and internally converts HSL to RGB color
106 return ActivitiesFactory::createAnimateActivity(
107 aParms,
108 HSLColorAnimationSharedPtr(
109 new HSLWrapper(
110 AnimationFactory::createColorPropertyAnimation(
111 mxColorNode->getAttributeName(),
112 getShape(),
113 getContext().mpSubsettableShapeManager,
114 getSlideSize() ))),
115 mxColorNode );
117 default:
118 ENSURE_OR_THROW( false, "AnimationColorNode::createColorActivity(): "
119 "Unexpected color space" );
122 return AnimationActivitySharedPtr();
125 } // namespace internal
126 } // namespace slideshow
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */