| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 PassRefPtr<SkImage> DragImage::resizeAndOrientImage(PassRefPtr<SkImage> image, I
mageOrientation orientation, | 77 PassRefPtr<SkImage> DragImage::resizeAndOrientImage(PassRefPtr<SkImage> image, I
mageOrientation orientation, |
| 78 FloatSize imageScale, float opacity, InterpolationQuality interpolationQuali
ty) | 78 FloatSize imageScale, float opacity, InterpolationQuality interpolationQuali
ty) |
| 79 { | 79 { |
| 80 IntSize size(image->width(), image->height()); | 80 IntSize size(image->width(), image->height()); |
| 81 size.scale(imageScale.width(), imageScale.height()); | 81 size.scale(imageScale.width(), imageScale.height()); |
| 82 AffineTransform transform; | 82 AffineTransform transform; |
| 83 if (orientation != DefaultImageOrientation) { | 83 if (orientation != DefaultImageOrientation) { |
| 84 if (orientation.usesWidthAsHeight()) | 84 if (orientation.usesWidthAsHeight()) |
| 85 size = size.transposedSize(); | 85 size = size.transposedSize(); |
| 86 transform *= orientation.transformFromDefault(size); | 86 transform *= orientation.transformFromDefault(FloatSize(size)); |
| 87 } | 87 } |
| 88 transform.scaleNonUniform(imageScale.width(), imageScale.height()); | 88 transform.scaleNonUniform(imageScale.width(), imageScale.height()); |
| 89 | 89 |
| 90 if (size.isEmpty()) | 90 if (size.isEmpty()) |
| 91 return nullptr; | 91 return nullptr; |
| 92 | 92 |
| 93 if (transform.isIdentity() && opacity == 1) { | 93 if (transform.isIdentity() && opacity == 1) { |
| 94 // Nothing to adjust, just use the original. | 94 // Nothing to adjust, just use the original. |
| 95 ASSERT(image->width() == size.width()); | 95 ASSERT(image->width() == size.width()); |
| 96 ASSERT(image->height() == size.height()); | 96 ASSERT(image->height() == size.height()); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 void DragImage::scale(float scaleX, float scaleY) | 269 void DragImage::scale(float scaleX, float scaleY) |
| 270 { | 270 { |
| 271 skia::ImageOperations::ResizeMethod resizeMethod = m_interpolationQuality ==
InterpolationNone ? skia::ImageOperations::RESIZE_BOX : skia::ImageOperations::
RESIZE_LANCZOS3; | 271 skia::ImageOperations::ResizeMethod resizeMethod = m_interpolationQuality ==
InterpolationNone ? skia::ImageOperations::RESIZE_BOX : skia::ImageOperations::
RESIZE_LANCZOS3; |
| 272 int imageWidth = scaleX * m_bitmap.width(); | 272 int imageWidth = scaleX * m_bitmap.width(); |
| 273 int imageHeight = scaleY * m_bitmap.height(); | 273 int imageHeight = scaleY * m_bitmap.height(); |
| 274 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth,
imageHeight); | 274 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth,
imageHeight); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace blink | 277 } // namespace blink |
| OLD | NEW |