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

Side by Side Diff: trunk/src/ui/app_list/views/cached_label.cc

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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/app_list/views/cached_label.h" 5 #include "ui/app_list/views/cached_label.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 10
11 namespace app_list { 11 namespace app_list {
12 12
13 CachedLabel::CachedLabel() 13 CachedLabel::CachedLabel()
14 : needs_repaint_(true) { 14 : needs_repaint_(true) {
15 } 15 }
16 16
17 void CachedLabel::PaintToBackingImage() { 17 void CachedLabel::PaintToBackingImage() {
18 if (image_.size() == size() && !needs_repaint_) 18 if (image_.size() == size() && !needs_repaint_)
19 return; 19 return;
20 gfx::Canvas canvas(size(), 1.0f, false /* is_opaque */); 20 gfx::Canvas canvas(size(), ui::SCALE_FACTOR_100P, false /* is_opaque */);
21 canvas.FillRect(GetLocalBounds(), SkColorSetARGB(0, 0, 0, 0), 21 canvas.FillRect(GetLocalBounds(), SkColorSetARGB(0, 0, 0, 0),
22 SkXfermode::kSrc_Mode); 22 SkXfermode::kSrc_Mode);
23 Label::OnPaint(&canvas); 23 Label::OnPaint(&canvas);
24 image_ = gfx::ImageSkia(canvas.ExtractImageRep()); 24 image_ = gfx::ImageSkia(canvas.ExtractImageRep());
25 needs_repaint_ = false; 25 needs_repaint_ = false;
26 } 26 }
27 27
28 #if defined(OS_WIN) 28 #if defined(OS_WIN)
29 void CachedLabel::OnPaint(gfx::Canvas* canvas) { 29 void CachedLabel::OnPaint(gfx::Canvas* canvas) {
30 PaintToBackingImage(); 30 PaintToBackingImage();
31 canvas->DrawImageInt(image_, 0, 0); 31 canvas->DrawImageInt(image_, 0, 0);
32 } 32 }
33 #endif 33 #endif
34 34
35 } // namespace app_list 35 } // namespace app_list
OLDNEW
« no previous file with comments | « trunk/src/ui/app_list/views/app_list_main_view.cc ('k') | trunk/src/ui/base/clipboard/clipboard_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698