gfx/skia/trunk/src/core/SkScan.h

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 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 #ifndef SkScan_DEFINED
michael@0 11 #define SkScan_DEFINED
michael@0 12
michael@0 13 #include "SkRect.h"
michael@0 14
michael@0 15 class SkRasterClip;
michael@0 16 class SkRegion;
michael@0 17 class SkBlitter;
michael@0 18 class SkPath;
michael@0 19
michael@0 20 /** Defines a fixed-point rectangle, identical to the integer SkIRect, but its
michael@0 21 coordinates are treated as SkFixed rather than int32_t.
michael@0 22 */
michael@0 23 typedef SkIRect SkXRect;
michael@0 24
michael@0 25 class SkScan {
michael@0 26 public:
michael@0 27 static void FillPath(const SkPath&, const SkIRect&, SkBlitter*);
michael@0 28
michael@0 29 ///////////////////////////////////////////////////////////////////////////
michael@0 30 // rasterclip
michael@0 31
michael@0 32 static void FillIRect(const SkIRect&, const SkRasterClip&, SkBlitter*);
michael@0 33 static void FillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*);
michael@0 34 static void FillRect(const SkRect&, const SkRasterClip&, SkBlitter*);
michael@0 35 static void AntiFillRect(const SkRect&, const SkRasterClip&, SkBlitter*);
michael@0 36 static void AntiFillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*);
michael@0 37 static void FillPath(const SkPath&, const SkRasterClip&, SkBlitter*);
michael@0 38 static void AntiFillPath(const SkPath&, const SkRasterClip&, SkBlitter*);
michael@0 39 static void FrameRect(const SkRect&, const SkPoint& strokeSize,
michael@0 40 const SkRasterClip&, SkBlitter*);
michael@0 41 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize,
michael@0 42 const SkRasterClip&, SkBlitter*);
michael@0 43 static void FillTriangle(const SkPoint pts[], const SkRasterClip&, SkBlitter*);
michael@0 44 static void HairLine(const SkPoint&, const SkPoint&, const SkRasterClip&,
michael@0 45 SkBlitter*);
michael@0 46 static void AntiHairLine(const SkPoint&, const SkPoint&, const SkRasterClip&,
michael@0 47 SkBlitter*);
michael@0 48 static void HairRect(const SkRect&, const SkRasterClip&, SkBlitter*);
michael@0 49 static void AntiHairRect(const SkRect&, const SkRasterClip&, SkBlitter*);
michael@0 50 static void HairPath(const SkPath&, const SkRasterClip&, SkBlitter*);
michael@0 51 static void AntiHairPath(const SkPath&, const SkRasterClip&, SkBlitter*);
michael@0 52
michael@0 53 private:
michael@0 54 friend class SkAAClip;
michael@0 55 friend class SkRegion;
michael@0 56
michael@0 57 static void FillIRect(const SkIRect&, const SkRegion* clip, SkBlitter*);
michael@0 58 static void FillXRect(const SkXRect&, const SkRegion* clip, SkBlitter*);
michael@0 59 static void FillRect(const SkRect&, const SkRegion* clip, SkBlitter*);
michael@0 60 static void AntiFillRect(const SkRect&, const SkRegion* clip, SkBlitter*);
michael@0 61 static void AntiFillXRect(const SkXRect&, const SkRegion*, SkBlitter*);
michael@0 62 static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*);
michael@0 63 static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*,
michael@0 64 bool forceRLE = false);
michael@0 65 static void FillTriangle(const SkPoint pts[], const SkRegion*, SkBlitter*);
michael@0 66
michael@0 67 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize,
michael@0 68 const SkRegion*, SkBlitter*);
michael@0 69 static void HairLineRgn(const SkPoint&, const SkPoint&, const SkRegion*,
michael@0 70 SkBlitter*);
michael@0 71 static void AntiHairLineRgn(const SkPoint&, const SkPoint&, const SkRegion*,
michael@0 72 SkBlitter*);
michael@0 73 };
michael@0 74
michael@0 75 /** Assign an SkXRect from a SkIRect, by promoting the src rect's coordinates
michael@0 76 from int to SkFixed. Does not check for overflow if the src coordinates
michael@0 77 exceed 32K
michael@0 78 */
michael@0 79 static inline void XRect_set(SkXRect* xr, const SkIRect& src) {
michael@0 80 xr->fLeft = SkIntToFixed(src.fLeft);
michael@0 81 xr->fTop = SkIntToFixed(src.fTop);
michael@0 82 xr->fRight = SkIntToFixed(src.fRight);
michael@0 83 xr->fBottom = SkIntToFixed(src.fBottom);
michael@0 84 }
michael@0 85
michael@0 86 /** Assign an SkXRect from a SkRect, by promoting the src rect's coordinates
michael@0 87 from SkScalar to SkFixed. Does not check for overflow if the src coordinates
michael@0 88 exceed 32K
michael@0 89 */
michael@0 90 static inline void XRect_set(SkXRect* xr, const SkRect& src) {
michael@0 91 xr->fLeft = SkScalarToFixed(src.fLeft);
michael@0 92 xr->fTop = SkScalarToFixed(src.fTop);
michael@0 93 xr->fRight = SkScalarToFixed(src.fRight);
michael@0 94 xr->fBottom = SkScalarToFixed(src.fBottom);
michael@0 95 }
michael@0 96
michael@0 97 /** Round the SkXRect coordinates, and store the result in the SkIRect.
michael@0 98 */
michael@0 99 static inline void XRect_round(const SkXRect& xr, SkIRect* dst) {
michael@0 100 dst->fLeft = SkFixedRoundToInt(xr.fLeft);
michael@0 101 dst->fTop = SkFixedRoundToInt(xr.fTop);
michael@0 102 dst->fRight = SkFixedRoundToInt(xr.fRight);
michael@0 103 dst->fBottom = SkFixedRoundToInt(xr.fBottom);
michael@0 104 }
michael@0 105
michael@0 106 /** Round the SkXRect coordinates out (i.e. use floor for left/top, and ceiling
michael@0 107 for right/bottom), and store the result in the SkIRect.
michael@0 108 */
michael@0 109 static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) {
michael@0 110 dst->fLeft = SkFixedFloorToInt(xr.fLeft);
michael@0 111 dst->fTop = SkFixedFloorToInt(xr.fTop);
michael@0 112 dst->fRight = SkFixedCeilToInt(xr.fRight);
michael@0 113 dst->fBottom = SkFixedCeilToInt(xr.fBottom);
michael@0 114 }
michael@0 115
michael@0 116 #endif

mercurial