| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "skia/ext/image_operations.h" | 43 #include "skia/ext/image_operations.h" |
| 44 #include "third_party/skia/include/core/SkMatrix.h" | 44 #include "third_party/skia/include/core/SkMatrix.h" |
| 45 #include "third_party/skia/include/core/SkPaint.h" | 45 #include "third_party/skia/include/core/SkPaint.h" |
| 46 #include "third_party/skia/include/core/SkScalar.h" | 46 #include "third_party/skia/include/core/SkScalar.h" |
| 47 #include "third_party/skia/include/core/SkShader.h" | 47 #include "third_party/skia/include/core/SkShader.h" |
| 48 | 48 |
| 49 #include <algorithm> | 49 #include <algorithm> |
| 50 #include <math.h> | 50 #include <math.h> |
| 51 #include <limits> | 51 #include <limits> |
| 52 | 52 |
| 53 namespace WebCore { | 53 namespace blink { |
| 54 | 54 |
| 55 static bool nearlyIntegral(float value) | 55 static bool nearlyIntegral(float value) |
| 56 { | 56 { |
| 57 return fabs(value - floorf(value)) < std::numeric_limits<float>::epsilon(); | 57 return fabs(value - floorf(value)) < std::numeric_limits<float>::epsilon(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 InterpolationQuality NativeImageSkia::computeInterpolationQuality(const SkMatrix
& matrix, float srcWidth, float srcHeight, float destWidth, float destHeight) co
nst | 60 InterpolationQuality NativeImageSkia::computeInterpolationQuality(const SkMatrix
& matrix, float srcWidth, float srcHeight, float destWidth, float destHeight) co
nst |
| 61 { | 61 { |
| 62 // The percent change below which we will not resample. This usually means | 62 // The percent change below which we will not resample. This usually means |
| 63 // an off-by-one error on the web page, and just doing nearest neighbor | 63 // an off-by-one error on the web page, and just doing nearest neighbor |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 549 |
| 550 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca
ledImageSubset) | 550 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca
ledImageSubset) |
| 551 { | 551 { |
| 552 if (!scaledImageSubset.contains(otherScaledImageSubset)) | 552 if (!scaledImageSubset.contains(otherScaledImageSubset)) |
| 553 return SkIRect::MakeEmpty(); | 553 return SkIRect::MakeEmpty(); |
| 554 SkIRect subsetRect = otherScaledImageSubset; | 554 SkIRect subsetRect = otherScaledImageSubset; |
| 555 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y()); | 555 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y()); |
| 556 return subsetRect; | 556 return subsetRect; |
| 557 } | 557 } |
| 558 | 558 |
| 559 } // namespace WebCore | 559 } // namespace blink |
| OLD | NEW |