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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp

Issue 2565323003: Move gif image decoder to SkCodec (Closed)
Patch Set: More code review comments 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/image-decoders/ImageFrame.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
index a26594466b40fd22c60878b786095b05772c5a92..7dd4c121ff0475ba2c210f7965ee20ebdd0d606d 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
@@ -83,7 +83,11 @@ bool ImageFrame::CopyBitmapData(const ImageFrame& other) {
DCHECK_NE(this, &other);
has_alpha_ = other.has_alpha_;
bitmap_.reset();
- return other.bitmap_.copyTo(&bitmap_, other.bitmap_.colorType());
+ bool copied = other.bitmap_.copyTo(&bitmap_, other.bitmap_.colorType());
+ if (copied)
+ status_ = kFrameAllocated;
+
+ return copied;
}
bool ImageFrame::TakeBitmapDataIfWritable(ImageFrame* other) {
@@ -97,6 +101,7 @@ bool ImageFrame::TakeBitmapDataIfWritable(ImageFrame* other) {
bitmap_.reset();
bitmap_.swap(other->bitmap_);
other->status_ = kFrameEmpty;
+ status_ = kFrameAllocated;
return true;
}
@@ -110,7 +115,11 @@ bool ImageFrame::AllocatePixelData(int new_width,
new_width, new_height,
premultiply_alpha_ ? kPremul_SkAlphaType : kUnpremul_SkAlphaType,
std::move(color_space)));
- return bitmap_.tryAllocPixels(allocator_, 0);
+ bool allocated = bitmap_.tryAllocPixels(allocator_, 0);
+ if (allocated)
+ status_ = kFrameAllocated;
+
+ return allocated;
}
bool ImageFrame::HasAlpha() const {

Powered by Google App Engine
This is Rietveld 408576698