OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
11 #include "GrRectanizer.h" | 11 #include "GrRectanizer.h" |
12 #include "GrTBSearch.h" | 12 #include "GrTBSearch.h" |
13 | 13 |
14 #define MIN_HEIGHT_POW2 2 | 14 #define MIN_HEIGHT_POW2 2 |
15 | 15 |
16 class GrRectanizerFIFO : public GrRectanizer { | 16 class GrRectanizerFIFO : public GrRectanizer { |
17 public: | 17 public: |
18 GrRectanizerFIFO(int w, int h) : GrRectanizer(w, h) { | 18 GrRectanizerFIFO(int w, int h) : GrRectanizer(w, h) { |
19 fNextStripY = 0; | 19 fNextStripY = 0; |
20 fAreaSoFar = 0; | 20 fAreaSoFar = 0; |
21 Gr_bzero(fRows, sizeof(fRows)); | 21 sk_bzero(fRows, sizeof(fRows)); |
22 } | 22 } |
23 | 23 |
24 virtual ~GrRectanizerFIFO() { | 24 virtual ~GrRectanizerFIFO() { |
25 } | 25 } |
26 | 26 |
27 virtual bool addRect(int w, int h, GrIPoint16* loc); | 27 virtual bool addRect(int w, int h, GrIPoint16* loc); |
28 | 28 |
29 virtual float percentFull() const { | 29 virtual float percentFull() const { |
30 return fAreaSoFar / ((float)this->width() * this->height()); | 30 return fAreaSoFar / ((float)this->width() * this->height()); |
31 } | 31 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 SkASSERT(fNextStripY <= this->height()); | 112 SkASSERT(fNextStripY <= this->height()); |
113 fAreaSoFar += area; | 113 fAreaSoFar += area; |
114 return true; | 114 return true; |
115 } | 115 } |
116 | 116 |
117 /////////////////////////////////////////////////////////////////////////////// | 117 /////////////////////////////////////////////////////////////////////////////// |
118 | 118 |
119 GrRectanizer* GrRectanizer::Factory(int width, int height) { | 119 GrRectanizer* GrRectanizer::Factory(int width, int height) { |
120 return SkNEW_ARGS(GrRectanizerFIFO, (width, height)); | 120 return SkNEW_ARGS(GrRectanizerFIFO, (width, height)); |
121 } | 121 } |
OLD | NEW |