gfx/skia/trunk/src/core/SkScan.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 2006 The Android Open Source Project
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
michael@0 9
michael@0 10 #include "SkScan.h"
michael@0 11 #include "SkBlitter.h"
michael@0 12 #include "SkRasterClip.h"
michael@0 13
michael@0 14 static inline void blitrect(SkBlitter* blitter, const SkIRect& r) {
michael@0 15 blitter->blitRect(r.fLeft, r.fTop, r.width(), r.height());
michael@0 16 }
michael@0 17
michael@0 18 void SkScan::FillIRect(const SkIRect& r, const SkRegion* clip,
michael@0 19 SkBlitter* blitter) {
michael@0 20 if (!r.isEmpty()) {
michael@0 21 if (clip) {
michael@0 22 if (clip->isRect()) {
michael@0 23 const SkIRect& clipBounds = clip->getBounds();
michael@0 24
michael@0 25 if (clipBounds.contains(r)) {
michael@0 26 blitrect(blitter, r);
michael@0 27 } else {
michael@0 28 SkIRect rr = r;
michael@0 29 if (rr.intersect(clipBounds)) {
michael@0 30 blitrect(blitter, rr);
michael@0 31 }
michael@0 32 }
michael@0 33 } else {
michael@0 34 SkRegion::Cliperator cliper(*clip, r);
michael@0 35 const SkIRect& rr = cliper.rect();
michael@0 36
michael@0 37 while (!cliper.done()) {
michael@0 38 blitrect(blitter, rr);
michael@0 39 cliper.next();
michael@0 40 }
michael@0 41 }
michael@0 42 } else {
michael@0 43 blitrect(blitter, r);
michael@0 44 }
michael@0 45 }
michael@0 46 }
michael@0 47
michael@0 48 void SkScan::FillXRect(const SkXRect& xr, const SkRegion* clip,
michael@0 49 SkBlitter* blitter) {
michael@0 50 SkIRect r;
michael@0 51
michael@0 52 XRect_round(xr, &r);
michael@0 53 SkScan::FillIRect(r, clip, blitter);
michael@0 54 }
michael@0 55
michael@0 56 void SkScan::FillRect(const SkRect& r, const SkRegion* clip,
michael@0 57 SkBlitter* blitter) {
michael@0 58 SkIRect ir;
michael@0 59
michael@0 60 r.round(&ir);
michael@0 61 SkScan::FillIRect(ir, clip, blitter);
michael@0 62 }
michael@0 63
michael@0 64 ///////////////////////////////////////////////////////////////////////////////
michael@0 65
michael@0 66 void SkScan::FillIRect(const SkIRect& r, const SkRasterClip& clip,
michael@0 67 SkBlitter* blitter) {
michael@0 68 if (clip.isEmpty() || r.isEmpty()) {
michael@0 69 return;
michael@0 70 }
michael@0 71
michael@0 72 if (clip.isBW()) {
michael@0 73 FillIRect(r, &clip.bwRgn(), blitter);
michael@0 74 return;
michael@0 75 }
michael@0 76
michael@0 77 SkAAClipBlitterWrapper wrapper(clip, blitter);
michael@0 78 FillIRect(r, &wrapper.getRgn(), wrapper.getBlitter());
michael@0 79 }
michael@0 80
michael@0 81 void SkScan::FillXRect(const SkXRect& xr, const SkRasterClip& clip,
michael@0 82 SkBlitter* blitter) {
michael@0 83 if (clip.isEmpty() || xr.isEmpty()) {
michael@0 84 return;
michael@0 85 }
michael@0 86
michael@0 87 if (clip.isBW()) {
michael@0 88 FillXRect(xr, &clip.bwRgn(), blitter);
michael@0 89 return;
michael@0 90 }
michael@0 91
michael@0 92 SkAAClipBlitterWrapper wrapper(clip, blitter);
michael@0 93 FillXRect(xr, &wrapper.getRgn(), wrapper.getBlitter());
michael@0 94 }
michael@0 95
michael@0 96 void SkScan::FillRect(const SkRect& r, const SkRasterClip& clip,
michael@0 97 SkBlitter* blitter) {
michael@0 98 if (clip.isEmpty() || r.isEmpty()) {
michael@0 99 return;
michael@0 100 }
michael@0 101
michael@0 102 if (clip.isBW()) {
michael@0 103 FillRect(r, &clip.bwRgn(), blitter);
michael@0 104 return;
michael@0 105 }
michael@0 106
michael@0 107 SkAAClipBlitterWrapper wrapper(clip, blitter);
michael@0 108 FillRect(r, &wrapper.getRgn(), wrapper.getBlitter());
michael@0 109 }

mercurial