blob: 74187f791225f4617e69c35853bd1714436172d7 [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
17 virtual uint32_t getFlags() SK_OVERRIDE;
tfarina@chromium.org6806fe82012-10-12 14:41:39 +000018 virtual bool setContext(const SkBitmap& device,
19 const SkPaint& paint,
20 const SkMatrix& matrix) SK_OVERRIDE;
reed@google.com7716afb2011-12-07 15:17:50 +000021 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
22 virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000023
djsollen@google.comba28d032012-03-26 17:57:35 +000024 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader)
reed@google.com7716afb2011-12-07 15:17:50 +000025
reed@android.com8a1c16f2008-12-17 15:59:43 +000026private:
27 // these are a cache from the call to setContext()
28 const SkBitmap* fDevice;
29 uint8_t fAlpha;
30
31 SkTransparentShader(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
rmistry@google.comfbfcd562012-08-23 18:09:54 +000032
reed@android.com8a1c16f2008-12-17 15:59:43 +000033 typedef SkShader INHERITED;
34};
35
36#endif