diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /gfx/layers/basic/AutoMaskData.h | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/layers/basic/AutoMaskData.h')
-rw-r--r-- | gfx/layers/basic/AutoMaskData.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gfx/layers/basic/AutoMaskData.h b/gfx/layers/basic/AutoMaskData.h new file mode 100644 index 000000000..7bf7f9b3c --- /dev/null +++ b/gfx/layers/basic/AutoMaskData.h @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * 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/. */ + +#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. + * + * This helper class manages the SourceSurface logic. + */ +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; + RefPtr<gfx::SourceSurface> mSurface; + + AutoMoz2DMaskData(const AutoMoz2DMaskData&) = delete; + AutoMoz2DMaskData& operator=(const AutoMoz2DMaskData&) = delete; +}; + +} // namespace layers +} // namespace mozilla + +#endif // GFX_AUTOMASKDATA_H_ |