OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 #define _USE_MATH_DEFINES | 5 #define _USE_MATH_DEFINES |
6 #include <cmath> | 6 #include <cmath> |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gfx/image_operations.h" | 10 #include "skia/ext/image_operations.h" |
11 | 11 |
12 #include "base/gfx/convolver.h" | |
13 #include "base/gfx/rect.h" | 12 #include "base/gfx/rect.h" |
14 #include "base/gfx/size.h" | 13 #include "base/gfx/size.h" |
15 #include "base/logging.h" | 14 #include "base/logging.h" |
16 #include "base/stack_container.h" | 15 #include "base/stack_container.h" |
| 16 #include "skia/ext/convolver.h" |
17 #include "SkBitmap.h" | 17 #include "SkBitmap.h" |
18 | 18 |
19 namespace gfx { | 19 // TODO(brettw) this should be removed when the base/gfx dependencies are |
| 20 // removed. |
| 21 using namespace gfx; |
| 22 |
| 23 namespace skia { |
20 | 24 |
21 namespace { | 25 namespace { |
22 | 26 |
23 // Returns the ceiling/floor as an integer. | 27 // Returns the ceiling/floor as an integer. |
24 inline int CeilInt(float val) { | 28 inline int CeilInt(float val) { |
25 return static_cast<int>(ceil(val)); | 29 return static_cast<int>(ceil(val)); |
26 } | 30 } |
27 inline int FloorInt(float val) { | 31 inline int FloorInt(float val) { |
28 return static_cast<int>(floor(val)); | 32 return static_cast<int>(floor(val)); |
29 } | 33 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 int dest_subset_lo, int dest_subset_size, | 110 int dest_subset_lo, int dest_subset_size, |
107 float scale, float src_support, | 111 float scale, float src_support, |
108 ConvolusionFilter1D* output); | 112 ConvolusionFilter1D* output); |
109 | 113 |
110 // Computes the filter value given the coordinate in filter space. | 114 // Computes the filter value given the coordinate in filter space. |
111 inline float ComputeFilter(float pos) { | 115 inline float ComputeFilter(float pos) { |
112 switch (method_) { | 116 switch (method_) { |
113 case ImageOperations::RESIZE_BOX: | 117 case ImageOperations::RESIZE_BOX: |
114 return EvalBox(pos); | 118 return EvalBox(pos); |
115 case ImageOperations::RESIZE_LANCZOS3: | 119 case ImageOperations::RESIZE_LANCZOS3: |
116 return EvalLanczos(3, pos); | 120 return EvalLanczos(2, pos); |
117 default: | 121 default: |
118 NOTREACHED(); | 122 NOTREACHED(); |
119 return 0; | 123 return 0; |
120 } | 124 } |
121 } | 125 } |
122 | 126 |
123 ImageOperations::ResizeMethod method_; | 127 ImageOperations::ResizeMethod method_; |
124 | 128 |
125 // Subset of source the filters will touch. | 129 // Subset of source the filters will touch. |
126 Rect src_depend_; | 130 Rect src_depend_; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 SkColorGetB(first_pixel) * first_alpha + | 355 SkColorGetB(first_pixel) * first_alpha + |
352 SkColorGetB(second_pixel) * alpha); | 356 SkColorGetB(second_pixel) * alpha); |
353 | 357 |
354 dst_row[x] = SkColorSetARGB(a, r, g, b); | 358 dst_row[x] = SkColorSetARGB(a, r, g, b); |
355 } | 359 } |
356 } | 360 } |
357 | 361 |
358 return blended; | 362 return blended; |
359 } | 363 } |
360 | 364 |
361 } // namespace gfx | 365 } // namespace skia |
362 | 366 |
OLD | NEW |