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/. */
7 #ifndef MOZILLA_GFX_SOURCESURFACEDUAL_H_
8 #define MOZILLA_GFX_SOURCESURFACEDUAL_H_
18 class SourceSurfaceDual
: public SourceSurface
{
20 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceDual
, override
)
22 SourceSurfaceDual(DrawTarget
* aDTA
, DrawTarget
* aDTB
)
23 : mA(aDTA
->Snapshot()), mB(aDTB
->Snapshot()) {}
25 SourceSurfaceDual(SourceSurface
* aSourceA
, SourceSurface
* aSourceB
)
26 : mA(aSourceA
), mB(aSourceB
) {}
28 virtual SurfaceType
GetType() const override
{ return SurfaceType::DUAL_DT
; }
29 virtual IntSize
GetSize() const override
{ return mA
->GetSize(); }
30 virtual SurfaceFormat
GetFormat() const override
{ return mA
->GetFormat(); }
32 // TODO: This is probably wrong as this was originally only
33 // used for debugging purposes, but now has legacy relying on
34 // giving the first type only.
35 virtual already_AddRefed
<DataSourceSurface
> GetDataSurface() override
{
36 return mA
->GetDataSurface();
39 SourceSurface
* GetFirstSurface() {
40 MOZ_ASSERT(mA
->GetType() == mB
->GetType());
44 bool SameSurfaceTypes() { return mA
->GetType() == mB
->GetType(); }
47 friend class DualSurface
;
48 friend class DualPattern
;
50 RefPtr
<SourceSurface
> mA
;
51 RefPtr
<SourceSurface
> mB
;
55 } // namespace mozilla
57 #endif /* MOZILLA_GFX_SOURCESURFACEDUAL_H_ */