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.

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

mercurial