gfx/skia/trunk/src/core/SkFilterShader.h
author George Wright <george@mozilla.com>
Mon, 28 Jul 2014 15:06:12 -0400
changeset 220765 883cd6be06d294600562435ebea87d2804bca957
parent 193135 dfba3a2480bc41639c0c4e8ef0f90e9925661b18
permissions -rw-r--r--
[PATCH 08/15] Bug 1017113 - Update Skia to 2014-07-28 r=upstream

/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkFilterShader_DEFINED
#define SkFilterShader_DEFINED

#include "SkShader.h"

class SkColorFilter;

class SkFilterShader : public SkShader {
public:
    SkFilterShader(SkShader* shader, SkColorFilter* filter);
    virtual ~SkFilterShader();

    virtual size_t contextSize() const SK_OVERRIDE;

    class FilterShaderContext : public SkShader::Context {
    public:
        // Takes ownership of shaderContext and calls its destructor.
        FilterShaderContext(const SkFilterShader&, SkShader::Context*, const ContextRec&);
        virtual ~FilterShaderContext();

        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[], int count) SK_OVERRIDE;

    private:
        SkShader::Context* fShaderContext;

        typedef SkShader::Context INHERITED;
    };

    SK_TO_STRING_OVERRIDE()
    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkFilterShader)

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


private:
    SkShader*       fShader;
    SkColorFilter*  fFilter;

    typedef SkShader INHERITED;
};

#endif