2012-04-04 00:25:52 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2012-04-04 00:25:52 +04:00
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_SOURCESURFACEDUAL_H_
|
|
|
|
#define MOZILLA_GFX_SOURCESURFACEDUAL_H_
|
|
|
|
|
|
|
|
#include "2D.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
class DualSurface;
|
|
|
|
class DualPattern;
|
|
|
|
|
|
|
|
class SourceSurfaceDual : public SourceSurface
|
|
|
|
{
|
|
|
|
public:
|
2014-02-24 17:23:37 +04:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceDual)
|
2012-04-04 00:25:52 +04:00
|
|
|
SourceSurfaceDual(DrawTarget *aDTA, DrawTarget *aDTB)
|
|
|
|
: mA(aDTA->Snapshot())
|
|
|
|
, mB(aDTB->Snapshot())
|
|
|
|
{ }
|
|
|
|
|
2014-01-10 22:55:24 +04:00
|
|
|
virtual SurfaceType GetType() const { return SurfaceType::DUAL_DT; }
|
2012-04-04 00:25:52 +04:00
|
|
|
virtual IntSize GetSize() const { return mA->GetSize(); }
|
|
|
|
virtual SurfaceFormat GetFormat() const { return mA->GetFormat(); }
|
|
|
|
|
2017-04-17 18:41:42 +03:00
|
|
|
// TODO: This is probably wrong as this was originally only
|
|
|
|
// used for debugging purposes, but now has legacy relying on
|
|
|
|
// giving the first type only.
|
2015-09-26 02:24:13 +03:00
|
|
|
virtual already_AddRefed<DataSourceSurface> GetDataSurface() {
|
|
|
|
return mA->GetDataSurface();
|
|
|
|
}
|
2017-04-17 18:41:42 +03:00
|
|
|
|
|
|
|
SourceSurface* GetFirstSurface() {
|
|
|
|
MOZ_ASSERT(mA->GetType() == mB->GetType());
|
|
|
|
return mA;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SameSurfaceTypes() {
|
|
|
|
return mA->GetType() == mB->GetType();
|
|
|
|
}
|
|
|
|
|
2012-04-04 00:25:52 +04:00
|
|
|
private:
|
|
|
|
friend class DualSurface;
|
|
|
|
friend class DualPattern;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<SourceSurface> mA;
|
|
|
|
RefPtr<SourceSurface> mB;
|
2012-04-04 00:25:52 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
2012-04-04 00:25:52 +04:00
|
|
|
|
|
|
|
#endif /* MOZILLA_GFX_SOURCESURFACEDUAL_H_ */
|