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

Side by Side Diff: ui/gfx/rect_base_impl.h

Issue 25015003: gfx: Create a separate gfx component out of ui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/gfx_export.h ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gfx/rect_base.h" 5 #include "ui/gfx/rect_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 9
10 // This file provides the implementation for RectBaese template and 10 // This file provides the implementation for RectBaese template and
11 // used to instantiate the base class for Rect and RectF classes. 11 // used to instantiate the base class for Rect and RectF classes.
12 #if !defined(UI_IMPLEMENTATION) 12 #if !defined(GFX_IMPLEMENTATION)
13 #error "This file is intended for UI implementation only" 13 #error "This file is intended for UI implementation only"
14 #endif 14 #endif
15 15
16 namespace { 16 namespace {
17 17
18 template<typename Type> 18 template<typename Type>
19 void AdjustAlongAxis(Type dst_origin, Type dst_size, Type* origin, Type* size) { 19 void AdjustAlongAxis(Type dst_origin, Type dst_size, Type* origin, Type* size) {
20 *size = std::min(dst_size, *size); 20 *size = std::min(dst_size, *size);
21 if (*origin < dst_origin) 21 if (*origin < dst_origin)
22 *origin = dst_origin; 22 *origin = dst_origin;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ManhattanDistanceToPoint(const PointClass& point) const { 324 ManhattanDistanceToPoint(const PointClass& point) const {
325 Type x_distance = std::max<Type>(0, std::max( 325 Type x_distance = std::max<Type>(0, std::max(
326 x() - point.x(), point.x() - right())); 326 x() - point.x(), point.x() - right()));
327 Type y_distance = std::max<Type>(0, std::max( 327 Type y_distance = std::max<Type>(0, std::max(
328 y() - point.y(), point.y() - bottom())); 328 y() - point.y(), point.y() - bottom()));
329 329
330 return x_distance + y_distance; 330 return x_distance + y_distance;
331 } 331 }
332 332
333 } // namespace gfx 333 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gfx_export.h ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698