Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp

Issue 2812763002: paint: Introduce PaintImage that wraps SkImage in paint calls. (Closed)
Patch Set: update Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
index c91d921065b2ceb6291d3f4988ff41576f7bf140..747faf64c6819251c9912fbf6ed07ef380f3d244 100644
--- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
@@ -35,6 +35,7 @@
#include "platform/graphics/StaticBitmapImage.h"
#include "platform/graphics/paint/PaintCanvas.h"
#include "platform/graphics/paint/PaintFlags.h"
+#include "platform/graphics/paint/PaintImage.h"
#include "platform/graphics/skia/SkiaUtils.h"
#include "platform/instrumentation/PlatformInstrumentation.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
@@ -300,10 +301,16 @@ void BitmapImage::Draw(
uint32_t unique_id = image->uniqueID();
bool is_lazy_generated = image->isLazyGenerated();
-
- canvas->drawImageRect(std::move(image), adjusted_src_rect, adjusted_dst_rect,
- &flags,
- WebCoreClampingModeToSkiaRectConstraint(clamp_mode));
+ auto animation_type = MaybeAnimated() ? PaintImage::AnimationType::ANIMATED
+ : PaintImage::AnimationType::STATIC;
+ auto completion_state = CurrentFrameIsComplete()
+ ? PaintImage::CompletionState::DONE
+ : PaintImage::CompletionState::PARTIALLY_DONE;
+
+ canvas->drawImageRect(
+ PaintImage(std::move(image), animation_type, completion_state),
+ adjusted_src_rect, adjusted_dst_rect, &flags,
+ WebCoreClampingModeToSkiaRectConstraint(clamp_mode));
if (is_lazy_generated)
PlatformInstrumentation::DidDrawLazyPixelRef(unique_id);

Powered by Google App Engine
This is Rietveld 408576698