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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef GFX_CLIENTTILEDTHEBESLAYER_H |
michael@0 | 6 | #define GFX_CLIENTTILEDTHEBESLAYER_H |
michael@0 | 7 | |
michael@0 | 8 | #include "ClientLayerManager.h" // for ClientLayer, etc |
michael@0 | 9 | #include "Layers.h" // for ThebesLayer, etc |
michael@0 | 10 | #include "mozilla/RefPtr.h" // for RefPtr |
michael@0 | 11 | #include "mozilla/layers/TiledContentClient.h" |
michael@0 | 12 | #include "nsDebug.h" // for NS_RUNTIMEABORT |
michael@0 | 13 | #include "nsRegion.h" // for nsIntRegion |
michael@0 | 14 | |
michael@0 | 15 | class gfxContext; |
michael@0 | 16 | |
michael@0 | 17 | namespace mozilla { |
michael@0 | 18 | namespace layers { |
michael@0 | 19 | |
michael@0 | 20 | class ShadowableLayer; |
michael@0 | 21 | class SpecificLayerAttributes; |
michael@0 | 22 | |
michael@0 | 23 | /** |
michael@0 | 24 | * An implementation of ThebesLayer that ONLY supports remote |
michael@0 | 25 | * composition that is backed by tiles. This thebes layer implementation |
michael@0 | 26 | * is better suited to mobile hardware to work around slow implementation |
michael@0 | 27 | * of glTexImage2D (for OGL compositors), and restrait memory bandwidth. |
michael@0 | 28 | * |
michael@0 | 29 | * Tiled Thebes layers use a different protocol compared with other |
michael@0 | 30 | * layers. A copy of the tiled buffer is made and sent to the compositing |
michael@0 | 31 | * thread via the layers protocol. Tiles are uploaded by the buffers |
michael@0 | 32 | * asynchonously without using IPC, that means they are not safe for cross- |
michael@0 | 33 | * process use (bug 747811). Each tile has a TextureHost/Client pair but |
michael@0 | 34 | * they communicate directly rather than using the Texture protocol. |
michael@0 | 35 | * |
michael@0 | 36 | * There is no ContentClient for tiled layers. There is a ContentHost, however. |
michael@0 | 37 | */ |
michael@0 | 38 | class ClientTiledThebesLayer : public ThebesLayer, |
michael@0 | 39 | public ClientLayer |
michael@0 | 40 | { |
michael@0 | 41 | typedef ThebesLayer Base; |
michael@0 | 42 | |
michael@0 | 43 | public: |
michael@0 | 44 | ClientTiledThebesLayer(ClientLayerManager* const aManager); |
michael@0 | 45 | ~ClientTiledThebesLayer(); |
michael@0 | 46 | |
michael@0 | 47 | // Override name to distinguish it from ClientThebesLayer in layer dumps |
michael@0 | 48 | virtual const char* Name() const { return "TiledThebesLayer"; } |
michael@0 | 49 | |
michael@0 | 50 | // Thebes Layer |
michael@0 | 51 | virtual Layer* AsLayer() { return this; } |
michael@0 | 52 | virtual void InvalidateRegion(const nsIntRegion& aRegion) { |
michael@0 | 53 | mInvalidRegion.Or(mInvalidRegion, aRegion); |
michael@0 | 54 | mValidRegion.Sub(mValidRegion, aRegion); |
michael@0 | 55 | mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, aRegion); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | // Shadow methods |
michael@0 | 59 | virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs); |
michael@0 | 60 | virtual ShadowableLayer* AsShadowableLayer() { return this; } |
michael@0 | 61 | |
michael@0 | 62 | virtual void Disconnect() |
michael@0 | 63 | { |
michael@0 | 64 | ClientLayer::Disconnect(); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | virtual void RenderLayer(); |
michael@0 | 68 | |
michael@0 | 69 | virtual void ClearCachedResources() MOZ_OVERRIDE; |
michael@0 | 70 | |
michael@0 | 71 | private: |
michael@0 | 72 | ClientLayerManager* ClientManager() |
michael@0 | 73 | { |
michael@0 | 74 | return static_cast<ClientLayerManager*>(mManager); |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * For the initial PaintThebes of a transaction, calculates all the data |
michael@0 | 79 | * needed for that paint and any repeated transactions. |
michael@0 | 80 | */ |
michael@0 | 81 | void BeginPaint(); |
michael@0 | 82 | |
michael@0 | 83 | /** |
michael@0 | 84 | * When a paint ends, updates any data necessary to persist until the next |
michael@0 | 85 | * paint. If aFinish is true, this will cause the paint to be marked as |
michael@0 | 86 | * finished. |
michael@0 | 87 | */ |
michael@0 | 88 | void EndPaint(bool aFinish); |
michael@0 | 89 | |
michael@0 | 90 | RefPtr<TiledContentClient> mContentClient; |
michael@0 | 91 | nsIntRegion mLowPrecisionValidRegion; |
michael@0 | 92 | BasicTiledLayerPaintData mPaintData; |
michael@0 | 93 | }; |
michael@0 | 94 | |
michael@0 | 95 | } // layers |
michael@0 | 96 | } // mozilla |
michael@0 | 97 | |
michael@0 | 98 | #endif |