gfx/skia/trunk/include/images/SkPageFlipper.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.

     2 /*
     3  * Copyright 2008 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #ifndef SkPageFlipper_DEFINED
    11 #define SkPageFlipper_DEFINED
    13 #include "SkRegion.h"
    15 /** SkPageFlipper manages alternating inval/dirty regions for a rectangular area
    16     (like a bitmap). You call inval() to accumulate inval areas, and then when
    17     you're ready to "flip" pages (i.e. draw into the one you've been
    18     invalidating) you call update, which swaps the inval regions, and returns
    19     two things to you: 1) the final inval region to be drawn into, and 2) the
    20     region of pixels that should be copied from the "front" page onto the one
    21     you're about to draw into. This copyBits region will be disjoint from the
    22     inval region, so both need to be handled.
    23  */
    24 class SkPageFlipper {
    25 public:
    26     SkPageFlipper();
    27     SkPageFlipper(int width, int height);
    29     int width() const { return fWidth; }
    30     int height() const { return fHeight; }
    32     void resize(int width, int height);
    34     bool isDirty() const { return !fDirty1->isEmpty(); }
    35     const SkRegion& dirtyRgn() const { return *fDirty1; }
    37     void inval();
    38     void inval(const SkIRect&);
    39     void inval(const SkRegion&);
    40     void inval(const SkRect&, bool antialias);
    42     /** When you're ready to write to the back page, call update. The returned
    43         region is the invalidate are that needs to be drawn to. The copyBits
    44         region (provided by the caller) is the area that should be copied from
    45         the front page to the back page (will not intersect with the returned
    46         inval region.
    48         Once this is called, the two internal regions are swapped, so the *new*
    49         back inval region is ready to receive new inval calls.
    50      */
    51     const SkRegion& update(SkRegion* copyBits);
    53 private:
    54     SkRegion*   fDirty0;
    55     SkRegion*   fDirty1;
    56     SkRegion    fDirty0Storage;
    57     SkRegion    fDirty1Storage;
    58     int         fWidth;
    59     int         fHeight;
    60 };
    62 #endif

mercurial