1 /* 2 * Copyright 2013 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 SkRectShaderImageFilter_DEFINED 9 #define SkRectShaderImageFilter_DEFINED 10 11 #include "SkImageFilter.h" 12 #include "SkRect.h" 13 14 class SkShader; 15 16 class SK_API SkRectShaderImageFilter : public SkImageFilter { 17 public: 18 /** 19 * The SkShader object will have its refcnt increased as it becomes a member of the 20 * SkRectShaderImageFilter object returned by this function. It cannot be NULL. 21 * The region parameter is used to specify on which region the shader is applied. 22 */ 23 static SkRectShaderImageFilter* Create(SkShader* s, const SkRect& rect); 24 virtual ~SkRectShaderImageFilter(); 25 26 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRectShaderImageFilter) 27 28 protected: 29 SkRectShaderImageFilter(SkFlattenableReadBuffer& buffer); 30 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 31 32 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, 33 SkBitmap* result, SkIPoint* loc) SK_OVERRIDE; 34 35 private: 36 SkRectShaderImageFilter(SkShader* s, const SkRect& rect); 37 SkShader* fShader; 38 SkRect fRect; 39 40 typedef SkImageFilter INHERITED; 41 }; 42 43 #endif 44