michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 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 MOZILLA_GFX_DATASOURCESURFACEWRAPPER_H_ michael@0: #define MOZILLA_GFX_DATASOURCESURFACEWRAPPER_H_ michael@0: michael@0: #include "2D.h" michael@0: michael@0: namespace mozilla { michael@0: namespace gfx { michael@0: michael@0: // Wraps a DataSourceSurface and forwards all methods except for GetType(), michael@0: // from which it always returns SurfaceType::DATA. michael@0: class DataSourceSurfaceWrapper : public DataSourceSurface michael@0: { michael@0: public: michael@0: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DataSourceSurfaceWrapper) michael@0: DataSourceSurfaceWrapper(DataSourceSurface *aSurface) michael@0: : mSurface(aSurface) michael@0: {} michael@0: michael@0: virtual SurfaceType GetType() const MOZ_OVERRIDE { return SurfaceType::DATA; } michael@0: michael@0: virtual uint8_t *GetData() MOZ_OVERRIDE { return mSurface->GetData(); } michael@0: virtual int32_t Stride() MOZ_OVERRIDE { return mSurface->Stride(); } michael@0: virtual IntSize GetSize() const MOZ_OVERRIDE { return mSurface->GetSize(); } michael@0: virtual SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mSurface->GetFormat(); } michael@0: virtual bool IsValid() const MOZ_OVERRIDE { return mSurface->IsValid(); } michael@0: michael@0: private: michael@0: RefPtr mSurface; michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif /* MOZILLA_GFX_DATASOURCESURFACEWRAPPER_H_ */