| 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 #include "SkErrorInternals.h" | 8 #include "SkBitmapFilter.h" |
| 9 #include "SkConvolver.h" | |
| 10 #include "SkBitmapProcState.h" | |
| 11 #include "SkBitmap.h" | |
| 12 #include "SkColor.h" | |
| 13 #include "SkColorPriv.h" | |
| 14 #include "SkConvolver.h" | |
| 15 #include "SkUnPreMultiply.h" | |
| 16 #include "SkShader.h" | |
| 17 #include "SkRTConf.h" | 9 #include "SkRTConf.h" |
| 18 #include "SkMath.h" | 10 #include "SkTypes.h" |
| 11 |
| 12 #include <string.h> |
| 19 | 13 |
| 20 // These are the per-scanline callbacks that are used when we must resort to | 14 // These are the per-scanline callbacks that are used when we must resort to |
| 21 // resampling an image as it is blitted. Typically these are used only when | 15 // resampling an image as it is blitted. Typically these are used only when |
| 22 // the image is rotated or has some other complex transformation applied. | 16 // the image is rotated or has some other complex transformation applied. |
| 23 // Scaled images will usually be rescaled directly before rasterization. | 17 // Scaled images will usually be rescaled directly before rasterization. |
| 24 | 18 |
| 25 SK_CONF_DECLARE(const char *, c_bitmapFilter, "bitmap.filter", "mitchell", "Whic
h scanline bitmap filter to use [mitchell, lanczos, hamming, gaussian, triangle,
box]"); | 19 SK_CONF_DECLARE(const char *, c_bitmapFilter, "bitmap.filter", "mitchell", "Whic
h scanline bitmap filter to use [mitchell, lanczos, hamming, gaussian, triangle,
box]"); |
| 26 | 20 |
| 27 SkBitmapFilter *SkBitmapFilter::Allocate() { | 21 SkBitmapFilter *SkBitmapFilter::Allocate() { |
| 28 if (!strcmp(c_bitmapFilter, "mitchell")) { | 22 if (!strcmp(c_bitmapFilter, "mitchell")) { |
| 29 return SkNEW_ARGS(SkMitchellFilter,(1.f/3.f,1.f/3.f)); | 23 return SkNEW_ARGS(SkMitchellFilter,(1.f/3.f,1.f/3.f)); |
| 30 } else if (!strcmp(c_bitmapFilter, "lanczos")) { | 24 } else if (!strcmp(c_bitmapFilter, "lanczos")) { |
| 31 return SkNEW(SkLanczosFilter); | 25 return SkNEW(SkLanczosFilter); |
| 32 } else if (!strcmp(c_bitmapFilter, "hamming")) { | 26 } else if (!strcmp(c_bitmapFilter, "hamming")) { |
| 33 return SkNEW(SkHammingFilter); | 27 return SkNEW(SkHammingFilter); |
| 34 } else if (!strcmp(c_bitmapFilter, "gaussian")) { | 28 } else if (!strcmp(c_bitmapFilter, "gaussian")) { |
| 35 return SkNEW_ARGS(SkGaussianFilter,(2)); | 29 return SkNEW_ARGS(SkGaussianFilter,(2)); |
| 36 } else if (!strcmp(c_bitmapFilter, "triangle")) { | 30 } else if (!strcmp(c_bitmapFilter, "triangle")) { |
| 37 return SkNEW(SkTriangleFilter); | 31 return SkNEW(SkTriangleFilter); |
| 38 } else if (!strcmp(c_bitmapFilter, "box")) { | 32 } else if (!strcmp(c_bitmapFilter, "box")) { |
| 39 return SkNEW(SkBoxFilter); | 33 return SkNEW(SkBoxFilter); |
| 40 } else { | 34 } else { |
| 41 SkDEBUGFAIL("Unknown filter type"); | 35 SkDEBUGFAIL("Unknown filter type"); |
| 42 } | 36 } |
| 43 | 37 |
| 44 return NULL; | 38 return NULL; |
| 45 } | 39 } |
| 46 | 40 |
| OLD | NEW |