aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkTransparentShader.h
blob: d9a3e5d7a1975523e3b8ac317979d571f57d2486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkTransparentShader_DEFINED
#define SkTransparentShader_DEFINED

#include "SkShader.h"

class SK_API SkTransparentShader : public SkShader {
public:
    SkTransparentShader() {}

    virtual size_t contextSize() const SK_OVERRIDE;

    class TransparentShaderContext : public SkShader::Context {
    public:
        TransparentShaderContext(const SkTransparentShader& shader, const ContextRec&);
        virtual ~TransparentShaderContext();

        virtual uint32_t getFlags() const 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;

    private:
        const SkBitmap* fDevice;

        typedef SkShader::Context INHERITED;
    };

    SK_TO_STRING_OVERRIDE()
    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader)

protected:
    virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE;

private:
    SkTransparentShader(SkReadBuffer& buffer) : INHERITED(buffer) {}

    typedef SkShader INHERITED;
};

#endif