| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 if (size.isEmpty()) | 89 if (size.isEmpty()) |
| 90 return nullptr; | 90 return nullptr; |
| 91 | 91 |
| 92 if (transform.isIdentity() && opacity == 1) { | 92 if (transform.isIdentity() && opacity == 1) { |
| 93 // Nothing to adjust, just use the original. | 93 // Nothing to adjust, just use the original. |
| 94 ASSERT(image->width() == size.width()); | 94 ASSERT(image->width() == size.width()); |
| 95 ASSERT(image->height() == size.height()); | 95 ASSERT(image->height() == size.height()); |
| 96 return image; | 96 return image; |
| 97 } | 97 } |
| 98 | 98 |
| 99 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterN32Premul(size.widt
h(), size.height())); | 99 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(size.width(), size
.height()); |
| 100 if (!surface) | 100 if (!surface) |
| 101 return nullptr; | 101 return nullptr; |
| 102 | 102 |
| 103 SkPaint paint; | 103 SkPaint paint; |
| 104 ASSERT(opacity >= 0 && opacity <= 1); | 104 ASSERT(opacity >= 0 && opacity <= 1); |
| 105 paint.setAlpha(opacity * 255); | 105 paint.setAlpha(opacity * 255); |
| 106 paint.setFilterQuality(interpolationQuality == InterpolationNone | 106 paint.setFilterQuality(interpolationQuality == InterpolationNone |
| 107 ? kNone_SkFilterQuality : kHigh_SkFilterQuality); | 107 ? kNone_SkFilterQuality : kHigh_SkFilterQuality); |
| 108 | 108 |
| 109 SkCanvas* canvas = surface->getCanvas(); | 109 SkCanvas* canvas = surface->getCanvas(); |
| (...skipping 158 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 |