gecko/gfx/gl/SurfaceFactory.h
Wes Kocher 8f849d9d65 Backed out 6 changesets (bug 877115) for mochitest-1 and reftest orange on this CLOSED TREE
Backed out changeset 65ad9d8860d6 (bug 877115)
Backed out changeset bf8095c168fb (bug 877115)
Backed out changeset 290ad5863615 (bug 877115)
Backed out changeset 4488ec28910e (bug 877115)
Backed out changeset 45f8859c6fd6 (bug 877115)
Backed out changeset 111cc426fa9e (bug 877115)
2013-12-16 16:33:07 -08:00

56 lines
1.2 KiB
C++

/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
/* 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 SURFACE_FACTORY_H_
#define SURFACE_FACTORY_H_
#include <queue>
#include "SurfaceTypes.h"
#include "gfxPoint.h"
namespace mozilla {
namespace gfx {
// Forward:
class SharedSurface;
class SurfaceFactory
{
protected:
SurfaceCaps mCaps;
SharedSurfaceType mType;
SurfaceFactory(SharedSurfaceType type, const SurfaceCaps& caps)
: mCaps(caps)
, mType(type)
{}
public:
virtual ~SurfaceFactory();
protected:
virtual SharedSurface* CreateShared(const gfxIntSize& size) = 0;
std::queue<SharedSurface*> mScraps;
public:
SharedSurface* NewSharedSurface(const gfxIntSize& size);
// Auto-deletes surfs of the wrong type.
void Recycle(SharedSurface*& surf);
const SurfaceCaps& Caps() const {
return mCaps;
}
SharedSurfaceType Type() const {
return mType;
}
};
} // namespace gfx
} // namespace mozilla
#endif // SURFACE_FACTORY_H_