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.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 2013 Google Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | * found in the LICENSE file. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef SkMatrixUtils_DEFINED |
michael@0 | 9 | #define SkMatrixUtils_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | #include "SkMatrix.h" |
michael@0 | 12 | |
michael@0 | 13 | /** |
michael@0 | 14 | * Number of subpixel bits used in skia's bilerp. |
michael@0 | 15 | * See SkBitmapProcState_procs.h and SkBitmapProcState_filter.h |
michael@0 | 16 | */ |
michael@0 | 17 | #define kSkSubPixelBitsForBilerp 4 |
michael@0 | 18 | |
michael@0 | 19 | /** |
michael@0 | 20 | * Given a matrix and width/height, return true if the computed dst-rect would |
michael@0 | 21 | * align such that there is a 1-to-1 coorspondence between src and dst pixels. |
michael@0 | 22 | * This can be called by drawing code to see if drawBitmap can be turned into |
michael@0 | 23 | * drawSprite (which is faster). |
michael@0 | 24 | * |
michael@0 | 25 | * The src-rect is defined to be { 0, 0, width, height } |
michael@0 | 26 | * |
michael@0 | 27 | * The "closeness" test is based on the subpixelBits parameter. Pass 0 for |
michael@0 | 28 | * round-to-nearest behavior (e.g. nearest neighbor sampling). Pass the number |
michael@0 | 29 | * of subpixel-bits to simulate filtering. |
michael@0 | 30 | */ |
michael@0 | 31 | bool SkTreatAsSprite(const SkMatrix&, int width, int height, |
michael@0 | 32 | unsigned subpixelBits); |
michael@0 | 33 | |
michael@0 | 34 | /** |
michael@0 | 35 | * Calls SkTreatAsSprite() with default subpixelBits value to match Skia's |
michael@0 | 36 | * filter-bitmap implementation (i.e. kSkSubPixelBitsForBilerp). |
michael@0 | 37 | */ |
michael@0 | 38 | static inline bool SkTreatAsSpriteFilter(const SkMatrix& matrix, |
michael@0 | 39 | int width, int height) { |
michael@0 | 40 | return SkTreatAsSprite(matrix, width, height, kSkSubPixelBitsForBilerp); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | /** Decomposes the upper-left 2x2 of the matrix into a rotation (represented by |
michael@0 | 44 | the cosine and sine of the rotation angle), followed by a non-uniform scale, |
michael@0 | 45 | followed by another rotation. If there is a reflection, one of the scale |
michael@0 | 46 | factors will be negative. |
michael@0 | 47 | Returns true if successful. Returns false if the matrix is degenerate. |
michael@0 | 48 | */ |
michael@0 | 49 | bool SkDecomposeUpper2x2(const SkMatrix& matrix, |
michael@0 | 50 | SkPoint* rotation1, |
michael@0 | 51 | SkPoint* scale, |
michael@0 | 52 | SkPoint* rotation2); |
michael@0 | 53 | |
michael@0 | 54 | #endif |