blob: d9a3e5d7a1975523e3b8ac317979d571f57d2486 [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00003 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00004 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00006 */
7
8#ifndef SkTransparentShader_DEFINED
9#define SkTransparentShader_DEFINED
10
11#include "SkShader.h"
12
tfarina@chromium.org6806fe82012-10-12 14:41:39 +000013class SK_API SkTransparentShader : public SkShader {
reed@android.com8a1c16f2008-12-17 15:59:43 +000014public:
15 SkTransparentShader() {}
reed@google.com7716afb2011-12-07 15:17:50 +000016
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000017 virtual size_t contextSize() const SK_OVERRIDE;
18
19 class TransparentShaderContext : public SkShader::Context {
20 public:
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +000021 TransparentShaderContext(const SkTransparentShader& shader, const ContextRec&);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000022 virtual ~TransparentShaderContext();
23
24 virtual uint32_t getFlags() const SK_OVERRIDE;
25 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
26 virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
27
28 private:
29 const SkBitmap* fDevice;
30
31 typedef SkShader::Context INHERITED;
32 };
reed@android.com8a1c16f2008-12-17 15:59:43 +000033
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +000034 SK_TO_STRING_OVERRIDE()
djsollen@google.comba28d032012-03-26 17:57:35 +000035 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader)
reed@google.com7716afb2011-12-07 15:17:50 +000036
commit-bot@chromium.orgce56d962014-05-05 18:39:18 +000037protected:
38 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE;
39
reed@android.com8a1c16f2008-12-17 15:59:43 +000040private:
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000041 SkTransparentShader(SkReadBuffer& buffer) : INHERITED(buffer) {}
rmistry@google.comfbfcd562012-08-23 18:09:54 +000042
reed@android.com8a1c16f2008-12-17 15:59:43 +000043 typedef SkShader INHERITED;
44};
45
46#endif