| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "platform/RuntimeEnabledFeatures.h" | 29 #include "platform/RuntimeEnabledFeatures.h" |
| 30 #include "platform/Timer.h" | 30 #include "platform/Timer.h" |
| 31 #include "platform/geometry/FloatRect.h" | 31 #include "platform/geometry/FloatRect.h" |
| 32 #include "platform/graphics/BitmapImageMetrics.h" | 32 #include "platform/graphics/BitmapImageMetrics.h" |
| 33 #include "platform/graphics/DeferredImageDecoder.h" | 33 #include "platform/graphics/DeferredImageDecoder.h" |
| 34 #include "platform/graphics/ImageObserver.h" | 34 #include "platform/graphics/ImageObserver.h" |
| 35 #include "platform/graphics/StaticBitmapImage.h" | 35 #include "platform/graphics/StaticBitmapImage.h" |
| 36 #include "platform/graphics/paint/PaintCanvas.h" | 36 #include "platform/graphics/paint/PaintCanvas.h" |
| 37 #include "platform/graphics/paint/PaintFlags.h" | 37 #include "platform/graphics/paint/PaintFlags.h" |
| 38 #include "platform/graphics/paint/PaintImage.h" |
| 38 #include "platform/graphics/skia/SkiaUtils.h" | 39 #include "platform/graphics/skia/SkiaUtils.h" |
| 39 #include "platform/instrumentation/PlatformInstrumentation.h" | 40 #include "platform/instrumentation/PlatformInstrumentation.h" |
| 40 #include "platform/instrumentation/tracing/TraceEvent.h" | 41 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 41 #include "platform/wtf/PassRefPtr.h" | 42 #include "platform/wtf/PassRefPtr.h" |
| 42 #include "platform/wtf/PtrUtil.h" | 43 #include "platform/wtf/PtrUtil.h" |
| 43 #include "platform/wtf/text/WTFString.h" | 44 #include "platform/wtf/text/WTFString.h" |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| 46 | 47 |
| 47 namespace { | 48 namespace { |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // for the orientation of the image, as it was needed for page layout, so | 294 // for the orientation of the image, as it was needed for page layout, so |
| 294 // we need to reverse it back here. | 295 // we need to reverse it back here. |
| 295 adjusted_dst_rect = | 296 adjusted_dst_rect = |
| 296 FloatRect(adjusted_dst_rect.X(), adjusted_dst_rect.Y(), | 297 FloatRect(adjusted_dst_rect.X(), adjusted_dst_rect.Y(), |
| 297 adjusted_dst_rect.Height(), adjusted_dst_rect.Width()); | 298 adjusted_dst_rect.Height(), adjusted_dst_rect.Width()); |
| 298 } | 299 } |
| 299 } | 300 } |
| 300 | 301 |
| 301 uint32_t unique_id = image->uniqueID(); | 302 uint32_t unique_id = image->uniqueID(); |
| 302 bool is_lazy_generated = image->isLazyGenerated(); | 303 bool is_lazy_generated = image->isLazyGenerated(); |
| 304 auto animation_type = MaybeAnimated() ? PaintImage::AnimationType::ANIMATED |
| 305 : PaintImage::AnimationType::STATIC; |
| 306 auto completion_state = CurrentFrameIsComplete() |
| 307 ? PaintImage::CompletionState::DONE |
| 308 : PaintImage::CompletionState::PARTIALLY_DONE; |
| 303 | 309 |
| 304 canvas->drawImageRect(std::move(image), adjusted_src_rect, adjusted_dst_rect, | 310 canvas->drawImageRect( |
| 305 &flags, | 311 PaintImage(std::move(image), animation_type, completion_state), |
| 306 WebCoreClampingModeToSkiaRectConstraint(clamp_mode)); | 312 adjusted_src_rect, adjusted_dst_rect, &flags, |
| 313 WebCoreClampingModeToSkiaRectConstraint(clamp_mode)); |
| 307 | 314 |
| 308 if (is_lazy_generated) | 315 if (is_lazy_generated) |
| 309 PlatformInstrumentation::DidDrawLazyPixelRef(unique_id); | 316 PlatformInstrumentation::DidDrawLazyPixelRef(unique_id); |
| 310 | 317 |
| 311 StartAnimation(); | 318 StartAnimation(); |
| 312 } | 319 } |
| 313 | 320 |
| 314 size_t BitmapImage::FrameCount() { | 321 size_t BitmapImage::FrameCount() { |
| 315 if (!have_frame_count_) { | 322 if (!have_frame_count_) { |
| 316 frame_count_ = source_.FrameCount(); | 323 frame_count_ = source_.FrameCount(); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 GetImageObserver()->AnimationAdvanced(this); | 648 GetImageObserver()->AnimationAdvanced(this); |
| 642 | 649 |
| 643 return true; | 650 return true; |
| 644 } | 651 } |
| 645 | 652 |
| 646 void BitmapImage::NotifyObserversOfAnimationAdvance(TimerBase*) { | 653 void BitmapImage::NotifyObserversOfAnimationAdvance(TimerBase*) { |
| 647 GetImageObserver()->AnimationAdvanced(this); | 654 GetImageObserver()->AnimationAdvanced(this); |
| 648 } | 655 } |
| 649 | 656 |
| 650 } // namespace blink | 657 } // namespace blink |
| OLD | NEW |