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

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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 SkBlitMask_DEFINED
     9 #define SkBlitMask_DEFINED
    11 #include "SkBitmap.h"
    12 #include "SkColor.h"
    13 #include "SkMask.h"
    15 class SkBlitMask {
    16 public:
    17     /**
    18      *  Returns true if the device config and mask format were supported.
    19      *  else return false (nothing was drawn)
    20      */
    21     static bool BlitColor(const SkBitmap& device, const SkMask& mask,
    22                           const SkIRect& clip, SkColor color);
    24     /**
    25      *  Function pointer that blits the mask into a device (dst) colorized
    26      *  by color. The number of pixels to blit is specified by width and height,
    27      *  but each scanline is offset by dstRB (rowbytes) and srcRB respectively.
    28      */
    29     typedef void (*ColorProc)(void* dst, size_t dstRB,
    30                               const void* mask, size_t maskRB,
    31                               SkColor color, int width, int height);
    33     /**
    34      *  Function pointer that blits a row of mask(lcd16) into a row of dst
    35      *  colorized by a single color. The number of pixels to blit is specified
    36      *  by width.
    37      */
    38     typedef void (*BlitLCD16RowProc)(SkPMColor dst[], const uint16_t src[],
    39                                      SkColor color, int width,
    40                                      SkPMColor opaqueDst);
    42     /**
    43      *  Function pointer that blits a row of src colors through a row of a mask
    44      *  onto a row of dst colors. The RowFactory that returns this function ptr
    45      *  will have been told the formats for the mask and the dst.
    46      */
    47     typedef void (*RowProc)(void* dst, const void* mask,
    48                             const SkPMColor* src, int width);
    50     /**
    51      *  Public entry-point to return a blitmask ColorProc.
    52      *  May return NULL if config or format are not supported.
    53      */
    54     static ColorProc ColorFactory(SkBitmap::Config, SkMask::Format, SkColor);
    56     /**
    57      *  Return either platform specific optimized blitmask ColorProc,
    58      *  or NULL if no optimized routine is available.
    59      */
    60     static ColorProc PlatformColorProcs(SkBitmap::Config, SkMask::Format, SkColor);
    62     /**
    63      *  Public entry-point to return a blitcolor BlitLCD16RowProc.
    64      */
    65     static BlitLCD16RowProc BlitLCD16RowFactory(bool isOpaque);
    67     /**
    68      *  Return either platform specific optimized blitcolor BlitLCD16RowProc,
    69      *  or NULL if no optimized routine is available.
    70      */
    71     static BlitLCD16RowProc PlatformBlitRowProcs16(bool isOpaque);
    73     enum RowFlags {
    74         kSrcIsOpaque_RowFlag    = 1 << 0
    75     };
    77     /**
    78      *  Public entry-point to return a blitmask RowProc.
    79      *  May return NULL if config or format are not supported.
    80      */
    81     static RowProc RowFactory(SkBitmap::Config, SkMask::Format, RowFlags);
    83     /**
    84      *  Return either platform specific optimized blitmask RowProc,
    85      *  or NULL if no optimized routine is available.
    86      */
    87     static RowProc PlatformRowProcs(SkBitmap::Config, SkMask::Format, RowFlags);
    88 };
    90 #endif

mercurial