2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SkTransparentShader_DEFINED
|
|
|
|
#define SkTransparentShader_DEFINED
|
|
|
|
|
|
|
|
#include "SkShader.h"
|
|
|
|
|
|
|
|
class SkTransparentShader : public SkShader {
|
|
|
|
public:
|
|
|
|
SkTransparentShader() {}
|
2011-12-07 15:17:50 +00:00
|
|
|
|
|
|
|
virtual uint32_t getFlags() SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
virtual bool setContext( const SkBitmap& device,
|
|
|
|
const SkPaint& paint,
|
2011-12-07 15:17:50 +00:00
|
|
|
const SkMatrix& matrix) SK_OVERRIDE;
|
|
|
|
virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
|
|
|
|
virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
// overrides for SkFlattenable
|
2011-12-07 15:17:50 +00:00
|
|
|
virtual Factory getFactory() SK_OVERRIDE;
|
|
|
|
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
private:
|
|
|
|
// these are a cache from the call to setContext()
|
|
|
|
const SkBitmap* fDevice;
|
|
|
|
uint8_t fAlpha;
|
|
|
|
|
|
|
|
SkTransparentShader(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
|
|
|
|
|
2011-04-20 11:17:30 +00:00
|
|
|
static SkFlattenable* Create(SkFlattenableReadBuffer& buffer) {
|
2008-12-17 15:59:43 +00:00
|
|
|
return SkNEW_ARGS(SkTransparentShader, (buffer));
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef SkShader INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|