gfx/layers/ReadbackProcessor.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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

mercurial