| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkBlurImageFilter.h" |
| 9 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 10 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
| 12 #include "SkColorFilterImageFilter.h" |
| 11 #include "SkColorPriv.h" | 13 #include "SkColorPriv.h" |
| 14 #include "SkDropShadowImageFilter.h" |
| 15 #include "SkImage.h" |
| 12 #include "SkShader.h" | 16 #include "SkShader.h" |
| 13 | |
| 14 #include "SkBlurImageFilter.h" | |
| 15 #include "SkColorFilterImageFilter.h" | |
| 16 #include "SkDropShadowImageFilter.h" | |
| 17 #include "SkTestImageFilters.h" | 17 #include "SkTestImageFilters.h" |
| 18 | 18 |
| 19 class FailImageFilter : public SkImageFilter { | 19 class FailImageFilter : public SkImageFilter { |
| 20 public: | 20 public: |
| 21 class Registrar { | 21 class Registrar { |
| 22 public: | 22 public: |
| 23 Registrar() { | 23 Registrar() { |
| 24 SkFlattenable::Register("FailImageFilter", | 24 SkFlattenable::Register("FailImageFilter", |
| 25 FailImageFilter::CreateProc, | 25 FailImageFilter::CreateProc, |
| 26 FailImageFilter::GetFlattenableType()); | 26 FailImageFilter::GetFlattenableType()); |
| 27 } | 27 } |
| 28 }; | 28 }; |
| 29 static FailImageFilter* Create() { | 29 static FailImageFilter* Create() { |
| 30 return SkNEW(FailImageFilter); | 30 return SkNEW(FailImageFilter); |
| 31 } | 31 } |
| 32 | 32 |
| 33 SK_TO_STRING_OVERRIDE() | 33 SK_TO_STRING_OVERRIDE() |
| 34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) | 34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 FailImageFilter() : INHERITED(0, NULL) {} | 37 FailImageFilter() : INHERITED(0, NULL) {} |
| 38 | 38 |
| 39 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 39 bool onFilterImage(Proxy*, const SkImage* src, const Context&, |
| 40 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE { | 40 SkAutoTUnref<const SkImage>& result, SkIPoint* offset) co
nst SK_OVERRIDE { |
| 41 return false; | 41 return false; |
| 42 } | 42 } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 typedef SkImageFilter INHERITED; | 45 typedef SkImageFilter INHERITED; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 static FailImageFilter::Registrar gReg0; | 48 static FailImageFilter::Registrar gReg0; |
| 49 | 49 |
| 50 SkFlattenable* FailImageFilter::CreateProc(SkReadBuffer& buffer) { | 50 SkFlattenable* FailImageFilter::CreateProc(SkReadBuffer& buffer) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 }; | 71 }; |
| 72 static IdentityImageFilter* Create(SkImageFilter* input = NULL) { | 72 static IdentityImageFilter* Create(SkImageFilter* input = NULL) { |
| 73 return SkNEW_ARGS(IdentityImageFilter, (input)); | 73 return SkNEW_ARGS(IdentityImageFilter, (input)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 SK_TO_STRING_OVERRIDE() | 76 SK_TO_STRING_OVERRIDE() |
| 77 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) | 77 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) |
| 78 protected: | 78 protected: |
| 79 IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {} | 79 IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {} |
| 80 | 80 |
| 81 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 81 bool onFilterImage(Proxy*, const SkImage* src, const Context&, |
| 82 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE { | 82 SkAutoTUnref<const SkImage>& result, SkIPoint* offset) co
nst SK_OVERRIDE { |
| 83 *result = src; | 83 result.reset(SkRef(src)); |
| 84 offset->set(0, 0); | 84 offset->set(0, 0); |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 typedef SkImageFilter INHERITED; | 89 typedef SkImageFilter INHERITED; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 static IdentityImageFilter::Registrar gReg1; | 92 static IdentityImageFilter::Registrar gReg1; |
| 93 | 93 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { | 340 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { |
| 341 public: | 341 public: |
| 342 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} | 342 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} |
| 343 | 343 |
| 344 void installFilter(SkPaint* paint) SK_OVERRIDE { | 344 void installFilter(SkPaint* paint) SK_OVERRIDE { |
| 345 paint->setColorFilter(SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXf
ermode::kSrcIn_Mode))->unref(); | 345 paint->setColorFilter(SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXf
ermode::kSrcIn_Mode))->unref(); |
| 346 } | 346 } |
| 347 }; | 347 }; |
| 348 DEF_GM( return new ImageFiltersText_CF; ) | 348 DEF_GM( return new ImageFiltersText_CF; ) |
| 349 | 349 |
| OLD | NEW |