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

Side by Side Diff: ui/message_center/views/proportional_image_view.cc

Issue 271653003: Scrub deprecated Skia APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/views/proportional_image_view.h" 5 #include "ui/message_center/views/proportional_image_view.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/message_center/message_center_style.h" 8 #include "ui/message_center/message_center_style.h"
9 9
10 namespace message_center { 10 namespace message_center {
(...skipping 20 matching lines...) Expand all
31 31
32 gfx::Rect draw_bounds = GetContentsBounds(); 32 gfx::Rect draw_bounds = GetContentsBounds();
33 draw_bounds.ClampToCenteredSize(draw_size); 33 draw_bounds.ClampToCenteredSize(draw_size);
34 34
35 gfx::Size image_size(image_.size()); 35 gfx::Size image_size(image_.size());
36 36
37 if (image_size == draw_size) { 37 if (image_size == draw_size) {
38 canvas->DrawImageInt(image_, draw_bounds.x(), draw_bounds.y()); 38 canvas->DrawImageInt(image_, draw_bounds.x(), draw_bounds.y());
39 } else { 39 } else {
40 SkPaint paint; 40 SkPaint paint;
41 paint.setFilterBitmap(true); 41 paint.setFilterLevel(SkPaint::kLow_FilterLevel);
42 42
43 // This call resizes the image while drawing into the canvas. 43 // This call resizes the image while drawing into the canvas.
44 canvas->DrawImageInt( 44 canvas->DrawImageInt(
45 image_, 45 image_,
46 0, 0, image_size.width(), image_size.height(), 46 0, 0, image_size.width(), image_size.height(),
47 draw_bounds.x(), draw_bounds.y(), draw_size.width(), draw_size.height(), 47 draw_bounds.x(), draw_bounds.y(), draw_size.width(), draw_size.height(),
48 true, 48 true,
49 paint); 49 paint);
50 } 50 }
51 } 51 }
52 52
53 gfx::Size ProportionalImageView::GetImageDrawingSize() { 53 gfx::Size ProportionalImageView::GetImageDrawingSize() {
54 if (!visible()) 54 if (!visible())
55 return gfx::Size(); 55 return gfx::Size();
56 return message_center::GetImageSizeForContainerSize( 56 return message_center::GetImageSizeForContainerSize(
57 GetContentsBounds().size(), image_.size()); 57 GetContentsBounds().size(), image_.size());
58 } 58 }
59 59
60 } // namespace message_center 60 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698