Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: src/core/SkPictureRecord.cpp

Issue 153983007: Clean up SkPictureRecord.cpp (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureRecord.cpp
===================================================================
--- src/core/SkPictureRecord.cpp (revision 13317)
+++ src/core/SkPictureRecord.cpp (working copy)
@@ -149,7 +149,7 @@
// op + flags
uint32_t size = kSaveSize;
size_t initialOffset = this->addDraw(SAVE, &size);
- addInt(flags);
+ this->addInt(flags);
this->validate(initialOffset, size);
}
@@ -188,10 +188,10 @@
SkASSERT(kSaveLayerNoBoundsSize == size || kSaveLayerWithBoundsSize == size);
size_t initialOffset = this->addDraw(SAVE_LAYER, &size);
- addRectPtr(bounds);
+ this->addRectPtr(bounds);
SkASSERT(initialOffset+getPaintOffset(SAVE_LAYER, size) == fWriter.bytesWritten());
- addPaintPtr(paint);
- addInt(flags);
+ this->addPaintPtr(paint);
+ this->addInt(flags);
this->validate(initialOffset, size);
}
@@ -614,7 +614,7 @@
void SkPictureRecord::recordRestore() {
uint32_t initialOffset, size;
- fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.bytesWritten());
+ this->fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.bytesWritten());
size = 1 * kUInt32Size; // RESTORE consists solely of 1 op code
initialOffset = this->addDraw(RESTORE, &size);
this->validate(initialOffset, size);
@@ -624,8 +624,8 @@
// op + dx + dy
uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
size_t initialOffset = this->addDraw(TRANSLATE, &size);
- addScalar(dx);
- addScalar(dy);
+ this->addScalar(dx);
+ this->addScalar(dy);
this->validate(initialOffset, size);
return this->INHERITED::translate(dx, dy);
}
@@ -634,8 +634,8 @@
// op + sx + sy
uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
size_t initialOffset = this->addDraw(SCALE, &size);
- addScalar(sx);
- addScalar(sy);
+ this->addScalar(sx);
+ this->addScalar(sy);
this->validate(initialOffset, size);
return this->INHERITED::scale(sx, sy);
}
@@ -644,7 +644,7 @@
// op + degrees
uint32_t size = 1 * kUInt32Size + sizeof(SkScalar);
size_t initialOffset = this->addDraw(ROTATE, &size);
- addScalar(degrees);
+ this->addScalar(degrees);
this->validate(initialOffset, size);
return this->INHERITED::rotate(degrees);
}
@@ -653,8 +653,8 @@
// op + sx + sy
uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
size_t initialOffset = this->addDraw(SKEW, &size);
- addScalar(sx);
- addScalar(sy);
+ this->addScalar(sx);
+ this->addScalar(sy);
this->validate(initialOffset, size);
return this->INHERITED::skew(sx, sy);
}
@@ -669,7 +669,7 @@
// op + matrix
uint32_t size = kUInt32Size + matrix.writeToMemory(NULL);
size_t initialOffset = this->addDraw(CONCAT, &size);
- addMatrix(matrix);
+ this->addMatrix(matrix);
this->validate(initialOffset, size);
}
@@ -678,7 +678,7 @@
// op + matrix
uint32_t size = kUInt32Size + matrix.writeToMemory(NULL);
size_t initialOffset = this->addDraw(SET_MATRIX, &size);
- addMatrix(matrix);
+ this->addMatrix(matrix);
this->validate(initialOffset, size);
this->INHERITED::setMatrix(matrix);
}
@@ -744,7 +744,7 @@
// be 0, disabling their ability to trigger a jump-to-restore, otherwise
// they could hide this clips ability to expand the clip (i.e. go from
// empty to non-empty).
- fillRestoreOffsetPlaceholdersForCurrentStackLevel(0);
+ this->fillRestoreOffsetPlaceholdersForCurrentStackLevel(0);
// Reset the pointer back to the previous clip so that subsequent
// restores don't overwrite the offsets we just cleared.
@@ -752,7 +752,7 @@
}
size_t offset = fWriter.bytesWritten();
- addInt(prevOffset);
+ this->addInt(prevOffset);
fRestoreOffsetStack.top() = offset;
return offset;
}
@@ -773,8 +773,8 @@
}
size_t initialOffset = this->addDraw(CLIP_RECT, &size);
- addRect(rect);
- addInt(ClipParams_pack(op, doAA));
+ this->addRect(rect);
+ this->addInt(ClipParams_pack(op, doAA));
int offset = this->recordRestoreOffsetPlaceholder(op);
this->validate(initialOffset, size);
@@ -804,8 +804,8 @@
size += kUInt32Size;
}
size_t initialOffset = this->addDraw(CLIP_RRECT, &size);
- addRRect(rrect);
- addInt(ClipParams_pack(op, doAA));
+ this->addRRect(rrect);
+ this->addInt(ClipParams_pack(op, doAA));
int offset = recordRestoreOffsetPlaceholder(op);
this->validate(initialOffset, size);
@@ -840,8 +840,8 @@
size += kUInt32Size;
}
size_t initialOffset = this->addDraw(CLIP_PATH, &size);
- addInt(pathID);
- addInt(ClipParams_pack(op, doAA));
+ this->addInt(pathID);
+ this->addInt(ClipParams_pack(op, doAA));
int offset = recordRestoreOffsetPlaceholder(op);
this->validate(initialOffset, size);
@@ -862,9 +862,9 @@
size += kUInt32Size;
}
size_t initialOffset = this->addDraw(CLIP_REGION, &size);
- addRegion(region);
- addInt(ClipParams_pack(op, false));
- int offset = recordRestoreOffsetPlaceholder(op);
+ this->addRegion(region);
+ this->addInt(ClipParams_pack(op, false));
+ int offset = this->recordRestoreOffsetPlaceholder(op);
this->validate(initialOffset, size);
return offset;
@@ -874,7 +874,7 @@
// op + color
uint32_t size = 2 * kUInt32Size;
size_t initialOffset = this->addDraw(DRAW_CLEAR, &size);
- addInt(color);
+ this->addInt(color);
this->validate(initialOffset, size);
}
@@ -883,7 +883,7 @@
uint32_t size = 2 * kUInt32Size;
size_t initialOffset = this->addDraw(DRAW_PAINT, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_PAINT, size) == fWriter.bytesWritten());
- addPaint(paint);
+ this->addPaint(paint);
this->validate(initialOffset, size);
}
@@ -893,9 +893,9 @@
uint32_t size = 4 * kUInt32Size + count * sizeof(SkPoint);
size_t initialOffset = this->addDraw(DRAW_POINTS, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_POINTS, size) == fWriter.bytesWritten());
- addPaint(paint);
- addInt(mode);
- addInt(count);
+ this->addPaint(paint);
+ this->addInt(mode);
+ this->addInt(count);
fWriter.writeMul4(pts, count * sizeof(SkPoint));
this->validate(initialOffset, size);
}
@@ -905,8 +905,8 @@
uint32_t size = 2 * kUInt32Size + sizeof(oval);
size_t initialOffset = this->addDraw(DRAW_OVAL, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.bytesWritten());
- addPaint(paint);
- addRect(oval);
+ this->addPaint(paint);
+ this->addRect(oval);
this->validate(initialOffset, size);
}
@@ -915,8 +915,8 @@
uint32_t size = 2 * kUInt32Size + sizeof(rect);
size_t initialOffset = this->addDraw(DRAW_RECT, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.bytesWritten());
- addPaint(paint);
- addRect(rect);
+ this->addPaint(paint);
+ this->addRect(rect);
this->validate(initialOffset, size);
}
@@ -931,8 +931,8 @@
size = 2 * kUInt32Size + SkRRect::kSizeInMemory;
initialOffset = this->addDraw(DRAW_RRECT, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.bytesWritten());
- addPaint(paint);
- addRRect(rrect);
+ this->addPaint(paint);
+ this->addRRect(rrect);
this->validate(initialOffset, size);
}
}
@@ -942,8 +942,8 @@
uint32_t size = 3 * kUInt32Size;
size_t initialOffset = this->addDraw(DRAW_PATH, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritten());
- addPaint(paint);
- addPath(path);
+ this->addPaint(paint);
+ this->addPath(path);
this->validate(initialOffset, size);
}
@@ -953,10 +953,10 @@
uint32_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar);
size_t initialOffset = this->addDraw(DRAW_BITMAP, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.bytesWritten());
- addPaintPtr(paint);
- addBitmap(bitmap);
- addScalar(left);
- addScalar(top);
+ this->addPaintPtr(paint);
+ this->addBitmap(bitmap);
+ this->addScalar(left);
+ this->addScalar(top);
this->validate(initialOffset, size);
}
@@ -972,11 +972,11 @@
size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWriter.bytesWritten());
- addPaintPtr(paint);
- addBitmap(bitmap);
- addRectPtr(src); // may be null
- addRect(dst);
- addInt(flags);
+ this->addPaintPtr(paint);
+ this->addBitmap(bitmap);
+ this->addRectPtr(src); // may be null
+ this->addRect(dst);
+ this->addInt(flags);
this->validate(initialOffset, size);
}
@@ -986,9 +986,9 @@
uint32_t size = 3 * kUInt32Size + matrix.writeToMemory(NULL);
size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.bytesWritten());
- addPaintPtr(paint);
- addBitmap(bitmap);
- addMatrix(matrix);
+ this->addPaintPtr(paint);
+ this->addBitmap(bitmap);
+ this->addMatrix(matrix);
this->validate(initialOffset, size);
}
@@ -998,10 +998,10 @@
uint32_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst);
size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.bytesWritten());
- addPaintPtr(paint);
- addBitmap(bitmap);
- addIRect(center);
- addRect(dst);
+ this->addPaintPtr(paint);
+ this->addBitmap(bitmap);
+ this->addIRect(center);
+ this->addRect(dst);
this->validate(initialOffset, size);
}
@@ -1011,10 +1011,10 @@
uint32_t size = 5 * kUInt32Size;
size_t initialOffset = this->addDraw(DRAW_SPRITE, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_SPRITE, size) == fWriter.bytesWritten());
- addPaintPtr(paint);
- addBitmap(bitmap);
- addInt(left);
- addInt(top);
+ this->addPaintPtr(paint);
+ this->addBitmap(bitmap);
+ this->addInt(left);
+ this->addInt(top);
this->validate(initialOffset, size);
}
@@ -1033,8 +1033,8 @@
void SkPictureRecord::addFontMetricsTopBottom(const SkPaint& paint, const SkFlatData& flat,
SkScalar minY, SkScalar maxY) {
WriteTopBot(paint, flat);
- addScalar(flat.topBot()[0] + minY);
- addScalar(flat.topBot()[1] + maxY);
+ this->addScalar(flat.topBot()[0] + minY);
+ this->addScalar(flat.topBot()[1] + maxY);
}
void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x,
@@ -1052,11 +1052,11 @@
SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten());
const SkFlatData* flatPaintData = addPaint(paint);
SkASSERT(flatPaintData);
- addText(text, byteLength);
- addScalar(x);
- addScalar(y);
+ this->addText(text, byteLength);
+ this->addScalar(x);
+ this->addScalar(y);
if (fast) {
- addFontMetricsTopBottom(paint, *flatPaintData, y, y);
+ this->addFontMetricsTopBottom(paint, *flatPaintData, y, y);
}
this->validate(initialOffset, size);
}
@@ -1116,26 +1116,26 @@
}
size_t initialOffset = this->addDraw(op, &size);
SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten());
- const SkFlatData* flatPaintData = addPaint(paint);
+ const SkFlatData* flatPaintData = this->addPaint(paint);
SkASSERT(flatPaintData);
- addText(text, byteLength);
- addInt(points);
+ this->addText(text, byteLength);
+ this->addInt(points);
#ifdef SK_DEBUG_SIZE
size_t start = fWriter.bytesWritten();
#endif
if (canUseDrawH) {
if (fast) {
- addFontMetricsTopBottom(paint, *flatPaintData, pos[0].fY, pos[0].fY);
+ this->addFontMetricsTopBottom(paint, *flatPaintData, pos[0].fY, pos[0].fY);
}
- addScalar(pos[0].fY);
+ this->addScalar(pos[0].fY);
SkScalar* xptr = (SkScalar*)fWriter.reserve(points * sizeof(SkScalar));
for (size_t index = 0; index < points; index++)
*xptr++ = pos[index].fX;
} else {
fWriter.writeMul4(pos, points * sizeof(SkPoint));
if (fastBounds) {
- addFontMetricsTopBottom(paint, *flatPaintData, minY, maxY);
+ this->addFontMetricsTopBottom(paint, *flatPaintData, minY, maxY);
}
}
#ifdef SK_DEBUG_SIZE
@@ -1150,7 +1150,7 @@
const SkPaint& paint) {
const SkFlatData* flatPaintData = this->getFlatPaintData(paint);
- drawPosTextHImpl(text, byteLength, xpos, constY, paint, flatPaintData);
+ this->drawPosTextHImpl(text, byteLength, xpos, constY, paint, flatPaintData);
}
void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength,
@@ -1170,20 +1170,20 @@
// + y + the actual points
size += 1 * kUInt32Size + points * sizeof(SkScalar);
size_t initialOffset = this->addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRAW_POS_TEXT_H,
- &size);
+ &size);
SkASSERT(flatPaintData);
- addFlatPaint(flatPaintData);
+ this->addFlatPaint(flatPaintData);
- addText(text, byteLength);
- addInt(points);
+ this->addText(text, byteLength);
+ this->addInt(points);
#ifdef SK_DEBUG_SIZE
size_t start = fWriter.bytesWritten();
#endif
if (fast) {
- addFontMetricsTopBottom(paint, *flatPaintData, constY, constY);
+ this->addFontMetricsTopBottom(paint, *flatPaintData, constY, constY);
}
- addScalar(constY);
+ this->addScalar(constY);
fWriter.writeMul4(xpos, points * sizeof(SkScalar));
#ifdef SK_DEBUG_SIZE
fPointBytes += fWriter.bytesWritten() - start;
@@ -1200,10 +1200,10 @@
uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.writeToMemory(NULL);
size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.bytesWritten());
- addPaint(paint);
- addText(text, byteLength);
- addPath(path);
- addMatrix(m);
+ this->addPaint(paint);
+ this->addText(text, byteLength);
+ this->addPath(path);
+ this->addMatrix(m);
this->validate(initialOffset, size);
}
@@ -1211,7 +1211,7 @@
// op + picture index
uint32_t size = 2 * kUInt32Size;
size_t initialOffset = this->addDraw(DRAW_PICTURE, &size);
- addPicture(picture);
+ this->addPicture(picture);
this->validate(initialOffset, size);
}
@@ -1255,25 +1255,25 @@
size_t initialOffset = this->addDraw(DRAW_VERTICES, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_VERTICES, size) == fWriter.bytesWritten());
- addPaint(paint);
- addInt(flags);
- addInt(vmode);
- addInt(vertexCount);
- addPoints(vertices, vertexCount);
+ this->addPaint(paint);
+ this->addInt(flags);
+ this->addInt(vmode);
+ this->addInt(vertexCount);
+ this->addPoints(vertices, vertexCount);
if (flags & DRAW_VERTICES_HAS_TEXS) {
- addPoints(texs, vertexCount);
+ this->addPoints(texs, vertexCount);
}
if (flags & DRAW_VERTICES_HAS_COLORS) {
fWriter.writeMul4(colors, vertexCount * sizeof(SkColor));
}
if (flags & DRAW_VERTICES_HAS_INDICES) {
- addInt(indexCount);
+ this->addInt(indexCount);
fWriter.writePad(indices, indexCount * sizeof(uint16_t));
}
if (flags & DRAW_VERTICES_HAS_XFER) {
SkXfermode::Mode mode = SkXfermode::kModulate_Mode;
(void)xfer->asMode(&mode);
- addInt(mode);
+ this->addInt(mode);
}
this->validate(initialOffset, size);
}
@@ -1282,7 +1282,7 @@
// op + length + 'length' worth of data
uint32_t size = 2 * kUInt32Size + SkAlign4(length);
size_t initialOffset = this->addDraw(DRAW_DATA, &size);
- addInt(length);
+ this->addInt(length);
fWriter.writePad(data, length);
this->validate(initialOffset, size);
}
@@ -1322,7 +1322,7 @@
// release builds, the invalid value will be recorded so that the reader will know that there
// was a problem.
SkASSERT(index != SkBitmapHeap::INVALID_SLOT);
- addInt(index);
+ this->addInt(index);
}
void SkPictureRecord::addMatrix(const SkMatrix& matrix) {
@@ -1352,7 +1352,7 @@
}
void SkPictureRecord::addPath(const SkPath& path) {
- addInt(this->addPathToHeap(path));
+ this->addInt(this->addPathToHeap(path));
}
void SkPictureRecord::addPicture(SkPicture& picture) {
@@ -1363,7 +1363,7 @@
picture.ref();
}
// follow the convention of recording a 1-based index
- addInt(index + 1);
+ this->addInt(index + 1);
}
void SkPictureRecord::addPoint(const SkPoint& point) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698