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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef MOZILLA_GFX_MACIOSURFACETEXTUREHOST_BASIC_H |
michael@0 | 7 | #define MOZILLA_GFX_MACIOSURFACETEXTUREHOST_BASIC_H |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/layers/TextureHostBasic.h" |
michael@0 | 10 | |
michael@0 | 11 | class MacIOSurface; |
michael@0 | 12 | |
michael@0 | 13 | namespace mozilla { |
michael@0 | 14 | namespace layers { |
michael@0 | 15 | |
michael@0 | 16 | class BasicCompositor; |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * A texture source meant for use with BasicCompositor. |
michael@0 | 20 | * |
michael@0 | 21 | * It does not own any GL texture, and attaches its shared handle to one of |
michael@0 | 22 | * the compositor's temporary textures when binding. |
michael@0 | 23 | */ |
michael@0 | 24 | class MacIOSurfaceTextureSourceBasic |
michael@0 | 25 | : public TextureSourceBasic, |
michael@0 | 26 | public NewTextureSource |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | MacIOSurfaceTextureSourceBasic(BasicCompositor* aCompositor, |
michael@0 | 30 | MacIOSurface* aSurface); |
michael@0 | 31 | virtual ~MacIOSurfaceTextureSourceBasic(); |
michael@0 | 32 | |
michael@0 | 33 | virtual TextureSourceBasic* AsSourceBasic() MOZ_OVERRIDE { return this; } |
michael@0 | 34 | |
michael@0 | 35 | virtual gfx::IntSize GetSize() const MOZ_OVERRIDE; |
michael@0 | 36 | virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE; |
michael@0 | 37 | virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) MOZ_OVERRIDE; |
michael@0 | 38 | |
michael@0 | 39 | virtual void DeallocateDeviceData() MOZ_OVERRIDE { } |
michael@0 | 40 | |
michael@0 | 41 | virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE; |
michael@0 | 42 | |
michael@0 | 43 | protected: |
michael@0 | 44 | BasicCompositor* mCompositor; |
michael@0 | 45 | RefPtr<MacIOSurface> mSurface; |
michael@0 | 46 | RefPtr<gfx::SourceSurface> mSourceSurface; |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | /** |
michael@0 | 50 | * A TextureHost for shared MacIOSurface |
michael@0 | 51 | * |
michael@0 | 52 | * Most of the logic actually happens in MacIOSurfaceTextureSourceBasic. |
michael@0 | 53 | */ |
michael@0 | 54 | class MacIOSurfaceTextureHostBasic : public TextureHost |
michael@0 | 55 | { |
michael@0 | 56 | public: |
michael@0 | 57 | MacIOSurfaceTextureHostBasic(TextureFlags aFlags, |
michael@0 | 58 | const SurfaceDescriptorMacIOSurface& aDescriptor); |
michael@0 | 59 | |
michael@0 | 60 | virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE; |
michael@0 | 61 | |
michael@0 | 62 | virtual bool Lock() MOZ_OVERRIDE; |
michael@0 | 63 | |
michael@0 | 64 | virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE; |
michael@0 | 65 | |
michael@0 | 66 | virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE |
michael@0 | 67 | { |
michael@0 | 68 | return mTextureSource; |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE |
michael@0 | 72 | { |
michael@0 | 73 | return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING) |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | virtual gfx::IntSize GetSize() const MOZ_OVERRIDE; |
michael@0 | 77 | |
michael@0 | 78 | #ifdef MOZ_LAYERS_HAVE_LOG |
michael@0 | 79 | virtual const char* Name() { return "MacIOSurfaceTextureHostBasic"; } |
michael@0 | 80 | #endif |
michael@0 | 81 | |
michael@0 | 82 | protected: |
michael@0 | 83 | BasicCompositor* mCompositor; |
michael@0 | 84 | RefPtr<MacIOSurfaceTextureSourceBasic> mTextureSource; |
michael@0 | 85 | RefPtr<MacIOSurface> mSurface; |
michael@0 | 86 | }; |
michael@0 | 87 | |
michael@0 | 88 | } |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | #endif // MOZILLA_GFX_MACIOSURFACETEXTUREHOSTOGL_BASIC_H |