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

Unified Diff: ui/app_list/views/cached_label.cc

Issue 645853013: Remove some platform specific stuff from views. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 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 | « ui/app_list/views/cached_label.h ('k') | ui/app_list/views/contents_switcher_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/cached_label.cc
diff --git a/ui/app_list/views/cached_label.cc b/ui/app_list/views/cached_label.cc
deleted file mode 100644
index 4499842d842a0f210b8c5d80a2dd16218ced2fd6..0000000000000000000000000000000000000000
--- a/ui/app_list/views/cached_label.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/app_list/views/cached_label.h"
-
-#include "base/strings/utf_string_conversions.h"
-#include "ui/base/layout.h"
-#include "ui/gfx/canvas.h"
-#include "ui/views/widget/widget.h"
-
-namespace app_list {
-
-CachedLabel::CachedLabel()
- : needs_repaint_(true) {
-}
-
-void CachedLabel::PaintToBackingImage() {
- if (image_.size() == size() && !needs_repaint_)
- return;
-
- bool is_opaque = SkColorGetA(background_color()) == 0xFF;
- float scale_factor =
- ui::GetScaleFactorForNativeView(GetWidget()->GetNativeView());
- gfx::Canvas canvas(size(), scale_factor, is_opaque);
- // If a background is provided, it will initialize the canvas in
- // View::OnPaintBackground(). Otherwise, the background must be set here.
- if (!background()) {
- canvas.FillRect(
- GetLocalBounds(), background_color(), SkXfermode::kSrc_Mode);
- }
- Label::OnPaint(&canvas);
- image_ = gfx::ImageSkia(canvas.ExtractImageRep());
- needs_repaint_ = false;
-}
-
-#if defined(OS_WIN)
-void CachedLabel::OnPaint(gfx::Canvas* canvas) {
- PaintToBackingImage();
- canvas->DrawImageInt(image_, 0, 0);
-}
-#endif
-
-void CachedLabel::OnDeviceScaleFactorChanged(
- float device_scale_factor) {
- Invalidate();
- View::OnDeviceScaleFactorChanged(device_scale_factor);
-}
-
-} // namespace app_list
« no previous file with comments | « ui/app_list/views/cached_label.h ('k') | ui/app_list/views/contents_switcher_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698