| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2014 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkPictureShader_DEFINED | |
| 9 #define SkPictureShader_DEFINED | |
| 10 | |
| 11 #include "SkShader.h" | |
| 12 | |
| 13 class SkBitmap; | |
| 14 class SkPicture; | |
| 15 | |
| 16 /* | |
| 17 * An SkPictureShader can be used to draw SkPicture-based patterns. | |
| 18 * | |
| 19 * The SkPicture is first rendered into a tile, which is then used to shade the
area according | |
| 20 * to specified tiling rules. | |
| 21 */ | |
| 22 class SkPictureShader : public SkShader { | |
| 23 public: | |
| 24 static SkPictureShader* Create(SkPicture*, TileMode, TileMode); | |
| 25 virtual ~SkPictureShader(); | |
| 26 | |
| 27 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK
_OVERRIDE; | |
| 28 virtual void endContext() SK_OVERRIDE; | |
| 29 virtual uint32_t getFlags() SK_OVERRIDE; | |
| 30 | |
| 31 virtual ShadeProc asAShadeProc(void** ctx) SK_OVERRIDE; | |
| 32 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRID
E; | |
| 33 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRI
DE; | |
| 34 | |
| 35 SK_TO_STRING_OVERRIDE() | |
| 36 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader) | |
| 37 | |
| 38 #if SK_SUPPORT_GPU | |
| 39 GrEffectRef* asNewEffect(GrContext*, const SkPaint&) const SK_OVERRIDE; | |
| 40 #endif | |
| 41 | |
| 42 protected: | |
| 43 SkPictureShader(SkReadBuffer&); | |
| 44 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | |
| 45 | |
| 46 private: | |
| 47 SkPictureShader(SkPicture*, TileMode, TileMode); | |
| 48 | |
| 49 bool buildBitmapShader(const SkMatrix&) const; | |
| 50 | |
| 51 SkPicture* fPicture; | |
| 52 TileMode fTmx, fTmy; | |
| 53 | |
| 54 mutable SkAutoTUnref<SkShader> fCachedShader; | |
| 55 mutable SkSize fCachedTileScale; | |
| 56 | |
| 57 typedef SkShader INHERITED; | |
| 58 }; | |
| 59 | |
| 60 #endif // SkPictureShader_DEFINED | |
| OLD | NEW |