SkTransparentShader.h revision ba28d03e94dc221d6a803bf2a84a420b9159255c
1
2/*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10#ifndef SkTransparentShader_DEFINED
11#define SkTransparentShader_DEFINED
12
13#include "SkShader.h"
14
15class SkTransparentShader : public SkShader {
16public:
17    SkTransparentShader() {}
18
19    virtual uint32_t getFlags() SK_OVERRIDE;
20    virtual bool    setContext( const SkBitmap& device,
21                                const SkPaint& paint,
22                                const SkMatrix& matrix) SK_OVERRIDE;
23    virtual void    shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
24    virtual void    shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
25
26    // overrides for SkFlattenable
27    virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
28    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader)
29
30private:
31    // these are a cache from the call to setContext()
32    const SkBitmap* fDevice;
33    uint8_t         fAlpha;
34
35    SkTransparentShader(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
36
37    typedef SkShader INHERITED;
38};
39
40#endif
41
42