gfx/skia/trunk/src/core/SkPathEffect.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.

     2 /*
     3  * Copyright 2006 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  */
     9 #include "SkPathEffect.h"
    10 #include "SkPath.h"
    11 #include "SkReadBuffer.h"
    12 #include "SkWriteBuffer.h"
    14 ///////////////////////////////////////////////////////////////////////////////
    16 void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) const {
    17     *dst = src;
    18 }
    20 bool SkPathEffect::asPoints(PointData* results, const SkPath& src,
    21                     const SkStrokeRec&, const SkMatrix&, const SkRect*) const {
    22     return false;
    23 }
    25 ///////////////////////////////////////////////////////////////////////////////
    27 SkPairPathEffect::SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1)
    28         : fPE0(pe0), fPE1(pe1) {
    29     SkASSERT(pe0);
    30     SkASSERT(pe1);
    31     fPE0->ref();
    32     fPE1->ref();
    33 }
    35 SkPairPathEffect::~SkPairPathEffect() {
    36     SkSafeUnref(fPE0);
    37     SkSafeUnref(fPE1);
    38 }
    40 /*
    41     Format: [oe0-factory][pe1-factory][pe0-size][pe0-data][pe1-data]
    42 */
    43 void SkPairPathEffect::flatten(SkWriteBuffer& buffer) const {
    44     this->INHERITED::flatten(buffer);
    45     buffer.writeFlattenable(fPE0);
    46     buffer.writeFlattenable(fPE1);
    47 }
    49 SkPairPathEffect::SkPairPathEffect(SkReadBuffer& buffer) {
    50     fPE0 = buffer.readPathEffect();
    51     fPE1 = buffer.readPathEffect();
    52     // either of these may fail, so we have to check for nulls later on
    53 }
    55 ///////////////////////////////////////////////////////////////////////////////
    57 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src,
    58                              SkStrokeRec* rec, const SkRect* cullRect) const {
    59     // we may have failed to unflatten these, so we have to check
    60     if (!fPE0 || !fPE1) {
    61         return false;
    62     }
    64     SkPath          tmp;
    65     const SkPath*   ptr = &src;
    67     if (fPE1->filterPath(&tmp, src, rec, cullRect)) {
    68         ptr = &tmp;
    69     }
    70     return fPE0->filterPath(dst, *ptr, rec, cullRect);
    71 }
    73 ///////////////////////////////////////////////////////////////////////////////
    75 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src,
    76                              SkStrokeRec* rec, const SkRect* cullRect) const {
    77     // use bit-or so that we always call both, even if the first one succeeds
    78     return fPE0->filterPath(dst, src, rec, cullRect) |
    79            fPE1->filterPath(dst, src, rec, cullRect);
    80 }

mercurial