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
|
2013-09-25 00:45:14 +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/. */
|
|
|
|
|
|
|
|
#ifndef GFX_AUTOMASKDATA_H_
|
|
|
|
#define GFX_AUTOMASKDATA_H_
|
|
|
|
|
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Drawing with a mask requires a mask surface and a transform.
|
|
|
|
*
|
2014-04-16 04:41:40 +04:00
|
|
|
* This helper class manages the SourceSurface logic.
|
2013-09-25 00:45:14 +04:00
|
|
|
*/
|
2014-04-01 08:02:09 +04:00
|
|
|
class MOZ_STACK_CLASS AutoMoz2DMaskData {
|
|
|
|
public:
|
|
|
|
AutoMoz2DMaskData() { }
|
|
|
|
~AutoMoz2DMaskData() { }
|
|
|
|
|
|
|
|
void Construct(const gfx::Matrix& aTransform,
|
|
|
|
gfx::SourceSurface* aSurface)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!IsConstructed());
|
|
|
|
mTransform = aTransform;
|
|
|
|
mSurface = aSurface;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::SourceSurface* GetSurface()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsConstructed());
|
|
|
|
return mSurface.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
const gfx::Matrix& GetTransform()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsConstructed());
|
|
|
|
return mTransform;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool IsConstructed()
|
|
|
|
{
|
|
|
|
return !!mSurface;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::Matrix mTransform;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<gfx::SourceSurface> mSurface;
|
2014-04-01 08:02:09 +04:00
|
|
|
|
2015-01-07 02:35:02 +03:00
|
|
|
AutoMoz2DMaskData(const AutoMoz2DMaskData&) = delete;
|
|
|
|
AutoMoz2DMaskData& operator=(const AutoMoz2DMaskData&) = delete;
|
2014-04-01 08:02:09 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2013-09-25 00:45:14 +04:00
|
|
|
|
2014-01-28 00:25:21 +04:00
|
|
|
#endif // GFX_AUTOMASKDATA_H_
|