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

Unified Diff: ui/gfx/image/image_family.cc

Issue 2707993005: Avoid returning a shallow copy of gfx::Image from gfx::ImageFamily::CreateExact (Closed)
Patch Set: fix Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_family.cc
diff --git a/ui/gfx/image/image_family.cc b/ui/gfx/image/image_family.cc
index af0c2bf3675b367d9c78c7a428f38d0ddd4d2f77..0b80eef50a27fb1c1972cb1030ff2e166408dd6c 100644
--- a/ui/gfx/image/image_family.cc
+++ b/ui/gfx/image/image_family.cc
@@ -117,8 +117,10 @@ gfx::Image ImageFamily::CreateExact(int width, int height) const {
if (!image)
return gfx::Image();
- if (image->Width() == width && image->Height() == height)
- return gfx::Image(*image);
+ if (image->Width() == width && image->Height() == height) {
+ std::unique_ptr<gfx::ImageSkia> image_skia(image->CopyImageSkia());
Robert Sesek 2017/02/22 18:44:46 I'd leave a comment here as to why this is done.
tzik 2017/02/22 22:01:16 Done.
+ return gfx::Image(*image_skia);
+ }
SkBitmap bitmap = image->AsBitmap();
SkBitmap resized_bitmap = skia::ImageOperations::Resize(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698