gfx/skia/trunk/src/effects/SkPixelXorXfermode.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 2011 Google Inc.
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #include "SkPixelXorXfermode.h"
    11 #include "SkColorPriv.h"
    12 #include "SkReadBuffer.h"
    13 #include "SkWriteBuffer.h"
    14 #include "SkString.h"
    16 // we always return an opaque color, 'cause I don't know what to do with
    17 // the alpha-component and still return a valid premultiplied color.
    18 SkPMColor SkPixelXorXfermode::xferColor(SkPMColor src, SkPMColor dst) const {
    19     SkPMColor res = src ^ dst ^ fOpColor;
    20     res |= (SK_A32_MASK << SK_A32_SHIFT);   // force it to be opaque
    21     return res;
    22 }
    24 void SkPixelXorXfermode::flatten(SkWriteBuffer& wb) const {
    25     this->INHERITED::flatten(wb);
    26     wb.writeColor(fOpColor);
    27 }
    29 SkPixelXorXfermode::SkPixelXorXfermode(SkReadBuffer& rb)
    30         : INHERITED(rb) {
    31     fOpColor = rb.readColor();
    32 }
    34 #ifndef SK_IGNORE_TO_STRING
    35 void SkPixelXorXfermode::toString(SkString* str) const {
    36     str->append("SkPixelXorXfermode: ");
    37     str->appendHex(fOpColor);
    38 }
    39 #endif

mercurial