michael@0: /* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef SURFACE_FACTORY_H_ michael@0: #define SURFACE_FACTORY_H_ michael@0: michael@0: #include michael@0: #include "SurfaceTypes.h" michael@0: #include "gfxPoint.h" michael@0: michael@0: namespace mozilla { michael@0: namespace gfx { michael@0: // Forward: michael@0: class SharedSurface; michael@0: michael@0: class SurfaceFactory michael@0: { michael@0: protected: michael@0: SurfaceCaps mCaps; michael@0: SharedSurfaceType mType; michael@0: michael@0: SurfaceFactory(SharedSurfaceType type, const SurfaceCaps& caps) michael@0: : mCaps(caps) michael@0: , mType(type) michael@0: {} michael@0: michael@0: public: michael@0: virtual ~SurfaceFactory(); michael@0: michael@0: protected: michael@0: virtual SharedSurface* CreateShared(const gfx::IntSize& size) = 0; michael@0: michael@0: std::queue mScraps; michael@0: michael@0: public: michael@0: SharedSurface* NewSharedSurface(const gfx::IntSize& size); michael@0: michael@0: // Auto-deletes surfs of the wrong type. michael@0: void Recycle(SharedSurface*& surf); michael@0: michael@0: const SurfaceCaps& Caps() const { michael@0: return mCaps; michael@0: } michael@0: michael@0: SharedSurfaceType Type() const { michael@0: return mType; michael@0: } michael@0: }; michael@0: michael@0: } // namespace gfx michael@0: } // namespace mozilla michael@0: michael@0: #endif // SURFACE_FACTORY_H_