gfx/skia/trunk/include/images/SkPageFlipper.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial