| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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_DEFINED | 8 #ifndef GrRectanizer_DEFINED |
| 9 #define GrRectanizer_DEFINED | 9 #define GrRectanizer_DEFINED |
| 10 | 10 |
| 11 #include "GrPoint.h" | 11 #include "GrPoint.h" |
| 12 | 12 |
| 13 class GrRectanizerPurgeListener { | 13 class GrRectanizerPurgeListener { |
| 14 public: | 14 public: |
| 15 virtual ~GrRectanizerPurgeListener() {} | 15 virtual ~GrRectanizerPurgeListener() {} |
| 16 | 16 |
| 17 virtual void notifyPurgeStrip(void*, int yCoord) = 0; | 17 virtual void notifyPurgeStrip(void*, int yCoord) = 0; |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 class GrRectanizer { | 20 class GrRectanizer { |
| 21 public: | 21 public: |
| 22 GrRectanizer(int width, int height) : fWidth(width), fHeight(height) { | 22 GrRectanizer(int width, int height) : fWidth(width), fHeight(height) { |
| 23 GrAssert(width >= 0); | 23 SkASSERT(width >= 0); |
| 24 GrAssert(height >= 0); | 24 SkASSERT(height >= 0); |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual ~GrRectanizer() {} | 27 virtual ~GrRectanizer() {} |
| 28 | 28 |
| 29 int width() const { return fWidth; } | 29 int width() const { return fWidth; } |
| 30 int height() const { return fHeight; } | 30 int height() const { return fHeight; } |
| 31 | 31 |
| 32 virtual bool addRect(int width, int height, GrIPoint16* loc) = 0; | 32 virtual bool addRect(int width, int height, GrIPoint16* loc) = 0; |
| 33 virtual float percentFull() const = 0; | 33 virtual float percentFull() const = 0; |
| 34 | 34 |
| 35 // return the Y-coordinate of a strip that should be purged, given height | 35 // return the Y-coordinate of a strip that should be purged, given height |
| 36 // i.e. return the oldest such strip, or some other criteria. Return -1 | 36 // i.e. return the oldest such strip, or some other criteria. Return -1 |
| 37 // if there is no candidate | 37 // if there is no candidate |
| 38 virtual int stripToPurge(int height) const = 0; | 38 virtual int stripToPurge(int height) const = 0; |
| 39 virtual void purgeStripAtY(int yCoord) = 0; | 39 virtual void purgeStripAtY(int yCoord) = 0; |
| 40 | 40 |
| 41 /** | 41 /** |
| 42 * Our factory, which returns the subclass du jour | 42 * Our factory, which returns the subclass du jour |
| 43 */ | 43 */ |
| 44 static GrRectanizer* Factory(int width, int height); | 44 static GrRectanizer* Factory(int width, int height); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 int fWidth; | 47 int fWidth; |
| 48 int fHeight; | 48 int fHeight; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 #endif | 51 #endif |
| OLD | NEW |