gfx/skia/trunk/src/pathops/SkPathOpsRect.cpp

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 #include "SkPathOpsCubic.h"
michael@0 8 #include "SkPathOpsLine.h"
michael@0 9 #include "SkPathOpsQuad.h"
michael@0 10 #include "SkPathOpsRect.h"
michael@0 11
michael@0 12 void SkDRect::setBounds(const SkDLine& line) {
michael@0 13 set(line[0]);
michael@0 14 add(line[1]);
michael@0 15 }
michael@0 16
michael@0 17 void SkDRect::setBounds(const SkDQuad& quad) {
michael@0 18 set(quad[0]);
michael@0 19 add(quad[2]);
michael@0 20 double tValues[2];
michael@0 21 int roots = 0;
michael@0 22 if (!between(quad[0].fX, quad[1].fX, quad[2].fX)) {
michael@0 23 roots = SkDQuad::FindExtrema(quad[0].fX, quad[1].fX, quad[2].fX, tValues);
michael@0 24 }
michael@0 25 if (!between(quad[0].fY, quad[1].fY, quad[2].fY)) {
michael@0 26 roots += SkDQuad::FindExtrema(quad[0].fY, quad[1].fY, quad[2].fY, &tValues[roots]);
michael@0 27 }
michael@0 28 for (int x = 0; x < roots; ++x) {
michael@0 29 add(quad.ptAtT(tValues[x]));
michael@0 30 }
michael@0 31 }
michael@0 32
michael@0 33 void SkDRect::setRawBounds(const SkDQuad& quad) {
michael@0 34 set(quad[0]);
michael@0 35 for (int x = 1; x < 3; ++x) {
michael@0 36 add(quad[x]);
michael@0 37 }
michael@0 38 }
michael@0 39
michael@0 40 static bool is_bounded_by_end_points(double a, double b, double c, double d) {
michael@0 41 return between(a, b, d) && between(a, c, d);
michael@0 42 }
michael@0 43
michael@0 44 void SkDRect::setBounds(const SkDCubic& c) {
michael@0 45 set(c[0]);
michael@0 46 add(c[3]);
michael@0 47 double tValues[4];
michael@0 48 int roots = 0;
michael@0 49 if (!is_bounded_by_end_points(c[0].fX, c[1].fX, c[2].fX, c[3].fX)) {
michael@0 50 roots = SkDCubic::FindExtrema(c[0].fX, c[1].fX, c[2].fX, c[3].fX, tValues);
michael@0 51 }
michael@0 52 if (!is_bounded_by_end_points(c[0].fY, c[1].fY, c[2].fY, c[3].fY)) {
michael@0 53 roots += SkDCubic::FindExtrema(c[0].fY, c[1].fY, c[2].fY, c[3].fY, &tValues[roots]);
michael@0 54 }
michael@0 55 for (int x = 0; x < roots; ++x) {
michael@0 56 add(c.ptAtT(tValues[x]));
michael@0 57 }
michael@0 58 }
michael@0 59
michael@0 60 void SkDRect::setRawBounds(const SkDCubic& cubic) {
michael@0 61 set(cubic[0]);
michael@0 62 for (int x = 1; x < 4; ++x) {
michael@0 63 add(cubic[x]);
michael@0 64 }
michael@0 65 }

mercurial