blob: 6140259e6ec151311d98868f81a1d4fc7b9b167d [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;
reed@android.com8a1c16f2008-12-17 15:59:43 +000022 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&);
23 virtual uint32_t getFlags() { return fFlags; }
24 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count);
25 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count);
26 virtual void beginSession();
27 virtual void endSession();
reed@google.com7c2f27d2011-03-07 19:29:00 +000028 virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*,
29 SkScalar* twoPointRadialParams) const;
reed@android.com8a1c16f2008-12-17 15:59:43 +000030
31 static bool CanDo(const SkBitmap&, TileMode tx, TileMode ty);
32
reed@android.com8a1c16f2008-12-17 15:59:43 +000033 // override from flattenable
34 virtual bool toDumpString(SkString* str) const;
djsollen@google.comba28d032012-03-26 17:57:35 +000035 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader)
reed@android.com8a1c16f2008-12-17 15:59:43 +000036
37protected:
38 SkBitmapProcShader(SkFlattenableReadBuffer& );
39 virtual void flatten(SkFlattenableWriteBuffer& );
reed@android.com8a1c16f2008-12-17 15:59:43 +000040
41 SkBitmap fRawBitmap; // experimental for RLE encoding
42 SkBitmapProcState fState;
43 uint32_t fFlags;
44
reed@google.com7c2f27d2011-03-07 19:29:00 +000045private:
reed@android.com8a1c16f2008-12-17 15:59:43 +000046 typedef SkShader INHERITED;
47};
48
49#endif