2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-04-04 00:25:52 +04:00
|
|
|
#ifndef MOZILLA_GFX_SOURCESURFACEDUAL_H_
|
|
|
|
#define MOZILLA_GFX_SOURCESURFACEDUAL_H_
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-04-04 00:25:52 +04:00
|
|
|
#include "2D.h"
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-04-04 00:25:52 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
class DualSurface;
|
|
|
|
class DualPattern;
|
|
|
|
|
|
|
|
class SourceSurfaceDual : public SourceSurface {
|
|
|
|
public:
|
2017-11-06 06:37:28 +03:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceDual, override)
|
|
|
|
|
2012-04-04 00:25:52 +04:00
|
|
|
SourceSurfaceDual(DrawTarget* aDTA, DrawTarget* aDTB)
|
|
|
|
: mA(aDTA->Snapshot()), mB(aDTB->Snapshot()) {}
|
|
|
|
|
2018-08-01 20:49:19 +03:00
|
|
|
SourceSurfaceDual(SourceSurface* aSourceA, SourceSurface* aSourceB)
|
|
|
|
: mA(aSourceA), mB(aSourceB) {}
|
|
|
|
|
2017-11-06 06:37:28 +03:00
|
|
|
virtual SurfaceType GetType() const override { return SurfaceType::DUAL_DT; }
|
|
|
|
virtual IntSize GetSize() const override { return mA->GetSize(); }
|
|
|
|
virtual SurfaceFormat GetFormat() const override { return mA->GetFormat(); }
|
2012-04-04 00:25:52 +04:00
|
|
|
|
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.
|
2017-11-06 06:37:28 +03:00
|
|
|
virtual already_AddRefed<DataSourceSurface> GetDataSurface() override {
|
2015-09-26 02:24:13 +03:00
|
|
|
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_ */
|