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

Unified Diff: ui/message_center/views/proportional_image_view.cc

Issue 1404333002: Do high-quality resizes for notification images. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/message_center/views/proportional_image_view.cc
diff --git a/ui/message_center/views/proportional_image_view.cc b/ui/message_center/views/proportional_image_view.cc
index 217832436df767cf599b9dd588160c4ededbd9f7..a7befd66fb2090e2264a2ba936ee5857ab46b47d 100644
--- a/ui/message_center/views/proportional_image_view.cc
+++ b/ui/message_center/views/proportional_image_view.cc
@@ -5,6 +5,7 @@
#include "ui/message_center/views/proportional_image_view.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/image/image_skia_operations.h"
#include "ui/message_center/message_center_style.h"
namespace message_center {
@@ -33,29 +34,18 @@ void ProportionalImageView::OnPaint(gfx::Canvas* canvas) {
views::View::OnPaint(canvas);
gfx::Size draw_size = GetImageDrawingSize();
-
if (draw_size.IsEmpty())
return;
gfx::Rect draw_bounds = GetContentsBounds();
draw_bounds.ClampToCenteredSize(draw_size);
- gfx::Size image_size(image_.size());
-
- if (image_size == draw_size) {
- canvas->DrawImageInt(image_, draw_bounds.x(), draw_bounds.y());
- } else {
- SkPaint paint;
- paint.setFilterQuality(kLow_SkFilterQuality);
Daniel Erat 2015/10/15 17:14:25 i saw no changes when increasing the filter qualit
dewittj 2015/10/15 17:18:56 Acknowledged.
-
- // This call resizes the image while drawing into the canvas.
- canvas->DrawImageInt(
- image_,
- 0, 0, image_size.width(), image_size.height(),
- draw_bounds.x(), draw_bounds.y(), draw_size.width(), draw_size.height(),
- true,
- paint);
- }
+ gfx::ImageSkia image =
+ (image_.size() == draw_size)
+ ? image_
+ : gfx::ImageSkiaOperations::CreateResizedImage(
+ image_, skia::ImageOperations::RESIZE_BEST, draw_size);
Daniel Erat 2015/10/15 17:14:25 i'm hopeful that there aren't any performance conc
dewittj 2015/10/15 17:18:56 Seems unlikely that paint performance will be a pr
+ canvas->DrawImageInt(image, draw_bounds.x(), draw_bounds.y());
}
const char* ProportionalImageView::GetClassName() const {
« 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