blob: b7e60f1ca1075e2413e791ced221e1b9de3b3110 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#ifndef SkBitmapProcShader_DEFINED
11#define SkBitmapProcShader_DEFINED
12
13#include "SkShader.h"
14#include "SkBitmapProcState.h"
15
16class SkBitmapProcShader : public SkShader {
17public:
18 SkBitmapProcShader(const SkBitmap& src, TileMode tx, TileMode ty);
19
20 // overrides from SkShader
junov@chromium.orgb6e16192011-12-09 15:48:03 +000021 virtual bool isOpaque() const SK_OVERRIDE;
robertphillips@google.com76f9e932013-01-15 20:17:47 +000022 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK_OVERRIDE;
23 virtual void endContext() SK_OVERRIDE;
24 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; }
25 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
reed@google.com3bafe742012-10-12 18:56:18 +000026 virtual ShadeProc asAShadeProc(void** ctx) SK_OVERRIDE;
robertphillips@google.com76f9e932013-01-15 20:17:47 +000027 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE;
28 virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000029
30 static bool CanDo(const SkBitmap&, TileMode tx, TileMode ty);
skia.committer@gmail.comff21c2e2013-01-16 07:05:56 +000031
robertphillips@google.com76f9e932013-01-15 20:17:47 +000032 SK_DEVELOPER_TO_STRING()
djsollen@google.comba28d032012-03-26 17:57:35 +000033 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader)
reed@android.com8a1c16f2008-12-17 15:59:43 +000034
bsalomon@google.come197cbf2013-01-14 16:46:26 +000035#if SK_SUPPORT_GPU
bsalomon@google.com0ac6af42013-01-16 15:16:18 +000036 GrEffectRef* asNewEffect(GrContext*, const SkPaint&) const SK_OVERRIDE;
bsalomon@google.come197cbf2013-01-14 16:46:26 +000037#endif
38
reed@android.com8a1c16f2008-12-17 15:59:43 +000039protected:
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000040 SkBitmapProcShader(SkReadBuffer& );
41 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000042
43 SkBitmap fRawBitmap; // experimental for RLE encoding
44 SkBitmapProcState fState;
45 uint32_t fFlags;
46
reed@google.com7c2f27d2011-03-07 19:29:00 +000047private:
reed@android.com8a1c16f2008-12-17 15:59:43 +000048 typedef SkShader INHERITED;
49};
50
51#endif