gfx/skia/trunk/src/gpu/GrStencilBuffer.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  */
     9 #include "GrStencilBuffer.h"
    11 #include "GrContext.h"
    12 #include "GrGpu.h"
    13 #include "GrResourceCache.h"
    15 void GrStencilBuffer::transferToCache() {
    16     SkASSERT(NULL == this->getCacheEntry());
    18     this->getGpu()->getContext()->addStencilBuffer(this);
    19 }
    21 namespace {
    22 // we should never have more than one stencil buffer with same combo of (width,height,samplecount)
    23 void gen_cache_id(int width, int height, int sampleCnt, GrCacheID* cacheID) {
    24     static const GrCacheID::Domain gStencilBufferDomain = GrCacheID::GenerateDomain();
    25     GrCacheID::Key key;
    26     uint32_t* keyData = key.fData32;
    27     keyData[0] = width;
    28     keyData[1] = height;
    29     keyData[2] = sampleCnt;
    30     memset(keyData + 3, 0, sizeof(key) - 3 * sizeof(uint32_t));
    31     GR_STATIC_ASSERT(sizeof(key) >= 3 * sizeof(uint32_t));
    32     cacheID->reset(gStencilBufferDomain, key);
    33 }
    34 }
    36 GrResourceKey GrStencilBuffer::ComputeKey(int width,
    37                                           int height,
    38                                           int sampleCnt) {
    39     // All SBs are created internally to attach to RTs so they all use the same domain.
    40     static const GrResourceKey::ResourceType gStencilBufferResourceType =
    41         GrResourceKey::GenerateResourceType();
    42     GrCacheID id;
    43     gen_cache_id(width, height, sampleCnt, &id);
    45     // we don't use any flags for SBs currently.
    46     return GrResourceKey(id, gStencilBufferResourceType, 0);
    47 }

mercurial