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

Unified Diff: cc/base/pyramid_sequence.h

Issue 2067213002: cc: Implement tile iteration order based on pyramid sequence. [old] Base URL: https://chromium.googlesource.com/chromium/src.git@tiling_data_fix
Patch Set: tild Created 4 years, 6 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
Index: cc/base/pyramid_sequence.h
diff --git a/cc/base/pyramid_sequence.h b/cc/base/pyramid_sequence.h
new file mode 100644
index 0000000000000000000000000000000000000000..dbfb74b3519ef1091a1f731c39e99e43951a0504
--- /dev/null
+++ b/cc/base/pyramid_sequence.h
@@ -0,0 +1,60 @@
+// Copyright 2016 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.
+
+#ifndef CC_BASE_PYRAMID_SEQUENCE_H_
+#define CC_BASE_PYRAMID_SEQUENCE_H_
+
+#include "base/logging.h"
+#include "cc/base/cc_export.h"
+
+namespace cc {
+
+class CC_EXPORT PyramidSequence {
vmpstr 2016/06/16 18:28:58 Can you put a comprehensive comment here explainin
+ public:
+ enum class Type : uint16_t {
+ FORWARD,
+ BACKWARD,
+ DIAGONAL_FORWARD,
+ DIAGONAL_BACKWARD
+ };
+
+ PyramidSequence(Type type, int start, int end, int levels);
vmpstr 2016/06/16 18:28:58 This needs a comment to explain what each variable
+ ~PyramidSequence();
+
+ int GetCurrent();
vmpstr 2016/06/16 18:28:58 Name this better... GetCurrent what?
+ int GetCoverage();
+ bool within_bounds() { return within_bounds_; }
vmpstr 2016/06/16 18:28:58 is_within_bounds
+ void Advance();
+
+ private:
+ typedef void (PyramidSequence::*InflateFn)();
vmpstr 2016/06/16 18:28:58 using InflateFn = void (PyramidSequence::*)();
+ typedef bool (PyramidSequence::*IsWithinBoundsFn)();
+
+ void Init(Type type);
+ void Reset();
+
+ void InflateForward();
+ bool IsWithinBoundsForward();
+ void InflateBackward();
+ bool IsWithinBoundsBackward();
+ void InflateDiagonalForward();
+ bool IsWithinBoundsDiagonalForward();
+ void InflateDiagonalBackward();
+ bool IsWithinBoundsDiagonalBackward();
+
+ int start_;
+ int end_;
+ int levels_;
+ int levels_traversed_;
+ bool within_bounds_;
+ int current_;
+ int step_;
+
+ InflateFn inflater_;
vmpstr 2016/06/16 18:28:58 I'd call this "inflate_" and "determine_within_bou
+ IsWithinBoundsFn within_bounds_checker_;
+};
+
+} // namespace cc
+
+#endif // CC_BASE_PYRAMID_SEQUENCE_H_
« no previous file with comments | « cc/base/BUILD.gn ('k') | cc/base/pyramid_sequence.cc » ('j') | cc/base/pyramid_sequence.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698