/src/libreoffice/canvas/source/vcl/cachedbitmap.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include <sal/config.h> |
21 | | |
22 | | #include <com/sun/star/rendering/XCanvas.hpp> |
23 | | #include <com/sun/star/rendering/RepaintResult.hpp> |
24 | | #include <utility> |
25 | | #include <comphelper/diagnose_ex.hxx> |
26 | | |
27 | | #include "cachedbitmap.hxx" |
28 | | #include "repainttarget.hxx" |
29 | | |
30 | | |
31 | | using namespace ::com::sun::star; |
32 | | |
33 | | namespace vclcanvas |
34 | | { |
35 | | CachedBitmap::CachedBitmap( GraphicObjectSharedPtr xGraphicObject, |
36 | | const ::Point& rPoint, |
37 | | const ::Size& rSize, |
38 | | const GraphicAttr& rAttr, |
39 | | const rendering::ViewState& rUsedViewState, |
40 | | rendering::RenderState aUsedRenderState, |
41 | | const uno::Reference< rendering::XCanvas >& rTarget ) : |
42 | 0 | CachedPrimitiveBase( rUsedViewState, rTarget ), |
43 | 0 | mpGraphicObject(std::move( xGraphicObject )), |
44 | 0 | maRenderState(std::move(aUsedRenderState)), |
45 | 0 | maPoint( rPoint ), |
46 | 0 | maSize( rSize ), |
47 | 0 | maAttributes( rAttr ) |
48 | 0 | { |
49 | 0 | } Unexecuted instantiation: vclcanvas::CachedBitmap::CachedBitmap(std::__1::shared_ptr<GraphicObject>, Point const&, Size const&, GraphicAttr const&, com::sun::star::rendering::ViewState const&, com::sun::star::rendering::RenderState, com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> const&) Unexecuted instantiation: vclcanvas::CachedBitmap::CachedBitmap(std::__1::shared_ptr<GraphicObject>, Point const&, Size const&, GraphicAttr const&, com::sun::star::rendering::ViewState const&, com::sun::star::rendering::RenderState, com::sun::star::uno::Reference<com::sun::star::rendering::XCanvas> const&) |
50 | | |
51 | | void CachedBitmap::disposing(std::unique_lock<std::mutex>& rGuard) |
52 | 0 | { |
53 | 0 | mpGraphicObject.reset(); |
54 | |
|
55 | 0 | CachedPrimitiveBase::disposing(rGuard); |
56 | 0 | } |
57 | | |
58 | | ::sal_Int8 CachedBitmap::doRedraw( const rendering::ViewState& rNewState, |
59 | | const rendering::ViewState& rOldState, |
60 | | const uno::Reference< rendering::XCanvas >& rTargetCanvas, |
61 | | bool bSameViewTransform ) |
62 | 0 | { |
63 | 0 | ENSURE_OR_THROW( bSameViewTransform, |
64 | 0 | "CachedBitmap::doRedraw(): base called with changed view transform " |
65 | 0 | "(told otherwise during construction)" ); |
66 | | |
67 | | // TODO(P1): Could adapt to modified clips as well |
68 | 0 | if( rNewState.Clip != rOldState.Clip ) |
69 | 0 | return rendering::RepaintResult::FAILED; |
70 | | |
71 | 0 | RepaintTarget* pTarget = dynamic_cast< RepaintTarget* >(rTargetCanvas.get()); |
72 | |
|
73 | 0 | ENSURE_OR_THROW( pTarget, |
74 | 0 | "CachedBitmap::redraw(): cannot cast target to RepaintTarget" ); |
75 | |
|
76 | 0 | if( !pTarget->repaint( mpGraphicObject, |
77 | 0 | rNewState, |
78 | 0 | maRenderState, |
79 | 0 | maPoint, |
80 | 0 | maSize, |
81 | 0 | maAttributes ) ) |
82 | 0 | { |
83 | | // target failed to repaint |
84 | 0 | return rendering::RepaintResult::FAILED; |
85 | 0 | } |
86 | | |
87 | 0 | return rendering::RepaintResult::REDRAWN; |
88 | 0 | } |
89 | | } |
90 | | |
91 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |