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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/core/SkBlitMask.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,90 @@
     1.4 +/*
     1.5 + * Copyright 2011 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef SkBlitMask_DEFINED
    1.12 +#define SkBlitMask_DEFINED
    1.13 +
    1.14 +#include "SkBitmap.h"
    1.15 +#include "SkColor.h"
    1.16 +#include "SkMask.h"
    1.17 +
    1.18 +class SkBlitMask {
    1.19 +public:
    1.20 +    /**
    1.21 +     *  Returns true if the device config and mask format were supported.
    1.22 +     *  else return false (nothing was drawn)
    1.23 +     */
    1.24 +    static bool BlitColor(const SkBitmap& device, const SkMask& mask,
    1.25 +                          const SkIRect& clip, SkColor color);
    1.26 +
    1.27 +    /**
    1.28 +     *  Function pointer that blits the mask into a device (dst) colorized
    1.29 +     *  by color. The number of pixels to blit is specified by width and height,
    1.30 +     *  but each scanline is offset by dstRB (rowbytes) and srcRB respectively.
    1.31 +     */
    1.32 +    typedef void (*ColorProc)(void* dst, size_t dstRB,
    1.33 +                              const void* mask, size_t maskRB,
    1.34 +                              SkColor color, int width, int height);
    1.35 +
    1.36 +    /**
    1.37 +     *  Function pointer that blits a row of mask(lcd16) into a row of dst
    1.38 +     *  colorized by a single color. The number of pixels to blit is specified
    1.39 +     *  by width.
    1.40 +     */
    1.41 +    typedef void (*BlitLCD16RowProc)(SkPMColor dst[], const uint16_t src[],
    1.42 +                                     SkColor color, int width,
    1.43 +                                     SkPMColor opaqueDst);
    1.44 +
    1.45 +    /**
    1.46 +     *  Function pointer that blits a row of src colors through a row of a mask
    1.47 +     *  onto a row of dst colors. The RowFactory that returns this function ptr
    1.48 +     *  will have been told the formats for the mask and the dst.
    1.49 +     */
    1.50 +    typedef void (*RowProc)(void* dst, const void* mask,
    1.51 +                            const SkPMColor* src, int width);
    1.52 +
    1.53 +    /**
    1.54 +     *  Public entry-point to return a blitmask ColorProc.
    1.55 +     *  May return NULL if config or format are not supported.
    1.56 +     */
    1.57 +    static ColorProc ColorFactory(SkBitmap::Config, SkMask::Format, SkColor);
    1.58 +
    1.59 +    /**
    1.60 +     *  Return either platform specific optimized blitmask ColorProc,
    1.61 +     *  or NULL if no optimized routine is available.
    1.62 +     */
    1.63 +    static ColorProc PlatformColorProcs(SkBitmap::Config, SkMask::Format, SkColor);
    1.64 +
    1.65 +    /**
    1.66 +     *  Public entry-point to return a blitcolor BlitLCD16RowProc.
    1.67 +     */
    1.68 +    static BlitLCD16RowProc BlitLCD16RowFactory(bool isOpaque);
    1.69 +
    1.70 +    /**
    1.71 +     *  Return either platform specific optimized blitcolor BlitLCD16RowProc,
    1.72 +     *  or NULL if no optimized routine is available.
    1.73 +     */
    1.74 +    static BlitLCD16RowProc PlatformBlitRowProcs16(bool isOpaque);
    1.75 +
    1.76 +    enum RowFlags {
    1.77 +        kSrcIsOpaque_RowFlag    = 1 << 0
    1.78 +    };
    1.79 +
    1.80 +    /**
    1.81 +     *  Public entry-point to return a blitmask RowProc.
    1.82 +     *  May return NULL if config or format are not supported.
    1.83 +     */
    1.84 +    static RowProc RowFactory(SkBitmap::Config, SkMask::Format, RowFlags);
    1.85 +
    1.86 +    /**
    1.87 +     *  Return either platform specific optimized blitmask RowProc,
    1.88 +     *  or NULL if no optimized routine is available.
    1.89 +     */
    1.90 +    static RowProc PlatformRowProcs(SkBitmap::Config, SkMask::Format, RowFlags);
    1.91 +};
    1.92 +
    1.93 +#endif

mercurial