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

Unified Diff: ash/display/display_util_x11.cc

Issue 23286003: ash: Get output info from chromeos instead of XRandR. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use index from XRandR Created 7 years, 4 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 | « ash/display/display_util_x11.h ('k') | ash/display/display_util_x11_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_util_x11.cc
diff --git a/ash/display/display_util_x11.cc b/ash/display/display_util_x11.cc
deleted file mode 100644
index 984ed53f135d8b1b33cc011620deb0fe73f7e2c6..0000000000000000000000000000000000000000
--- a/ash/display/display_util_x11.cc
+++ /dev/null
@@ -1,97 +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 "ash/display/display_util_x11.h"
-
-#include <algorithm>
-#include <map>
-#include <X11/extensions/Xrandr.h>
-
-#include "ash/display/display_info.h"
-#include "base/logging.h"
-#include "chromeos/display/output_util.h"
-
-namespace ash {
-namespace internal {
-namespace {
-
-// A list of bogus sizes in mm that X detects that should be ignored.
-// See crbug.com/136533. The first element maintains the minimum
-// size required to be valid size.
-const unsigned long kInvalidDisplaySizeList[][2] = {
- {40, 30},
- {50, 40},
- {160, 90},
- {160, 100},
-};
-
-// Resolution list are sorted by the area in pixels and the larger
-// one comes first.
-struct ResolutionSorter {
- bool operator()(const Resolution& a, const Resolution& b) {
- return a.size.width() * a.size.height() > b.size.width() * b.size.height();
- }
-};
-
-} // namespace
-
-bool ShouldIgnoreSize(unsigned long mm_width, unsigned long mm_height) {
- // Ignore if the reported display is smaller than minimum size.
- if (mm_width <= kInvalidDisplaySizeList[0][0] ||
- mm_height <= kInvalidDisplaySizeList[0][1]) {
- LOG(WARNING) << "Smaller than minimum display size";
- return true;
- }
- for (unsigned long i = 1 ; i < arraysize(kInvalidDisplaySizeList); ++i) {
- const unsigned long* size = kInvalidDisplaySizeList[i];
- if (mm_width == size[0] && mm_height == size[1]) {
- LOG(WARNING) << "Black listed display size detected:"
- << size[0] << "x" << size[1];
- return true;
- }
- }
- return false;
-}
-
-std::vector<Resolution> GetResolutionList(
- XRRScreenResources* screen_resources,
- XRROutputInfo* output_info) {
- typedef std::map<std::pair<int,int>, Resolution> ResolutionMap;
-
- ResolutionMap resolution_map;
-
- for (int i = 0; i < output_info->nmode; i++) {
- RRMode mode = output_info->modes[i];
- const XRRModeInfo* info = chromeos::FindXRRModeInfo(screen_resources, mode);
- DCHECK(info);
- // Just ignore bad entry on Release build.
- if (!info)
- continue;
- ResolutionMap::key_type size = std::make_pair(info->width, info->height);
- bool interlaced = (info->modeFlags & RR_Interlace) != 0;
-
- ResolutionMap::iterator iter = resolution_map.find(size);
-
- // Add new resolution if it's new size or override interlaced mode.
- if (iter == resolution_map.end()) {
- resolution_map.insert(ResolutionMap::value_type(
- size,
- Resolution(gfx::Size(info->width, info->height), interlaced)));
- } else if (iter->second.interlaced && !interlaced) {
- iter->second.interlaced = false;
- }
- }
-
- std::vector<Resolution> resolution_list;
- for (ResolutionMap::const_iterator iter = resolution_map.begin();
- iter != resolution_map.end();
- ++iter) {
- resolution_list.push_back(iter->second);
- }
- std::sort(resolution_list.begin(), resolution_list.end(), ResolutionSorter());
- return resolution_list;
-}
-
-} // namespace internal
-} // namespace ash
« no previous file with comments | « ash/display/display_util_x11.h ('k') | ash/display/display_util_x11_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698