aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRectanizer_skyline.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-01 16:25:11 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-01 16:25:11 +0000
commit53e1e4d88a06db62898a3bf75751c042729d7160 (patch)
tree0d1eeab45c0a6d8276781e9cd24246df5d0d9f9d /src/gpu/GrRectanizer_skyline.cpp
parente3ff558a4baf4cb924e7513a81c8073ddae385fc (diff)
Minor changes to GrFontCache system.
The main change is parameterizing the GrAtlasMgr so it can have a different sized backing texture and a different number of plots. This is in support of the saveLayer cache which has a smaller backing texture and only one plot. R=jvanverth@google.com, bsalomon@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/217423014 git-svn-id: http://skia.googlecode.com/svn/trunk@14011 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrRectanizer_skyline.cpp')
-rwxr-xr-xsrc/gpu/GrRectanizer_skyline.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/gpu/GrRectanizer_skyline.cpp b/src/gpu/GrRectanizer_skyline.cpp
index a55451a896..d485ce3ff0 100755
--- a/src/gpu/GrRectanizer_skyline.cpp
+++ b/src/gpu/GrRectanizer_skyline.cpp
@@ -14,30 +14,30 @@
class GrRectanizerSkyline : public GrRectanizer {
public:
- GrRectanizerSkyline(int w, int h) : GrRectanizer(w, h) {
- reset();
+ GrRectanizerSkyline(int w, int h) : INHERITED(w, h) {
+ this->reset();
}
virtual ~GrRectanizerSkyline() {
}
- virtual void reset() {
+ virtual void reset() SK_OVERRIDE {
fAreaSoFar = 0;
fSkyline.reset();
SkylineSegment* seg = fSkyline.append(1);
seg->fX = 0;
seg->fY = 0;
- seg->fWidth = width();
+ seg->fWidth = this->width();
}
- virtual bool addRect(int w, int h, GrIPoint16* loc);
+ virtual bool addRect(int w, int h, GrIPoint16* loc) SK_OVERRIDE;
- virtual float percentFull() const {
+ virtual float percentFull() const SK_OVERRIDE {
return fAreaSoFar / ((float)this->width() * this->height());
}
- virtual int stripToPurge(int height) const { return -1; }
- virtual void purgeStripAtY(int yCoord) { }
+ virtual int stripToPurge(int height) const SK_OVERRIDE { return -1; }
+ virtual void purgeStripAtY(int yCoord) SK_OVERRIDE { }
///////////////////////////////////////////////////////////////////////////
@@ -53,6 +53,9 @@ public:
bool rectangleFits(int skylineIndex, int width, int height, int* y) const;
void addSkylineLevel(int skylineIndex, int x, int y, int width, int height);
+
+private:
+ typedef GrRectanizer INHERITED;
};
bool GrRectanizerSkyline::addRect(int width, int height, GrIPoint16* loc) {
@@ -104,13 +107,13 @@ bool GrRectanizerSkyline::rectangleFits(int skylineIndex, int width, int height,
int i = skylineIndex;
int y = fSkyline[skylineIndex].fY;
while (widthLeft > 0) {
- y = SkMax32(y, fSkyline[i].fY);
+ y = SkMax32(y, fSkyline[i].fY);
if (y + height > this->height()) {
return false;
}
- widthLeft -= fSkyline[i].fWidth;
- ++i;
- SkASSERT(i < fSkyline.count() || widthLeft <= 0);
+ widthLeft -= fSkyline[i].fWidth;
+ ++i;
+ SkASSERT(i < fSkyline.count() || widthLeft <= 0);
}
*ypos = y;
@@ -140,12 +143,12 @@ void GrRectanizerSkyline::addSkylineLevel(int skylineIndex, int x, int y, int wi
if (fSkyline[i].fWidth <= 0) {
fSkyline.remove(i);
--i;
- }
- else
+ } else {
break;
- }
- else
+ }
+ } else {
break;
+ }
}
// merge fSkylines