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.

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

mercurial