LCOV - code coverage report
Current view: top level - gfx/layers - ReadbackProcessor.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 1 100.0 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; 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/. */
       5             : 
       6             : #ifndef GFX_READBACKPROCESSOR_H
       7             : #define GFX_READBACKPROCESSOR_H
       8             : 
       9             : #include <stdint.h>                     // for uint64_t
      10             : #include "nsRect.h"                     // for mozilla::gfx::IntRect
      11             : #include "nsRegionFwd.h"                // for nsIntRegion
      12             : #include "nsTArray.h"                   // for nsTArray
      13             : 
      14             : namespace mozilla {
      15             : namespace layers {
      16             : 
      17             : class ContainerLayer;
      18             : class ReadbackLayer;
      19             : class PaintedLayer;
      20             : 
      21         129 : class ReadbackProcessor {
      22             : public:
      23             :   /**
      24             :    * Called by the container before processing any child layers. Call this
      25             :    * if any child layer might have changed in any way (other than content-only
      26             :    * changes to layers other than ColorLayers and PaintedLayers).
      27             :    *
      28             :    * This method recomputes the relationship between ReadbackLayers and
      29             :    * sibling layers, and dispatches changes to ReadbackLayers. Except that
      30             :    * if a PaintedLayer needs its contents sent to some ReadbackLayer, we'll
      31             :    * just record that internally and later the PaintedLayer should call
      32             :    * GetPaintedLayerUpdates when it paints, to find out which rectangle needs
      33             :    * to be sent, and the ReadbackLayer it needs to be sent to.
      34             :    */
      35             :   void BuildUpdates(ContainerLayer* aContainer);
      36             : 
      37             :   struct Update {
      38             :     /**
      39             :      * The layer a PaintedLayer should send its contents to.
      40             :      */
      41             :     ReadbackLayer* mLayer;
      42             :     /**
      43             :      * The rectangle of content that it should send, in the PaintedLayer's
      44             :      * coordinate system. This rectangle is guaranteed to be in the PaintedLayer's
      45             :      * visible region. Translate it to mLayer's coordinate system
      46             :      * by adding mLayer->GetBackgroundLayerOffset().
      47             :      */
      48             :     gfx::IntRect      mUpdateRect;
      49             :     /**
      50             :      * The sequence counter value to use when calling DoUpdate
      51             :      */
      52             :     uint64_t       mSequenceCounter;
      53             :   };
      54             :   /**
      55             :    * Appends any ReadbackLayers that need to be updated, and the rects that
      56             :    * need to be updated, to aUpdates. Only need to call this for PaintedLayers
      57             :    * that have been marked UsedForReadback().
      58             :    * Each Update's mLayer's mBackgroundLayer will have been set to aLayer.
      59             :    * If a PaintedLayer doesn't call GetPaintedLayerUpdates, then all the
      60             :    * ReadbackLayers that needed data from that PaintedLayer will be marked
      61             :    * as having unknown backgrounds.
      62             :    * @param aUpdateRegion if non-null, this region is set to the union
      63             :    * of the mUpdateRects.
      64             :    */
      65             :   void GetPaintedLayerUpdates(PaintedLayer* aLayer,
      66             :                              nsTArray<Update>* aUpdates,
      67             :                              nsIntRegion* aUpdateRegion = nullptr);
      68             : 
      69             :   ~ReadbackProcessor();
      70             : 
      71             : protected:
      72             :   void BuildUpdatesForLayer(ReadbackLayer* aLayer);
      73             : 
      74             :   nsTArray<Update> mAllUpdates;
      75             : };
      76             : 
      77             : } // namespace layers
      78             : } // namespace mozilla
      79             : 
      80             : #endif /* GFX_READBACKPROCESSOR_H */

Generated by: LCOV version 1.13