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++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
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 SURFACE_FACTORY_H_
7 #define SURFACE_FACTORY_H_
9 #include <queue>
10 #include "SurfaceTypes.h"
11 #include "gfxPoint.h"
13 namespace mozilla {
14 namespace gfx {
15 // Forward:
16 class SharedSurface;
18 class SurfaceFactory
19 {
20 protected:
21 SurfaceCaps mCaps;
22 SharedSurfaceType mType;
24 SurfaceFactory(SharedSurfaceType type, const SurfaceCaps& caps)
25 : mCaps(caps)
26 , mType(type)
27 {}
29 public:
30 virtual ~SurfaceFactory();
32 protected:
33 virtual SharedSurface* CreateShared(const gfx::IntSize& size) = 0;
35 std::queue<SharedSurface*> mScraps;
37 public:
38 SharedSurface* NewSharedSurface(const gfx::IntSize& size);
40 // Auto-deletes surfs of the wrong type.
41 void Recycle(SharedSurface*& surf);
43 const SurfaceCaps& Caps() const {
44 return mCaps;
45 }
47 SharedSurfaceType Type() const {
48 return mType;
49 }
50 };
52 } // namespace gfx
53 } // namespace mozilla
55 #endif // SURFACE_FACTORY_H_