/src/mozilla-central/gfx/2d/SourceSurfaceDual.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef MOZILLA_GFX_SOURCESURFACEDUAL_H_ |
8 | | #define MOZILLA_GFX_SOURCESURFACEDUAL_H_ |
9 | | |
10 | | #include "2D.h" |
11 | | |
12 | | namespace mozilla { |
13 | | namespace gfx { |
14 | | |
15 | | class DualSurface; |
16 | | class DualPattern; |
17 | | |
18 | | class SourceSurfaceDual : public SourceSurface |
19 | | { |
20 | | public: |
21 | | MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceDual, override) |
22 | | |
23 | | SourceSurfaceDual(DrawTarget *aDTA, DrawTarget *aDTB) |
24 | | : mA(aDTA->Snapshot()) |
25 | | , mB(aDTB->Snapshot()) |
26 | 0 | { } |
27 | | |
28 | | SourceSurfaceDual(SourceSurface *aSourceA, SourceSurface *aSourceB) |
29 | | : mA(aSourceA) |
30 | | , mB(aSourceB) |
31 | 0 | { } |
32 | | |
33 | 0 | virtual SurfaceType GetType() const override { return SurfaceType::DUAL_DT; } |
34 | 0 | virtual IntSize GetSize() const override { return mA->GetSize(); } |
35 | 0 | virtual SurfaceFormat GetFormat() const override { return mA->GetFormat(); } |
36 | | |
37 | | // TODO: This is probably wrong as this was originally only |
38 | | // used for debugging purposes, but now has legacy relying on |
39 | | // giving the first type only. |
40 | 0 | virtual already_AddRefed<DataSourceSurface> GetDataSurface() override { |
41 | 0 | return mA->GetDataSurface(); |
42 | 0 | } |
43 | | |
44 | 0 | SourceSurface* GetFirstSurface() { |
45 | 0 | MOZ_ASSERT(mA->GetType() == mB->GetType()); |
46 | 0 | return mA; |
47 | 0 | } |
48 | | |
49 | 0 | bool SameSurfaceTypes() { |
50 | 0 | return mA->GetType() == mB->GetType(); |
51 | 0 | } |
52 | | |
53 | | private: |
54 | | friend class DualSurface; |
55 | | friend class DualPattern; |
56 | | |
57 | | RefPtr<SourceSurface> mA; |
58 | | RefPtr<SourceSurface> mB; |
59 | | }; |
60 | | |
61 | | } // namespace gfx |
62 | | } // namespace mozilla |
63 | | |
64 | | #endif /* MOZILLA_GFX_SOURCESURFACEDUAL_H_ */ |