blob: 794dcd16e498e8948a1065ba6e29bb31bdc8361a [file] [log] [blame]
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkMaskSwizzler_DEFINED
#define SkMaskSwizzler_DEFINED
#include "SkMasks.h"
#include "SkSwizzler.h"
#include "SkTypes.h"
/*
*
* Used to swizzle images whose pixel components are extracted by bit masks
* Currently only used by bmp
*
*/
class SkMaskSwizzler {
public:
/*
* Create a new swizzler
* @param masks Unowned pointer to helper class
*/
static SkMaskSwizzler* CreateMaskSwizzler(const SkImageInfo& dstInfo,
const SkImageInfo& srcInfo,
SkMasks* masks,
uint32_t bitsPerPixel);
/*
* Swizzle a row
*/
SkSwizzler::ResultAlpha swizzle(void* dst, const uint8_t* SK_RESTRICT src);
private:
/*
* Row procedure used for swizzle
*/
typedef SkSwizzler::ResultAlpha (*RowProc)(
void* dstRow, const uint8_t* srcRow, int width,
SkMasks* masks, uint32_t startX, uint32_t sampleX);
/*
* Constructor for mask swizzler
*/
SkMaskSwizzler(const SkImageInfo& info, SkMasks* masks, RowProc proc,
uint32_t sampleX);
// Fields
const SkImageInfo& fDstInfo;
SkMasks* fMasks; // unowned
const RowProc fRowProc;
const uint32_t fSampleX;
const uint32_t fStartX;
};
#endif