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

Unified Diff: src/pipe/SkGPipeWrite.cpp

Issue 130913018: Templetized SkWriter32 readTAt() & overwriteTAt() (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Win build fix 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
Index: src/pipe/SkGPipeWrite.cpp
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 54e3bead69d81dfc54c7c3e3acdae92640f4830d..49e68c18ae12054ef408bdc13daeaf5c79fc1889 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -457,7 +457,7 @@ SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
(BITMAPS_TO_KEEP, controller->numberOfReaders()));
if (this->needOpBytes(sizeof(void*))) {
this->writeOp(kShareBitmapHeap_DrawOp);
- fWriter.writePtr(static_cast<void*>(fBitmapHeap));
+ fWriter.writeT<void*>(fBitmapHeap);
mtklein 2014/02/06 21:38:16 This guy strikes me as weird now. If we're going
f(malita) 2014/02/10 16:10:35 Good point (mechanical refactor). Since we're not
}
}
fFlattenableHeap.setBitmapStorage(fBitmapHeap);
@@ -541,7 +541,7 @@ int SkGPipeCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
if (this->needOpBytes(size)) {
this->writeOp(kSaveLayer_DrawOp, opFlags, saveFlags);
if (bounds) {
- fWriter.writeRect(*bounds);
+ fWriter.writeT<SkRect>(*bounds);
}
}
@@ -574,8 +574,8 @@ bool SkGPipeCanvas::translate(SkScalar dx, SkScalar dy) {
NOTIFY_SETUP(this);
if (this->needOpBytes(2 * sizeof(SkScalar))) {
this->writeOp(kTranslate_DrawOp);
- fWriter.writeScalar(dx);
- fWriter.writeScalar(dy);
+ fWriter.writeT<SkScalar>(dx);
+ fWriter.writeT<SkScalar>(dy);
}
}
return this->INHERITED::translate(dx, dy);
@@ -586,8 +586,8 @@ bool SkGPipeCanvas::scale(SkScalar sx, SkScalar sy) {
NOTIFY_SETUP(this);
if (this->needOpBytes(2 * sizeof(SkScalar))) {
this->writeOp(kScale_DrawOp);
- fWriter.writeScalar(sx);
- fWriter.writeScalar(sy);
+ fWriter.writeT<SkScalar>(sx);
+ fWriter.writeT<SkScalar>(sy);
}
}
return this->INHERITED::scale(sx, sy);
@@ -598,7 +598,7 @@ bool SkGPipeCanvas::rotate(SkScalar degrees) {
NOTIFY_SETUP(this);
if (this->needOpBytes(sizeof(SkScalar))) {
this->writeOp(kRotate_DrawOp);
- fWriter.writeScalar(degrees);
+ fWriter.writeT<SkScalar>(degrees);
}
}
return this->INHERITED::rotate(degrees);
@@ -609,8 +609,8 @@ bool SkGPipeCanvas::skew(SkScalar sx, SkScalar sy) {
NOTIFY_SETUP(this);
if (this->needOpBytes(2 * sizeof(SkScalar))) {
this->writeOp(kSkew_DrawOp);
- fWriter.writeScalar(sx);
- fWriter.writeScalar(sy);
+ fWriter.writeT<SkScalar>(sx);
+ fWriter.writeT<SkScalar>(sy);
}
}
return this->INHERITED::skew(sx, sy);
@@ -642,7 +642,7 @@ bool SkGPipeCanvas::clipRect(const SkRect& rect, SkRegion::Op rgnOp,
if (this->needOpBytes(sizeof(SkRect))) {
unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag;
this->writeOp(kClipRect_DrawOp, flags, rgnOp);
- fWriter.writeRect(rect);
+ fWriter.writeT<SkRect>(rect);
}
return this->INHERITED::clipRect(rect, rgnOp, doAntiAlias);
}
@@ -721,7 +721,7 @@ void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
this->writePaint(paint);
if (this->needOpBytes(sizeof(SkRect))) {
this->writeOp(kDrawOval_DrawOp);
- fWriter.writeRect(rect);
+ fWriter.writeT<SkRect>(rect);
}
}
@@ -730,7 +730,7 @@ void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
this->writePaint(paint);
if (this->needOpBytes(sizeof(SkRect))) {
this->writeOp(kDrawRect_DrawOp);
- fWriter.writeRect(rect);
+ fWriter.writeT<SkRect>(rect);
}
}
@@ -778,8 +778,8 @@ void SkGPipeCanvas::drawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top,
size_t opBytesNeeded = sizeof(SkScalar) * 2;
if (this->commonDrawBitmap(bm, kDrawBitmap_DrawOp, 0, opBytesNeeded, paint)) {
- fWriter.writeScalar(left);
- fWriter.writeScalar(top);
+ fWriter.writeT<SkScalar>(left);
+ fWriter.writeT<SkScalar>(top);
}
}
@@ -802,9 +802,9 @@ void SkGPipeCanvas::drawBitmapRectToRect(const SkBitmap& bm, const SkRect* src,
if (this->commonDrawBitmap(bm, kDrawBitmapRectToRect_DrawOp, flags, opBytesNeeded, paint)) {
if (hasSrc) {
- fWriter.writeRect(*src);
+ fWriter.writeT<SkRect>(*src);
}
- fWriter.writeRect(dst);
+ fWriter.writeT<SkRect>(dst);
}
}
@@ -828,7 +828,7 @@ void SkGPipeCanvas::drawBitmapNine(const SkBitmap& bm, const SkIRect& center,
fWriter.write32(center.fTop);
fWriter.write32(center.fRight);
fWriter.write32(center.fBottom);
- fWriter.writeRect(dst);
+ fWriter.writeT<SkRect>(dst);
}
}
@@ -852,8 +852,8 @@ void SkGPipeCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
this->writeOp(kDrawText_DrawOp);
fWriter.write32(byteLength);
fWriter.writePad(text, byteLength);
- fWriter.writeScalar(x);
- fWriter.writeScalar(y);
+ fWriter.writeT<SkScalar>(x);
+ fWriter.writeT<SkScalar>(y);
}
}
}
@@ -887,7 +887,7 @@ void SkGPipeCanvas::drawPosTextH(const void* text, size_t byteLength,
fWriter.writePad(text, byteLength);
fWriter.write32(count);
fWriter.write(xpos, count * sizeof(SkScalar));
- fWriter.writeScalar(constY);
+ fWriter.writeT<SkScalar>(constY);
}
}
}
@@ -1106,7 +1106,7 @@ void SkGPipeCanvas::writePaint(const SkPaint& paint) {
// of the paint unless we ever send a kReset_PaintOp, which we
// currently never do.
this->writeOp(kSetTypeface_DrawOp);
- fWriter.writePtr(paint.getTypeface());
+ fWriter.writeT<void*>(paint.getTypeface());
}
base.setTypeface(paint.getTypeface());
}

Powered by Google App Engine
This is Rietveld 408576698