2013-05-21 21:33:11 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2013 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkLerpXfermode_DEFINED
|
|
|
|
#define SkLerpXfermode_DEFINED
|
|
|
|
|
|
|
|
#include "SkXfermode.h"
|
|
|
|
|
|
|
|
class SK_API SkLerpXfermode : public SkXfermode {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* result = scale * src + (1 - scale) * dst
|
|
|
|
*
|
|
|
|
* When scale == 1, this is the same as kSrc_Mode
|
|
|
|
* When scale == 0, this is the same as kDst_Mode
|
|
|
|
*/
|
|
|
|
static SkXfermode* Create(SkScalar scale);
|
|
|
|
|
|
|
|
// overrides from SkXfermode
|
|
|
|
virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
|
2015-03-26 01:17:31 +00:00
|
|
|
const SkAlpha aa[]) const override;
|
2013-05-21 21:33:11 +00:00
|
|
|
virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
|
2015-03-26 01:17:31 +00:00
|
|
|
const SkAlpha aa[]) const override;
|
2013-05-21 21:33:11 +00:00
|
|
|
virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
|
2015-03-26 01:17:31 +00:00
|
|
|
const SkAlpha aa[]) const override;
|
2013-05-21 21:33:11 +00:00
|
|
|
|
2014-03-13 18:02:17 +00:00
|
|
|
SK_TO_STRING_OVERRIDE()
|
2013-05-21 21:33:11 +00:00
|
|
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLerpXfermode)
|
|
|
|
|
|
|
|
protected:
|
2015-03-26 01:17:31 +00:00
|
|
|
void flatten(SkWriteBuffer&) const override;
|
2013-05-21 21:33:11 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SkLerpXfermode(unsigned scale256);
|
|
|
|
|
|
|
|
unsigned fScale256; // 0..256
|
|
|
|
|
|
|
|
typedef SkXfermode INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|