1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/gpu/GrRectanizer.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* 1.5 + * Copyright 2010 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef GrRectanizer_DEFINED 1.12 +#define GrRectanizer_DEFINED 1.13 + 1.14 +#include "GrPoint.h" 1.15 + 1.16 +class GrRectanizerPurgeListener { 1.17 +public: 1.18 + virtual ~GrRectanizerPurgeListener() {} 1.19 + 1.20 + virtual void notifyPurgeStrip(void*, int yCoord) = 0; 1.21 +}; 1.22 + 1.23 +class GrRectanizer { 1.24 +public: 1.25 + GrRectanizer(int width, int height) : fWidth(width), fHeight(height) { 1.26 + SkASSERT(width >= 0); 1.27 + SkASSERT(height >= 0); 1.28 + } 1.29 + 1.30 + virtual ~GrRectanizer() {} 1.31 + 1.32 + virtual void reset() = 0; 1.33 + 1.34 + int width() const { return fWidth; } 1.35 + int height() const { return fHeight; } 1.36 + 1.37 + virtual bool addRect(int width, int height, GrIPoint16* loc) = 0; 1.38 + virtual float percentFull() const = 0; 1.39 + 1.40 + // return the Y-coordinate of a strip that should be purged, given height 1.41 + // i.e. return the oldest such strip, or some other criteria. Return -1 1.42 + // if there is no candidate 1.43 + virtual int stripToPurge(int height) const = 0; 1.44 + virtual void purgeStripAtY(int yCoord) = 0; 1.45 + 1.46 + /** 1.47 + * Our factory, which returns the subclass du jour 1.48 + */ 1.49 + static GrRectanizer* Factory(int width, int height); 1.50 + 1.51 +private: 1.52 + int fWidth; 1.53 + int fHeight; 1.54 +}; 1.55 + 1.56 +#endif