Sat, 03 Jan 2015 20:18:00 +0100
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.
1 /*
2 * Copyright 2010 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
8 #ifndef GrGlyph_DEFINED
9 #define GrGlyph_DEFINED
11 #include "GrRect.h"
12 #include "SkPath.h"
14 class GrPlot;
16 /* Need this to be quad-state:
17 - complete w/ image
18 - just metrics
19 - failed to get image, but has metrics
20 - failed to get metrics
21 */
22 struct GrGlyph {
23 typedef uint32_t PackedID;
25 GrPlot* fPlot;
26 SkPath* fPath;
27 PackedID fPackedID;
28 GrIRect16 fBounds;
29 GrIPoint16 fAtlasLocation;
31 void init(GrGlyph::PackedID packed, const SkIRect& bounds) {
32 fPlot = NULL;
33 fPath = NULL;
34 fPackedID = packed;
35 fBounds.set(bounds);
36 fAtlasLocation.set(0, 0);
37 }
39 void free() {
40 if (fPath) {
41 delete fPath;
42 fPath = NULL;
43 }
44 }
46 int width() const { return fBounds.width(); }
47 int height() const { return fBounds.height(); }
48 bool isEmpty() const { return fBounds.isEmpty(); }
49 uint16_t glyphID() const { return UnpackID(fPackedID); }
51 ///////////////////////////////////////////////////////////////////////////
53 static inline unsigned ExtractSubPixelBitsFromFixed(GrFixed pos) {
54 // two most significant fraction bits from fixed-point
55 return (pos >> 14) & 3;
56 }
58 static inline PackedID Pack(uint16_t glyphID, GrFixed x, GrFixed y) {
59 x = ExtractSubPixelBitsFromFixed(x);
60 y = ExtractSubPixelBitsFromFixed(y);
61 return (x << 18) | (y << 16) | glyphID;
62 }
64 static inline GrFixed UnpackFixedX(PackedID packed) {
65 return ((packed >> 18) & 3) << 14;
66 }
68 static inline GrFixed UnpackFixedY(PackedID packed) {
69 return ((packed >> 16) & 3) << 14;
70 }
72 static inline uint16_t UnpackID(PackedID packed) {
73 return (uint16_t)packed;
74 }
75 };
78 #endif