gfx/skia/trunk/src/pathops/SkPathOpsRect.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.

     1 /*
     2  * Copyright 2012 Google Inc.
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     7 #ifndef SkPathOpsRect_DEFINED
     8 #define SkPathOpsRect_DEFINED
    10 #include "SkPathOpsPoint.h"
    12 struct SkDRect {
    13     double fLeft, fTop, fRight, fBottom;
    15     void add(const SkDPoint& pt) {
    16         if (fLeft > pt.fX) {
    17             fLeft = pt.fX;
    18         }
    19         if (fTop > pt.fY) {
    20             fTop = pt.fY;
    21         }
    22         if (fRight < pt.fX) {
    23             fRight = pt.fX;
    24         }
    25         if (fBottom < pt.fY) {
    26             fBottom = pt.fY;
    27         }
    28     }
    30     bool contains(const SkDPoint& pt) const {
    31         return approximately_between(fLeft, pt.fX, fRight)
    32                 && approximately_between(fTop, pt.fY, fBottom);
    33     }
    35     bool intersects(SkDRect* r) const {
    36         SkASSERT(fLeft <= fRight);
    37         SkASSERT(fTop <= fBottom);
    38         SkASSERT(r->fLeft <= r->fRight);
    39         SkASSERT(r->fTop <= r->fBottom);
    40         return r->fLeft <= fRight && fLeft <= r->fRight && r->fTop <= fBottom && fTop <= r->fBottom;
    41     }
    43     void set(const SkDPoint& pt) {
    44         fLeft = fRight = pt.fX;
    45         fTop = fBottom = pt.fY;
    46     }
    48     double width() const {
    49         return fRight - fLeft;
    50     }
    52     double height() const {
    53         return fBottom - fTop;
    54     }
    56     void setBounds(const SkDLine&);
    57     void setBounds(const SkDCubic&);
    58     void setBounds(const SkDQuad&);
    59     void setRawBounds(const SkDCubic&);
    60     void setRawBounds(const SkDQuad&);
    61 };
    63 #endif

mercurial