OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrRectanizer_pow2_DEFINED | 8 #ifndef GrRectanizer_pow2_DEFINED |
9 #define GrRectanizer_pow2_DEFINED | 9 #define GrRectanizer_pow2_DEFINED |
10 | 10 |
11 #include "GrRectanizer.h" | 11 #include "GrRectanizer.h" |
| 12 #include "SkMathPriv.h" |
12 #include "SkPoint.h" | 13 #include "SkPoint.h" |
13 | 14 |
14 // This Rectanizer quantizes the incoming rects to powers of 2. Each power | 15 // This Rectanizer quantizes the incoming rects to powers of 2. Each power |
15 // of two can have, at most, one active row/shelf. Once a row/shelf for | 16 // of two can have, at most, one active row/shelf. Once a row/shelf for |
16 // a particular power of two gets full its fRows entry is recycled to point | 17 // a particular power of two gets full its fRows entry is recycled to point |
17 // to a new row. | 18 // to a new row. |
18 // The skyline algorithm almost always provides a better packing. | 19 // The skyline algorithm almost always provides a better packing. |
19 class GrRectanizerPow2 : public GrRectanizer { | 20 class GrRectanizerPow2 : public GrRectanizer { |
20 public: | 21 public: |
21 GrRectanizerPow2(int w, int h) : INHERITED(w, h) { | 22 GrRectanizerPow2(int w, int h) : INHERITED(w, h) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 void initRow(Row* row, int rowHeight) { | 71 void initRow(Row* row, int rowHeight) { |
71 row->fLoc.set(0, fNextStripY); | 72 row->fLoc.set(0, fNextStripY); |
72 row->fRowHeight = rowHeight; | 73 row->fRowHeight = rowHeight; |
73 fNextStripY += rowHeight; | 74 fNextStripY += rowHeight; |
74 } | 75 } |
75 | 76 |
76 typedef GrRectanizer INHERITED; | 77 typedef GrRectanizer INHERITED; |
77 }; | 78 }; |
78 | 79 |
79 #endif | 80 #endif |
OLD | NEW |