Line data Source code
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 0 : class SourceSurfaceDual : public SourceSurface
18 : {
19 : public:
20 0 : MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceDual)
21 0 : SourceSurfaceDual(DrawTarget *aDTA, DrawTarget *aDTB)
22 0 : : mA(aDTA->Snapshot())
23 0 : , mB(aDTB->Snapshot())
24 0 : { }
25 :
26 0 : virtual SurfaceType GetType() const { return SurfaceType::DUAL_DT; }
27 0 : virtual IntSize GetSize() const { return mA->GetSize(); }
28 0 : virtual SurfaceFormat GetFormat() const { return mA->GetFormat(); }
29 :
30 : // TODO: This is probably wrong as this was originally only
31 : // used for debugging purposes, but now has legacy relying on
32 : // giving the first type only.
33 0 : virtual already_AddRefed<DataSourceSurface> GetDataSurface() {
34 0 : return mA->GetDataSurface();
35 : }
36 :
37 : SourceSurface* GetFirstSurface() {
38 : MOZ_ASSERT(mA->GetType() == mB->GetType());
39 : return mA;
40 : }
41 :
42 : bool SameSurfaceTypes() {
43 : return mA->GetType() == mB->GetType();
44 : }
45 :
46 : private:
47 : friend class DualSurface;
48 : friend class DualPattern;
49 :
50 : RefPtr<SourceSurface> mA;
51 : RefPtr<SourceSurface> mB;
52 : };
53 :
54 : } // namespace gfx
55 : } // namespace mozilla
56 :
57 : #endif /* MOZILLA_GFX_SOURCESURFACEDUAL_H_ */
|