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