2 * Copyright 2010 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef skgpu_Rectanizer_DEFINED
9 #define skgpu_Rectanizer_DEFINED
11 #include "include/gpu/GrTypes.h"
19 Rectanizer(int width, int height) : fWidth(width), fHeight(height) {
21 SkASSERT(height >= 0);
24 virtual ~Rectanizer() {}
26 virtual void reset() = 0;
28 int width() const { return fWidth; }
29 int height() const { return fHeight; }
31 // Attempt to add a rect. Return true on success; false on failure. If
32 // successful the position in the atlas is returned in 'loc'.
33 virtual bool addRect(int width, int height, SkIPoint16* loc) = 0;
34 virtual float percentFull() const = 0;
37 * Our factory, which returns the subclass du jour
39 static Rectanizer* Factory(int width, int height);
46 } // End of namespace skgpu