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

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

Issue 2565323003: Move gif image decoder to SkCodec (Closed)
Patch Set: Explicitly specify move ctor / assignment until required patch lands. Created 3 years, 4 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 12889754b357a89888f28ae53bbce787b700403c..d5cb62bd9e897900267f3bf77db3dce8fd4583b7 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_);
+ bool allocated = bitmap_.tryAllocPixels(allocator_);
+ if (allocated)
+ status_ = kFrameAllocated;
+
+ return allocated;
}
bool ImageFrame::HasAlpha() const {

Powered by Google App Engine
This is Rietveld 408576698