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.

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

mercurial