michael@0: /* michael@0: * Copyright 2011 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkBlitMask_DEFINED michael@0: #define SkBlitMask_DEFINED michael@0: michael@0: #include "SkBitmap.h" michael@0: #include "SkColor.h" michael@0: #include "SkMask.h" michael@0: michael@0: class SkBlitMask { michael@0: public: michael@0: /** michael@0: * Returns true if the device config and mask format were supported. michael@0: * else return false (nothing was drawn) michael@0: */ michael@0: static bool BlitColor(const SkBitmap& device, const SkMask& mask, michael@0: const SkIRect& clip, SkColor color); michael@0: michael@0: /** michael@0: * Function pointer that blits the mask into a device (dst) colorized michael@0: * by color. The number of pixels to blit is specified by width and height, michael@0: * but each scanline is offset by dstRB (rowbytes) and srcRB respectively. michael@0: */ michael@0: typedef void (*ColorProc)(void* dst, size_t dstRB, michael@0: const void* mask, size_t maskRB, michael@0: SkColor color, int width, int height); michael@0: michael@0: /** michael@0: * Function pointer that blits a row of mask(lcd16) into a row of dst michael@0: * colorized by a single color. The number of pixels to blit is specified michael@0: * by width. michael@0: */ michael@0: typedef void (*BlitLCD16RowProc)(SkPMColor dst[], const uint16_t src[], michael@0: SkColor color, int width, michael@0: SkPMColor opaqueDst); michael@0: michael@0: /** michael@0: * Function pointer that blits a row of src colors through a row of a mask michael@0: * onto a row of dst colors. The RowFactory that returns this function ptr michael@0: * will have been told the formats for the mask and the dst. michael@0: */ michael@0: typedef void (*RowProc)(void* dst, const void* mask, michael@0: const SkPMColor* src, int width); michael@0: michael@0: /** michael@0: * Public entry-point to return a blitmask ColorProc. michael@0: * May return NULL if config or format are not supported. michael@0: */ michael@0: static ColorProc ColorFactory(SkBitmap::Config, SkMask::Format, SkColor); michael@0: michael@0: /** michael@0: * Return either platform specific optimized blitmask ColorProc, michael@0: * or NULL if no optimized routine is available. michael@0: */ michael@0: static ColorProc PlatformColorProcs(SkBitmap::Config, SkMask::Format, SkColor); michael@0: michael@0: /** michael@0: * Public entry-point to return a blitcolor BlitLCD16RowProc. michael@0: */ michael@0: static BlitLCD16RowProc BlitLCD16RowFactory(bool isOpaque); michael@0: michael@0: /** michael@0: * Return either platform specific optimized blitcolor BlitLCD16RowProc, michael@0: * or NULL if no optimized routine is available. michael@0: */ michael@0: static BlitLCD16RowProc PlatformBlitRowProcs16(bool isOpaque); michael@0: michael@0: enum RowFlags { michael@0: kSrcIsOpaque_RowFlag = 1 << 0 michael@0: }; michael@0: michael@0: /** michael@0: * Public entry-point to return a blitmask RowProc. michael@0: * May return NULL if config or format are not supported. michael@0: */ michael@0: static RowProc RowFactory(SkBitmap::Config, SkMask::Format, RowFlags); michael@0: michael@0: /** michael@0: * Return either platform specific optimized blitmask RowProc, michael@0: * or NULL if no optimized routine is available. michael@0: */ michael@0: static RowProc PlatformRowProcs(SkBitmap::Config, SkMask::Format, RowFlags); michael@0: }; michael@0: michael@0: #endif