Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GFX_AUTOMASKDATA_H_
7 #define GFX_AUTOMASKDATA_H_
9 #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
11 namespace mozilla {
12 namespace layers {
14 /**
15 * Drawing with a mask requires a mask surface and a transform.
16 *
17 * This helper class manages the SourceSurface logic.
18 */
19 class MOZ_STACK_CLASS AutoMoz2DMaskData {
20 public:
21 AutoMoz2DMaskData() { }
22 ~AutoMoz2DMaskData() { }
24 void Construct(const gfx::Matrix& aTransform,
25 gfx::SourceSurface* aSurface)
26 {
27 MOZ_ASSERT(!IsConstructed());
28 mTransform = aTransform;
29 mSurface = aSurface;
30 }
32 gfx::SourceSurface* GetSurface()
33 {
34 MOZ_ASSERT(IsConstructed());
35 return mSurface.get();
36 }
38 const gfx::Matrix& GetTransform()
39 {
40 MOZ_ASSERT(IsConstructed());
41 return mTransform;
42 }
44 private:
45 bool IsConstructed()
46 {
47 return !!mSurface;
48 }
50 gfx::Matrix mTransform;
51 RefPtr<gfx::SourceSurface> mSurface;
53 AutoMoz2DMaskData(const AutoMoz2DMaskData&) MOZ_DELETE;
54 AutoMoz2DMaskData& operator=(const AutoMoz2DMaskData&) MOZ_DELETE;
55 };
57 }
58 }
60 #endif // GFX_AUTOMASKDATA_H_