gfx/skia/trunk/include/core/SkBlitRow.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.

     1 /*
     2  * Copyright 2011 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 SkBlitRow_DEFINED
     9 #define SkBlitRow_DEFINED
    11 #include "SkBitmap.h"
    12 #include "SkColor.h"
    14 class SkBlitRow {
    15 public:
    16     enum Flags16 {
    17         //! If set, the alpha parameter will be != 255
    18         kGlobalAlpha_Flag   = 0x01,
    19         //! If set, the src colors may have alpha != 255
    20         kSrcPixelAlpha_Flag = 0x02,
    21         //! If set, the resulting 16bit colors should be dithered
    22         kDither_Flag        = 0x04
    23     };
    25     /** Function pointer that reads a scanline of src SkPMColors, and writes
    26         a corresponding scanline of 16bit colors (specific format based on the
    27         config passed to the Factory.
    29         The x,y params are useful just for dithering
    31         @param alpha A global alpha to be applied to all of the src colors
    32         @param x The x coordinate of the beginning of the scanline
    33         @param y THe y coordinate of the scanline
    34      */
    35     typedef void (*Proc)(uint16_t* dst,
    36                          const SkPMColor* src,
    37                          int count, U8CPU alpha, int x, int y);
    39     static Proc Factory(unsigned flags, SkBitmap::Config);
    41     ///////////// D32 version
    43     enum Flags32 {
    44         kGlobalAlpha_Flag32     = 1 << 0,
    45         kSrcPixelAlpha_Flag32   = 1 << 1
    46     };
    48     /** Function pointer that blends 32bit colors onto a 32bit destination.
    49         @param dst  array of dst 32bit colors
    50         @param src  array of src 32bit colors (w/ or w/o alpha)
    51         @param count number of colors to blend
    52         @param alpha global alpha to be applied to all src colors
    53      */
    54     typedef void (*Proc32)(uint32_t* dst,
    55                          const SkPMColor* src,
    56                          int count, U8CPU alpha);
    58     static Proc32 Factory32(unsigned flags32);
    60    /** Function pointer that blends a single color with a row of 32-bit colors
    61        onto a 32-bit destination
    62    */
    63    typedef void (*ColorProc)(SkPMColor* dst, const SkPMColor* src, int count,
    64                              SkPMColor color);
    66     /** Blend a single color onto a row of S32 pixels, writing the result
    67         into a row of D32 pixels. src and dst may be the same memory, but
    68         if they are not, they may not overlap.
    69      */
    70     static void Color32(SkPMColor dst[], const SkPMColor src[],
    71                         int count, SkPMColor color);
    73     //! Public entry-point to return a blit function ptr
    74     static ColorProc ColorProcFactory();
    76     /** Function pointer that blends a single color onto a 32-bit rectangle.  */
    77     typedef void (*ColorRectProc)(SkPMColor* dst, int width, int height,
    78                                   size_t rowBytes, SkPMColor color);
    80     /** Blend a single color into a rectangle of D32 pixels. */
    81     static void ColorRect32(SkPMColor* dst, int width, int height,
    82                             size_t rowBytes, SkPMColor color);
    84     //! Public entry-point to return a blit function ptr
    85     static ColorRectProc ColorRectProcFactory();
    87     /** These static functions are called by the Factory and Factory32
    88         functions, and should return either NULL, or a
    89         platform-specific function-ptr to be used in place of the
    90         system default.
    91      */
    93     static Proc32 PlatformProcs32(unsigned flags);
    94     static Proc PlatformProcs565(unsigned flags);
    95     static ColorProc PlatformColorProc();
    97 private:
    98     enum {
    99         kFlags16_Mask = 7,
   100         kFlags32_Mask = 3
   101     };
   102 };
   104 #endif

mercurial