1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/client/ClientTiledThebesLayer.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,98 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef GFX_CLIENTTILEDTHEBESLAYER_H 1.9 +#define GFX_CLIENTTILEDTHEBESLAYER_H 1.10 + 1.11 +#include "ClientLayerManager.h" // for ClientLayer, etc 1.12 +#include "Layers.h" // for ThebesLayer, etc 1.13 +#include "mozilla/RefPtr.h" // for RefPtr 1.14 +#include "mozilla/layers/TiledContentClient.h" 1.15 +#include "nsDebug.h" // for NS_RUNTIMEABORT 1.16 +#include "nsRegion.h" // for nsIntRegion 1.17 + 1.18 +class gfxContext; 1.19 + 1.20 +namespace mozilla { 1.21 +namespace layers { 1.22 + 1.23 +class ShadowableLayer; 1.24 +class SpecificLayerAttributes; 1.25 + 1.26 +/** 1.27 + * An implementation of ThebesLayer that ONLY supports remote 1.28 + * composition that is backed by tiles. This thebes layer implementation 1.29 + * is better suited to mobile hardware to work around slow implementation 1.30 + * of glTexImage2D (for OGL compositors), and restrait memory bandwidth. 1.31 + * 1.32 + * Tiled Thebes layers use a different protocol compared with other 1.33 + * layers. A copy of the tiled buffer is made and sent to the compositing 1.34 + * thread via the layers protocol. Tiles are uploaded by the buffers 1.35 + * asynchonously without using IPC, that means they are not safe for cross- 1.36 + * process use (bug 747811). Each tile has a TextureHost/Client pair but 1.37 + * they communicate directly rather than using the Texture protocol. 1.38 + * 1.39 + * There is no ContentClient for tiled layers. There is a ContentHost, however. 1.40 + */ 1.41 +class ClientTiledThebesLayer : public ThebesLayer, 1.42 + public ClientLayer 1.43 +{ 1.44 + typedef ThebesLayer Base; 1.45 + 1.46 +public: 1.47 + ClientTiledThebesLayer(ClientLayerManager* const aManager); 1.48 + ~ClientTiledThebesLayer(); 1.49 + 1.50 + // Override name to distinguish it from ClientThebesLayer in layer dumps 1.51 + virtual const char* Name() const { return "TiledThebesLayer"; } 1.52 + 1.53 + // Thebes Layer 1.54 + virtual Layer* AsLayer() { return this; } 1.55 + virtual void InvalidateRegion(const nsIntRegion& aRegion) { 1.56 + mInvalidRegion.Or(mInvalidRegion, aRegion); 1.57 + mValidRegion.Sub(mValidRegion, aRegion); 1.58 + mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, aRegion); 1.59 + } 1.60 + 1.61 + // Shadow methods 1.62 + virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs); 1.63 + virtual ShadowableLayer* AsShadowableLayer() { return this; } 1.64 + 1.65 + virtual void Disconnect() 1.66 + { 1.67 + ClientLayer::Disconnect(); 1.68 + } 1.69 + 1.70 + virtual void RenderLayer(); 1.71 + 1.72 + virtual void ClearCachedResources() MOZ_OVERRIDE; 1.73 + 1.74 +private: 1.75 + ClientLayerManager* ClientManager() 1.76 + { 1.77 + return static_cast<ClientLayerManager*>(mManager); 1.78 + } 1.79 + 1.80 + /** 1.81 + * For the initial PaintThebes of a transaction, calculates all the data 1.82 + * needed for that paint and any repeated transactions. 1.83 + */ 1.84 + void BeginPaint(); 1.85 + 1.86 + /** 1.87 + * When a paint ends, updates any data necessary to persist until the next 1.88 + * paint. If aFinish is true, this will cause the paint to be marked as 1.89 + * finished. 1.90 + */ 1.91 + void EndPaint(bool aFinish); 1.92 + 1.93 + RefPtr<TiledContentClient> mContentClient; 1.94 + nsIntRegion mLowPrecisionValidRegion; 1.95 + BasicTiledLayerPaintData mPaintData; 1.96 +}; 1.97 + 1.98 +} // layers 1.99 +} // mozilla 1.100 + 1.101 +#endif