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

Side by Side Diff: cc/base/index_rect.cc

Issue 2350563002: cc: Implement IndexRect for encapsulating tile indices. (Closed)
Patch Set: build break Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/base/index_rect.h"
6
7 #include "base/strings/stringprintf.h"
8
9 namespace cc {
10
11 void IndexRect::ClampTo(const IndexRect& other) {
12 left_ = std::max(left_, other.left());
13 top_ = std::max(top_, other.top());
14 right_ = std::min(right_, other.right());
15 bottom_ = std::min(bottom_, other.bottom());
16 }
17
18 bool IndexRect::Contains(int index_x, int index_y) const {
19 return index_x >= left_ && index_x <= right_ && index_y >= top_ &&
20 index_y <= bottom_;
21 }
22
23 std::string IndexRect::ToString() const {
24 return base::StringPrintf("%d,%d,%d,%d", left(), right(), top(), bottom());
25 }
26
27 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698