| 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 "skia/ext/image_operations.h" | 10 #include "skia/ext/image_operations.h" |
| 11 | 11 |
| 12 #include "base/gfx/rect.h" | 12 #include "base/gfx/rect.h" |
| 13 #include "base/gfx/size.h" | 13 #include "base/gfx/size.h" |
| 14 #include "base/histogram.h" | 14 #include "base/histogram.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/stack_container.h" | 16 #include "base/stack_container.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 #include "third_party/skia/include/core/SkColorPriv.h" | 19 #include "third_party/skia/include/core/SkColorPriv.h" |
| 20 #include "third_party/skia/include/core/SkUnPreMultiply.h" | 20 #include "third_party/skia/include/core/SkUnPreMultiply.h" |
| 21 #include "skia/ext/convolver.h" | 21 #include "skia/ext/convolver.h" |
| 22 | 22 |
| 23 namespace skia { | 23 namespace skia { |
| 24 | 24 |
| 25 // TODO(brettw) remove this and put this file in the skia namespace. | |
| 26 using namespace gfx; | |
| 27 | |
| 28 namespace { | 25 namespace { |
| 29 | 26 |
| 30 // Returns the ceiling/floor as an integer. | 27 // Returns the ceiling/floor as an integer. |
| 31 inline int CeilInt(float val) { | 28 inline int CeilInt(float val) { |
| 32 return static_cast<int>(ceil(val)); | 29 return static_cast<int>(ceil(val)); |
| 33 } | 30 } |
| 34 inline int FloorInt(float val) { | 31 inline int FloorInt(float val) { |
| 35 return static_cast<int>(floor(val)); | 32 return static_cast<int>(floor(val)); |
| 36 } | 33 } |
| 37 | 34 |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 // Since bitmaps are refcounted, this copy will be fast. | 656 // Since bitmaps are refcounted, this copy will be fast. |
| 660 SkBitmap current = bitmap; | 657 SkBitmap current = bitmap; |
| 661 while (current.width() >= min_w * 2 && current.height() >= min_h * 2 && | 658 while (current.width() >= min_w * 2 && current.height() >= min_h * 2 && |
| 662 current.width() > 1 && current.height() > 1) | 659 current.width() > 1 && current.height() > 1) |
| 663 current = DownsampleByTwo(current); | 660 current = DownsampleByTwo(current); |
| 664 return current; | 661 return current; |
| 665 } | 662 } |
| 666 | 663 |
| 667 } // namespace skia | 664 } // namespace skia |
| 668 | 665 |
| OLD | NEW |