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

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

Issue 2565323003: Move gif image decoder to SkCodec (Closed)
Patch Set: Clarify code with mo'bettah comments Created 3 years, 5 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 683281f3a3f66a592d7656ef167a90e4bdd17438..8d34ddea490e505b5e633d45c70a34e71031483c 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.cpp
@@ -84,8 +84,12 @@ bool ImageFrame::CopyBitmapData(const ImageFrame& other) {
has_alpha_ = other.has_alpha_;
bitmap_.reset();
SkImageInfo info = other.bitmap_.info();
- return bitmap_.tryAllocPixels(info) &&
- other.bitmap_.readPixels(info, bitmap_.getPixels(), bitmap_.rowBytes(),
+ if (!bitmap_.tryAllocPixels(info)) {
+ return false;
+ }
+
+ status_ = kFrameAllocated;
+ return other.bitmap_.readPixels(info, bitmap_.getPixels(), bitmap_.rowBytes(),
0, 0);
}
@@ -100,6 +104,7 @@ bool ImageFrame::TakeBitmapDataIfWritable(ImageFrame* other) {
bitmap_.reset();
bitmap_.swap(other->bitmap_);
other->status_ = kFrameEmpty;
+ status_ = kFrameAllocated;
return true;
}
@@ -113,7 +118,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