|
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef MOZILLA_GFX_SOURCESURFACEDUAL_H_ |
|
7 #define MOZILLA_GFX_SOURCESURFACEDUAL_H_ |
|
8 |
|
9 #include "2D.h" |
|
10 |
|
11 namespace mozilla { |
|
12 namespace gfx { |
|
13 |
|
14 class DualSurface; |
|
15 class DualPattern; |
|
16 |
|
17 class SourceSurfaceDual : public SourceSurface |
|
18 { |
|
19 public: |
|
20 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceDual) |
|
21 SourceSurfaceDual(DrawTarget *aDTA, DrawTarget *aDTB) |
|
22 : mA(aDTA->Snapshot()) |
|
23 , mB(aDTB->Snapshot()) |
|
24 { } |
|
25 |
|
26 virtual SurfaceType GetType() const { return SurfaceType::DUAL_DT; } |
|
27 virtual IntSize GetSize() const { return mA->GetSize(); } |
|
28 virtual SurfaceFormat GetFormat() const { return mA->GetFormat(); } |
|
29 |
|
30 /* Readback from this surface type is not supported! */ |
|
31 virtual TemporaryRef<DataSourceSurface> GetDataSurface() { return nullptr; } |
|
32 private: |
|
33 friend class DualSurface; |
|
34 friend class DualPattern; |
|
35 |
|
36 RefPtr<SourceSurface> mA; |
|
37 RefPtr<SourceSurface> mB; |
|
38 }; |
|
39 |
|
40 } |
|
41 } |
|
42 |
|
43 #endif /* MOZILLA_GFX_SOURCESURFACEDUAL_H_ */ |