Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 | 43 |
| 44 PassRefPtr<BitmapImage> BitmapImage::createWithOrientationForTesting(const SkBit map& bitmap, ImageOrientation orientation) | 44 PassRefPtr<BitmapImage> BitmapImage::createWithOrientationForTesting(const SkBit map& bitmap, ImageOrientation orientation) |
| 45 { | 45 { |
| 46 if (bitmap.isNull()) { | 46 if (bitmap.isNull()) { |
| 47 return BitmapImage::create(); | 47 return BitmapImage::create(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 RefPtr<BitmapImage> result = adoptRef(new BitmapImage(bitmap)); | 50 RefPtr<BitmapImage> result = adoptRef(new BitmapImage(bitmap)); |
| 51 result->m_frames[0].m_orientation = orientation; | 51 result->m_frames[0].m_orientation = orientation; |
| 52 if (orientation.usesWidthAsHeight()) | 52 if (orientation.usesWidthAsHeight()) |
| 53 result->m_sizeRespectingOrientation = IntSize(result->m_size.height(), r esult->m_size.width()); | 53 result->m_sizeRespectingOrientation = result->m_size.transposedSize(); |
| 54 return result.release(); | 54 return result.release(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 BitmapImage::BitmapImage(ImageObserver* observer) | 57 BitmapImage::BitmapImage(ImageObserver* observer) |
| 58 : Image(observer) | 58 : Image(observer) |
| 59 , m_currentFrame(0) | 59 , m_currentFrame(0) |
| 60 , m_repetitionCount(cAnimationNone) | 60 , m_repetitionCount(cAnimationNone) |
| 61 , m_repetitionCountStatus(Unknown) | 61 , m_repetitionCountStatus(Unknown) |
| 62 , m_repetitionsComplete(0) | 62 , m_repetitionsComplete(0) |
| 63 , m_desiredFrameStartTime(0) | 63 , m_desiredFrameStartTime(0) |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 | 291 |
| 292 // ImageOrientation expects the origin to be at (0, 0) | 292 // ImageOrientation expects the origin to be at (0, 0) |
| 293 canvas->translate(adjustedDstRect.x(), adjustedDstRect.y()); | 293 canvas->translate(adjustedDstRect.x(), adjustedDstRect.y()); |
| 294 adjustedDstRect.setLocation(FloatPoint()); | 294 adjustedDstRect.setLocation(FloatPoint()); |
| 295 | 295 |
| 296 canvas->concat(affineTransformToSkMatrix(orientation.transformFromDefaul t(adjustedDstRect.size()))); | 296 canvas->concat(affineTransformToSkMatrix(orientation.transformFromDefaul t(adjustedDstRect.size()))); |
| 297 | 297 |
| 298 if (orientation.usesWidthAsHeight()) { | 298 if (orientation.usesWidthAsHeight()) { |
| 299 // The destination rect will have it's width and height already reve rsed for the orientation of | 299 // The destination rect will have it's width and height already reve rsed for the orientation of |
| 300 // the image, as it was needed for page layout, so we need to revers e it back here. | 300 // the image, as it was needed for page layout, so we need to revers e it back here. |
| 301 adjustedDstRect = FloatRect(adjustedDstRect.x(), adjustedDstRect.y() , adjustedDstRect.height(), adjustedDstRect.width()); | 301 adjustedDstRect = adjustedDstRect.transposedRect(); |
|
leviw_travelin_and_unemployed
2015/08/14 22:34:14
The old code wasn't actually a transposedRect, as
| |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 SkRect skSrcRect = adjustedSrcRect; | 305 SkRect skSrcRect = adjustedSrcRect; |
| 306 canvas->drawImageRect(image.get(), skSrcRect, adjustedDstRect, &paint, | 306 canvas->drawImageRect(image.get(), skSrcRect, adjustedDstRect, &paint, |
| 307 WebCoreClampingModeToSkiaRectConstraint(clampMode)); | 307 WebCoreClampingModeToSkiaRectConstraint(clampMode)); |
| 308 canvas->restoreToCount(initialSaveCount); | 308 canvas->restoreToCount(initialSaveCount); |
| 309 | 309 |
| 310 if (currentFrameIsLazyDecoded()) | 310 if (currentFrameIsLazyDecoded()) |
| 311 PlatformInstrumentation::didDrawLazyPixelRef(image->uniqueID()); | 311 PlatformInstrumentation::didDrawLazyPixelRef(image->uniqueID()); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 674 destroyDecodedDataIfNecessary(); | 674 destroyDecodedDataIfNecessary(); |
| 675 | 675 |
| 676 // We need to draw this frame if we advanced to it while not skipping, or if | 676 // We need to draw this frame if we advanced to it while not skipping, or if |
| 677 // while trying to skip frames we hit the last frame and thus had to stop. | 677 // while trying to skip frames we hit the last frame and thus had to stop. |
| 678 if (skippingFrames != advancedAnimation) | 678 if (skippingFrames != advancedAnimation) |
| 679 imageObserver()->animationAdvanced(this); | 679 imageObserver()->animationAdvanced(this); |
| 680 return advancedAnimation; | 680 return advancedAnimation; |
| 681 } | 681 } |
| 682 | 682 |
| 683 } // namespace blink | 683 } // namespace blink |
| OLD | NEW |