/src/libreoffice/drawinglayer/source/primitive2d/bitmapprimitive2d.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 <drawinglayer/primitive2d/bitmapprimitive2d.hxx> |
21 | | #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> |
22 | | #include <utility> |
23 | | |
24 | | using namespace com::sun::star; |
25 | | |
26 | | namespace drawinglayer::primitive2d |
27 | | { |
28 | | BitmapPrimitive2D::BitmapPrimitive2D(Bitmap xXBitmap, basegfx::B2DHomMatrix aTransform) |
29 | 0 | : maBitmap(std::move(xXBitmap)) |
30 | 0 | , maTransform(std::move(aTransform)) |
31 | 0 | { |
32 | 0 | } |
33 | | |
34 | | bool BitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |
35 | 0 | { |
36 | 0 | if (BasePrimitive2D::operator==(rPrimitive)) |
37 | 0 | { |
38 | 0 | const BitmapPrimitive2D& rCompare = static_cast<const BitmapPrimitive2D&>(rPrimitive); |
39 | |
|
40 | 0 | return (getBitmap() == rCompare.getBitmap() && getTransform() == rCompare.getTransform()); |
41 | 0 | } |
42 | | |
43 | 0 | return false; |
44 | 0 | } |
45 | | |
46 | | basegfx::B2DRange |
47 | | BitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const |
48 | 0 | { |
49 | 0 | basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0); |
50 | 0 | aRetval.transform(maTransform); |
51 | 0 | return aRetval; |
52 | 0 | } |
53 | | |
54 | | sal_Int64 BitmapPrimitive2D::estimateUsage() |
55 | 0 | { |
56 | 0 | if (getBitmap().IsEmpty()) |
57 | 0 | { |
58 | 0 | return 0; |
59 | 0 | } |
60 | 0 | return getBitmap().GetSizeBytes(); |
61 | 0 | } |
62 | | |
63 | | // provide unique ID |
64 | 0 | sal_uInt32 BitmapPrimitive2D::getPrimitive2DID() const { return PRIMITIVE2D_ID_BITMAPPRIMITIVE2D; } |
65 | | |
66 | | } // end of namespace |
67 | | |
68 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |