| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkRectShaderImageFilter_DEFINED | 8 #ifndef SkRectShaderImageFilter_DEFINED |
| 9 #define SkRectShaderImageFilter_DEFINED | 9 #define SkRectShaderImageFilter_DEFINED |
| 10 | 10 |
| 11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
| 12 #include "SkRect.h" | 12 #include "SkRect.h" |
| 13 | 13 |
| 14 class SkShader; | 14 class SkShader; |
| 15 | 15 |
| 16 class SK_API SkRectShaderImageFilter : public SkImageFilter { | 16 class SK_API SkRectShaderImageFilter : public SkImageFilter { |
| 17 public: | 17 public: |
| 18 /** | 18 /** Create a new image filter which fills the given rectangle with pixels |
| 19 * The SkShader object will have its refcnt increased as it becomes a membe
r of the | 19 * produced by the given SkShader. If no rectangle is specified, an output |
| 20 * SkRectShaderImageFilter object returned by this function. It cannot be N
ULL. | 20 * is produced with the same bounds as the input primitive (even though |
| 21 * The region parameter is used to specify on which region the shader is ap
plied. | 21 * the input primitive's pixels are not used for processing). |
| 22 * @param s Shader to call for processing. Cannot be NULL. Will be |
| 23 * ref'ed by the new image filter. |
| 24 * @param rect Rectangle of output pixels in which to apply the shader. |
| 25 * If NULL or a given crop edge is not specified, the source |
| 26 * primitive's bounds are used instead. |
| 22 */ | 27 */ |
| 23 static SkRectShaderImageFilter* Create(SkShader* s, const SkRect& rect); | 28 /* DEPRECATED */ static SkRectShaderImageFilter* Create(SkShader* s, const S
kRect& rect); |
| 29 static SkRectShaderImageFilter* Create(SkShader* s, const CropRect* rect = N
ULL); |
| 24 virtual ~SkRectShaderImageFilter(); | 30 virtual ~SkRectShaderImageFilter(); |
| 25 | 31 |
| 26 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRectShaderImageFilter) | 32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRectShaderImageFilter) |
| 27 | 33 |
| 28 protected: | 34 protected: |
| 29 SkRectShaderImageFilter(SkFlattenableReadBuffer& buffer); | 35 SkRectShaderImageFilter(SkFlattenableReadBuffer& buffer); |
| 30 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 36 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
| 31 | 37 |
| 32 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 38 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
| 33 SkBitmap* result, SkIPoint* loc) SK_OVERRIDE; | 39 SkBitmap* result, SkIPoint* loc) SK_OVERRIDE; |
| 34 | 40 |
| 35 private: | 41 private: |
| 36 SkRectShaderImageFilter(SkShader* s, const CropRect* rect); | 42 SkRectShaderImageFilter(SkShader* s, const CropRect* rect); |
| 37 SkShader* fShader; | 43 SkShader* fShader; |
| 38 | 44 |
| 39 typedef SkImageFilter INHERITED; | 45 typedef SkImageFilter INHERITED; |
| 40 }; | 46 }; |
| 41 | 47 |
| 42 #endif | 48 #endif |
| OLD | NEW |