gfx/skia/trunk/src/core/SkPictureFlat.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 /*
michael@0 3 * Copyright 2011 Google Inc.
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8 #include "SkPictureFlat.h"
michael@0 9
michael@0 10 #include "SkChecksum.h"
michael@0 11 #include "SkColorFilter.h"
michael@0 12 #include "SkDrawLooper.h"
michael@0 13 #include "SkMaskFilter.h"
michael@0 14 #include "SkRasterizer.h"
michael@0 15 #include "SkShader.h"
michael@0 16 #include "SkTypeface.h"
michael@0 17 #include "SkXfermode.h"
michael@0 18
michael@0 19 ///////////////////////////////////////////////////////////////////////////////
michael@0 20
michael@0 21 SkTypefacePlayback::SkTypefacePlayback() : fCount(0), fArray(NULL) {}
michael@0 22
michael@0 23 SkTypefacePlayback::~SkTypefacePlayback() {
michael@0 24 this->reset(NULL);
michael@0 25 }
michael@0 26
michael@0 27 void SkTypefacePlayback::reset(const SkRefCntSet* rec) {
michael@0 28 for (int i = 0; i < fCount; i++) {
michael@0 29 SkASSERT(fArray[i]);
michael@0 30 fArray[i]->unref();
michael@0 31 }
michael@0 32 SkDELETE_ARRAY(fArray);
michael@0 33
michael@0 34 if (rec!= NULL && rec->count() > 0) {
michael@0 35 fCount = rec->count();
michael@0 36 fArray = SkNEW_ARRAY(SkRefCnt*, fCount);
michael@0 37 rec->copyToArray(fArray);
michael@0 38 for (int i = 0; i < fCount; i++) {
michael@0 39 fArray[i]->ref();
michael@0 40 }
michael@0 41 } else {
michael@0 42 fCount = 0;
michael@0 43 fArray = NULL;
michael@0 44 }
michael@0 45 }
michael@0 46
michael@0 47 void SkTypefacePlayback::setCount(int count) {
michael@0 48 this->reset(NULL);
michael@0 49
michael@0 50 fCount = count;
michael@0 51 fArray = SkNEW_ARRAY(SkRefCnt*, count);
michael@0 52 sk_bzero(fArray, count * sizeof(SkRefCnt*));
michael@0 53 }
michael@0 54
michael@0 55 SkRefCnt* SkTypefacePlayback::set(int index, SkRefCnt* obj) {
michael@0 56 SkASSERT((unsigned)index < (unsigned)fCount);
michael@0 57 SkRefCnt_SafeAssign(fArray[index], obj);
michael@0 58 return obj;
michael@0 59 }
michael@0 60
michael@0 61 ///////////////////////////////////////////////////////////////////////////////
michael@0 62
michael@0 63 SkFlatController::SkFlatController(uint32_t writeBufferFlags)
michael@0 64 : fBitmapHeap(NULL)
michael@0 65 , fTypefaceSet(NULL)
michael@0 66 , fTypefacePlayback(NULL)
michael@0 67 , fFactorySet(NULL)
michael@0 68 , fWriteBufferFlags(writeBufferFlags) {}
michael@0 69
michael@0 70 SkFlatController::~SkFlatController() {
michael@0 71 SkSafeUnref(fBitmapHeap);
michael@0 72 SkSafeUnref(fTypefaceSet);
michael@0 73 SkSafeUnref(fFactorySet);
michael@0 74 }
michael@0 75
michael@0 76 void SkFlatController::setBitmapHeap(SkBitmapHeap* heap) {
michael@0 77 SkRefCnt_SafeAssign(fBitmapHeap, heap);
michael@0 78 }
michael@0 79
michael@0 80 void SkFlatController::setTypefaceSet(SkRefCntSet *set) {
michael@0 81 SkRefCnt_SafeAssign(fTypefaceSet, set);
michael@0 82 }
michael@0 83
michael@0 84 void SkFlatController::setTypefacePlayback(SkTypefacePlayback* playback) {
michael@0 85 fTypefacePlayback = playback;
michael@0 86 }
michael@0 87
michael@0 88 SkNamedFactorySet* SkFlatController::setNamedFactorySet(SkNamedFactorySet* set) {
michael@0 89 SkRefCnt_SafeAssign(fFactorySet, set);
michael@0 90 return set;
michael@0 91 }

mercurial