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

Unified Diff: third_party/WebKit/Source/platform/graphics/StaticBitmapImage.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/StaticBitmapImage.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
index 0ff71704405a5f5f9a62075c1b0161e2d3e7f6ac..4e9bd685c154dc2c69b912222e5e614d88d32365 100644
--- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
@@ -8,6 +8,7 @@
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/ImageObserver.h"
#include "platform/graphics/UnacceleratedStaticBitmapImage.h"
+#include "platform/graphics/paint/PaintImage.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkPaint.h"
@@ -35,8 +36,15 @@ void StaticBitmapImage::DrawHelper(PaintCanvas* canvas,
if (dst_rect.IsEmpty() || adjusted_src_rect.IsEmpty())
return; // Nothing to draw.
- canvas->drawImageRect(std::move(image), adjusted_src_rect, dst_rect, &flags,
- WebCoreClampingModeToSkiaRectConstraint(clamp_mode));
+ auto animation_type = MaybeAnimated() ? PaintImage::AnimationType::ANIMATED
pdr. 2017/04/12 17:37:05 WDYT of just changing the return type of MaybeAnim
vmpstr 2017/04/12 18:58:44 Hmm, there are callers outside of graphics that us
+ : 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, dst_rect, &flags,
+ WebCoreClampingModeToSkiaRectConstraint(clamp_mode));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698