2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-10-08 10:00:18 +01:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2005-11-02 11:51:46 +00:00
|
|
|
|
2015-08-10 14:04:31 -05:00
|
|
|
#include <sal/config.h>
|
2006-09-17 02:24:53 +00:00
|
|
|
|
2015-08-10 14:04:31 -05:00
|
|
|
#include <basegfx/matrix/b2dhommatrix.hxx>
|
2017-09-22 14:12:07 +03:00
|
|
|
#include <basegfx/utils/canvastools.hxx>
|
2005-11-02 11:51:46 +00:00
|
|
|
#include <com/sun/star/rendering/RepaintResult.hpp>
|
2014-01-14 13:05:02 -02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2005-11-02 11:51:46 +00:00
|
|
|
|
2020-02-10 11:37:26 +02:00
|
|
|
#include <base/cachedprimitivebase.hxx>
|
2022-05-21 17:59:07 +02:00
|
|
|
#include <utility>
|
2015-08-10 14:04:31 -05:00
|
|
|
|
2005-11-02 11:51:46 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
namespace canvas
|
|
|
|
{
|
2022-05-21 17:59:07 +02:00
|
|
|
CachedPrimitiveBase::CachedPrimitiveBase( rendering::ViewState aUsedViewState,
|
|
|
|
uno::Reference< rendering::XCanvas > xTarget ) :
|
|
|
|
maUsedViewState(std::move( aUsedViewState )),
|
|
|
|
mxTarget(std::move( xTarget ))
|
2005-11-02 11:51:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CachedPrimitiveBase::~CachedPrimitiveBase()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-02-21 15:49:49 +02:00
|
|
|
void CachedPrimitiveBase::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
|
2005-11-02 11:51:46 +00:00
|
|
|
{
|
|
|
|
maUsedViewState.Clip.clear();
|
|
|
|
mxTarget.clear();
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int8 SAL_CALL CachedPrimitiveBase::redraw( const rendering::ViewState& aState )
|
2005-11-02 11:51:46 +00:00
|
|
|
{
|
|
|
|
::basegfx::B2DHomMatrix aUsedTransformation;
|
|
|
|
::basegfx::B2DHomMatrix aNewTransformation;
|
|
|
|
|
|
|
|
::basegfx::unotools::homMatrixFromAffineMatrix( aUsedTransformation,
|
|
|
|
maUsedViewState.AffineTransform );
|
|
|
|
::basegfx::unotools::homMatrixFromAffineMatrix( aNewTransformation,
|
|
|
|
aState.AffineTransform );
|
|
|
|
|
|
|
|
const bool bSameViewTransforms( aUsedTransformation == aNewTransformation );
|
|
|
|
|
2016-09-12 13:10:16 +02:00
|
|
|
if( !bSameViewTransforms )
|
2005-11-02 11:51:46 +00:00
|
|
|
{
|
|
|
|
// differing transformations, don't try to draft the
|
|
|
|
// output, just plain fail here.
|
|
|
|
return rendering::RepaintResult::FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return doRedraw( aState,
|
|
|
|
maUsedViewState,
|
|
|
|
mxTarget,
|
|
|
|
bSameViewTransforms );
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL CachedPrimitiveBase::getImplementationName( )
|
2005-11-02 11:51:46 +00:00
|
|
|
{
|
2019-07-30 17:58:11 +02:00
|
|
|
return "canvas::CachedPrimitiveBase";
|
2005-11-02 11:51:46 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL CachedPrimitiveBase::supportsService( const OUString& ServiceName )
|
2005-11-02 11:51:46 +00:00
|
|
|
{
|
2014-01-14 13:05:02 -02:00
|
|
|
return cppu::supportsService(this, ServiceName);
|
2005-11-02 11:51:46 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
uno::Sequence< OUString > SAL_CALL CachedPrimitiveBase::getSupportedServiceNames( )
|
2005-11-02 11:51:46 +00:00
|
|
|
{
|
2016-08-01 15:00:00 +03:00
|
|
|
return { "com.sun.star.rendering.CachedBitmap" };
|
2005-11-02 11:51:46 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|