gfx/layers/MacIOSurfaceImage.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/MacIOSurfaceImage.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef GFX_MACIOSURFACEIMAGE_H
    1.10 +#define GFX_MACIOSURFACEIMAGE_H
    1.11 +
    1.12 +#include "ImageContainer.h"
    1.13 +#include "mozilla/gfx/MacIOSurface.h"
    1.14 +#include "mozilla/gfx/Point.h"
    1.15 +#include "mozilla/layers/TextureClient.h"
    1.16 +
    1.17 +namespace mozilla {
    1.18 +
    1.19 +namespace layers {
    1.20 +
    1.21 +class MacIOSurfaceImage : public Image,
    1.22 +                          public ISharedImage {
    1.23 +public:
    1.24 +  void SetSurface(MacIOSurface* aSurface) { mSurface = aSurface; }
    1.25 +  MacIOSurface* GetSurface() { return mSurface; }
    1.26 +
    1.27 +  gfx::IntSize GetSize() {
    1.28 +    return gfx::IntSize(mSurface->GetDevicePixelWidth(), mSurface->GetDevicePixelHeight());
    1.29 +  }
    1.30 +
    1.31 +  virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; }
    1.32 +
    1.33 +  virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface();
    1.34 +
    1.35 +  virtual TextureClient* GetTextureClient(CompositableClient* aClient) MOZ_OVERRIDE;
    1.36 +  virtual uint8_t* GetBuffer() MOZ_OVERRIDE { return nullptr; }
    1.37 +
    1.38 +  MacIOSurfaceImage() : Image(nullptr, ImageFormat::MAC_IOSURFACE) {}
    1.39 +
    1.40 +private:
    1.41 +  RefPtr<MacIOSurface> mSurface;
    1.42 +  RefPtr<TextureClient> mTextureClient;
    1.43 +};
    1.44 +
    1.45 +} // layers
    1.46 +} // mozilla
    1.47 +
    1.48 +#endif // GFX_SHAREDTEXTUREIMAGE_H

mercurial