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.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GFX_COPYABLECANVASLAYER_H
7 #define GFX_COPYABLECANVASLAYER_H
9 #include <stdint.h> // for uint32_t
10 #include "GLContextTypes.h" // for GLContext
11 #include "Layers.h" // for CanvasLayer, etc
12 #include "gfxContext.h" // for gfxContext, etc
13 #include "gfxTypes.h"
14 #include "gfxPlatform.h" // for gfxImageFormat
15 #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
16 #include "mozilla/Preferences.h" // for Preferences
17 #include "mozilla/RefPtr.h" // for RefPtr
18 #include "mozilla/gfx/2D.h" // for DrawTarget
19 #include "mozilla/mozalloc.h" // for operator delete, etc
20 #include "nsAutoPtr.h" // for nsRefPtr
21 #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
23 namespace mozilla {
25 namespace gfx {
26 class SurfaceStream;
27 class SharedSurface;
28 class SurfaceFactory;
29 }
31 namespace layers {
33 class CanvasClientWebGL;
35 /**
36 * A shared CanvasLayer implementation that supports copying
37 * its contents into a gfxASurface using UpdateSurface.
38 */
39 class CopyableCanvasLayer : public CanvasLayer
40 {
41 public:
42 CopyableCanvasLayer(LayerManager* aLayerManager, void *aImplData);
43 virtual ~CopyableCanvasLayer();
45 virtual void Initialize(const Data& aData);
47 virtual bool IsDataValid(const Data& aData);
49 protected:
50 void UpdateTarget(gfx::DrawTarget* aDestTarget = nullptr);
52 RefPtr<gfx::SourceSurface> mSurface;
53 nsRefPtr<mozilla::gl::GLContext> mGLContext;
54 mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
56 RefPtr<gfx::SurfaceStream> mStream;
58 uint32_t mCanvasFramebuffer;
60 bool mIsGLAlphaPremult;
61 bool mNeedsYFlip;
63 RefPtr<gfx::DataSourceSurface> mCachedTempSurface;
64 gfx::IntSize mCachedSize;
65 gfx::SurfaceFormat mCachedFormat;
67 gfx::DataSourceSurface* GetTempSurface(const gfx::IntSize& aSize,
68 const gfx::SurfaceFormat aFormat);
70 void DiscardTempSurface();
71 };
73 }
74 }
76 #endif