| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 SkBitmap NativeImageSkia::resizedBitmap(const SkISize& scaledImageSize, const Sk
IRect& scaledImageSubset) const | 131 SkBitmap NativeImageSkia::resizedBitmap(const SkISize& scaledImageSize, const Sk
IRect& scaledImageSubset) const |
| 132 { | 132 { |
| 133 ASSERT(!DeferredImageDecoder::isLazyDecoded(bitmap())); | 133 ASSERT(!DeferredImageDecoder::isLazyDecoded(bitmap())); |
| 134 | 134 |
| 135 if (!hasResizedBitmap(scaledImageSize, scaledImageSubset)) { | 135 if (!hasResizedBitmap(scaledImageSize, scaledImageSubset)) { |
| 136 bool shouldCache = isDataComplete() | 136 bool shouldCache = isDataComplete() |
| 137 && shouldCacheResampling(scaledImageSize, scaledImageSubset); | 137 && shouldCacheResampling(scaledImageSize, scaledImageSubset); |
| 138 | 138 |
| 139 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ResizeImag
e", "cached", shouldCache); | |
| 140 SkBitmap resizedImage = skia::ImageOperations::Resize(bitmap(), skia::Im
ageOperations::RESIZE_LANCZOS3, scaledImageSize.width(), scaledImageSize.height(
), scaledImageSubset); | 139 SkBitmap resizedImage = skia::ImageOperations::Resize(bitmap(), skia::Im
ageOperations::RESIZE_LANCZOS3, scaledImageSize.width(), scaledImageSize.height(
), scaledImageSubset); |
| 141 resizedImage.setImmutable(); | 140 resizedImage.setImmutable(); |
| 142 | 141 |
| 143 if (!shouldCache) | 142 if (!shouldCache) |
| 144 return resizedImage; | 143 return resizedImage; |
| 145 | 144 |
| 146 m_resizedImage = resizedImage; | 145 m_resizedImage = resizedImage; |
| 147 } | 146 } |
| 148 | 147 |
| 149 SkBitmap resizedSubset; | 148 SkBitmap resizedSubset; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca
ledImageSubset) | 361 SkIRect NativeImageSkia::ImageResourceInfo::rectInSubset(const SkIRect& otherSca
ledImageSubset) |
| 363 { | 362 { |
| 364 if (!scaledImageSubset.contains(otherScaledImageSubset)) | 363 if (!scaledImageSubset.contains(otherScaledImageSubset)) |
| 365 return SkIRect::MakeEmpty(); | 364 return SkIRect::MakeEmpty(); |
| 366 SkIRect subsetRect = otherScaledImageSubset; | 365 SkIRect subsetRect = otherScaledImageSubset; |
| 367 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y()); | 366 subsetRect.offset(-scaledImageSubset.x(), -scaledImageSubset.y()); |
| 368 return subsetRect; | 367 return subsetRect; |
| 369 } | 368 } |
| 370 | 369 |
| 371 } // namespace blink | 370 } // namespace blink |
| OLD | NEW |