michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef GFX_CLIENTTILEDTHEBESLAYER_H michael@0: #define GFX_CLIENTTILEDTHEBESLAYER_H michael@0: michael@0: #include "ClientLayerManager.h" // for ClientLayer, etc michael@0: #include "Layers.h" // for ThebesLayer, etc michael@0: #include "mozilla/RefPtr.h" // for RefPtr michael@0: #include "mozilla/layers/TiledContentClient.h" michael@0: #include "nsDebug.h" // for NS_RUNTIMEABORT michael@0: #include "nsRegion.h" // for nsIntRegion michael@0: michael@0: class gfxContext; michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: class ShadowableLayer; michael@0: class SpecificLayerAttributes; michael@0: michael@0: /** michael@0: * An implementation of ThebesLayer that ONLY supports remote michael@0: * composition that is backed by tiles. This thebes layer implementation michael@0: * is better suited to mobile hardware to work around slow implementation michael@0: * of glTexImage2D (for OGL compositors), and restrait memory bandwidth. michael@0: * michael@0: * Tiled Thebes layers use a different protocol compared with other michael@0: * layers. A copy of the tiled buffer is made and sent to the compositing michael@0: * thread via the layers protocol. Tiles are uploaded by the buffers michael@0: * asynchonously without using IPC, that means they are not safe for cross- michael@0: * process use (bug 747811). Each tile has a TextureHost/Client pair but michael@0: * they communicate directly rather than using the Texture protocol. michael@0: * michael@0: * There is no ContentClient for tiled layers. There is a ContentHost, however. michael@0: */ michael@0: class ClientTiledThebesLayer : public ThebesLayer, michael@0: public ClientLayer michael@0: { michael@0: typedef ThebesLayer Base; michael@0: michael@0: public: michael@0: ClientTiledThebesLayer(ClientLayerManager* const aManager); michael@0: ~ClientTiledThebesLayer(); michael@0: michael@0: // Override name to distinguish it from ClientThebesLayer in layer dumps michael@0: virtual const char* Name() const { return "TiledThebesLayer"; } michael@0: michael@0: // Thebes Layer michael@0: virtual Layer* AsLayer() { return this; } michael@0: virtual void InvalidateRegion(const nsIntRegion& aRegion) { michael@0: mInvalidRegion.Or(mInvalidRegion, aRegion); michael@0: mValidRegion.Sub(mValidRegion, aRegion); michael@0: mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, aRegion); michael@0: } michael@0: michael@0: // Shadow methods michael@0: virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs); michael@0: virtual ShadowableLayer* AsShadowableLayer() { return this; } michael@0: michael@0: virtual void Disconnect() michael@0: { michael@0: ClientLayer::Disconnect(); michael@0: } michael@0: michael@0: virtual void RenderLayer(); michael@0: michael@0: virtual void ClearCachedResources() MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: ClientLayerManager* ClientManager() michael@0: { michael@0: return static_cast(mManager); michael@0: } michael@0: michael@0: /** michael@0: * For the initial PaintThebes of a transaction, calculates all the data michael@0: * needed for that paint and any repeated transactions. michael@0: */ michael@0: void BeginPaint(); michael@0: michael@0: /** michael@0: * When a paint ends, updates any data necessary to persist until the next michael@0: * paint. If aFinish is true, this will cause the paint to be marked as michael@0: * finished. michael@0: */ michael@0: void EndPaint(bool aFinish); michael@0: michael@0: RefPtr mContentClient; michael@0: nsIntRegion mLowPrecisionValidRegion; michael@0: BasicTiledLayerPaintData mPaintData; michael@0: }; michael@0: michael@0: } // layers michael@0: } // mozilla michael@0: michael@0: #endif