aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-11-21 08:48:35 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-21 08:48:35 -0800
commit42ddcd49060f64be57f00e651650154f9b4f3a08 (patch)
treef42044381cc8a017fe3d89f0d0aa3b3f84f2bbd2
parent4af267b11964d4a8acdb232ac46094c84d890e88 (diff)
All the small packing tweaks mentioned in the bug.
-rw-r--r--src/core/SkRecordDraw.cpp9
-rw-r--r--src/core/SkRecorder.cpp16
-rw-r--r--src/core/SkRecords.h18
3 files changed, 30 insertions, 13 deletions
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index aa2593fc73..7e35d8a2c7 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -103,7 +103,11 @@ DRAW(DrawBitmap, drawBitmap(shallow_copy(r.bitmap), r.left, r.top, r.paint));
DRAW(DrawBitmapMatrix, drawBitmapMatrix(shallow_copy(r.bitmap), r.matrix, r.paint));
DRAW(DrawBitmapNine, drawBitmapNine(shallow_copy(r.bitmap), r.center, r.dst, r.paint));
DRAW(DrawBitmapRectToRect,
- drawBitmapRectToRect(shallow_copy(r.bitmap), r.src, r.dst, r.paint, r.flags));
+ drawBitmapRectToRect(shallow_copy(r.bitmap), r.src, r.dst, r.paint,
+ SkCanvas::kNone_DrawBitmapRectFlag));
+DRAW(DrawBitmapRectToRectBleed,
+ drawBitmapRectToRect(shallow_copy(r.bitmap), r.src, r.dst, r.paint,
+ SkCanvas::kBleed_DrawBitmapRectFlag));
DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint));
DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint));
DRAW(DrawImageRect, drawImageRect(r.image, r.src, r.dst, r.paint));
@@ -415,6 +419,9 @@ private:
Bounds bounds(const DrawBitmapRectToRect& op) const {
return this->adjustAndMap(op.dst, op.paint);
}
+ Bounds bounds(const DrawBitmapRectToRectBleed& op) const {
+ return this->adjustAndMap(op.dst, op.paint);
+ }
Bounds bounds(const DrawBitmapNine& op) const {
return this->adjustAndMap(op.dst, op.paint);
}
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 33d89d9079..3252e59f62 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -152,7 +152,7 @@ void SkRecorder::drawPoints(PointMode mode,
size_t count,
const SkPoint pts[],
const SkPaint& paint) {
- APPEND(DrawPoints, delay_copy(paint), mode, count, this->copy(pts, count));
+ APPEND(DrawPoints, delay_copy(paint), mode, SkToUInt(count), this->copy(pts, count));
}
void SkRecorder::drawRect(const SkRect& rect, const SkPaint& paint) {
@@ -192,8 +192,14 @@ void SkRecorder::drawBitmapRectToRect(const SkBitmap& bitmap,
const SkRect& dst,
const SkPaint* paint,
DrawBitmapRectFlags flags) {
+ if (kBleed_DrawBitmapRectFlag == flags) {
+ APPEND(DrawBitmapRectToRectBleed,
+ this->copy(paint), delay_copy(bitmap), this->copy(src), dst);
+ return;
+ }
+ SkASSERT(kNone_DrawBitmapRectFlag == flags);
APPEND(DrawBitmapRectToRect,
- this->copy(paint), delay_copy(bitmap), this->copy(src), dst, flags);
+ this->copy(paint), delay_copy(bitmap), this->copy(src), dst);
}
void SkRecorder::drawBitmapMatrix(const SkBitmap& bitmap,
@@ -246,9 +252,9 @@ void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength,
APPEND(DrawPosTextH,
delay_copy(paint),
this->copy((const char*)text, byteLength),
- byteLength,
- this->copy(xpos, points),
- constY);
+ SkToUInt(byteLength),
+ constY,
+ this->copy(xpos, points));
}
void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h
index da0c884ae2..d6308a9130 100644
--- a/src/core/SkRecords.h
+++ b/src/core/SkRecords.h
@@ -45,6 +45,7 @@ namespace SkRecords {
M(DrawBitmapMatrix) \
M(DrawBitmapNine) \
M(DrawBitmapRectToRect) \
+ M(DrawBitmapRectToRectBleed) \
M(DrawDrawable) \
M(DrawImage) \
M(DrawImageRect) \
@@ -239,11 +240,14 @@ RECORD4(DrawBitmapNine, Optional<SkPaint>, paint,
ImmutableBitmap, bitmap,
SkIRect, center,
SkRect, dst);
-RECORD5(DrawBitmapRectToRect, Optional<SkPaint>, paint,
+RECORD4(DrawBitmapRectToRect, Optional<SkPaint>, paint,
ImmutableBitmap, bitmap,
Optional<SkRect>, src,
- SkRect, dst,
- SkCanvas::DrawBitmapRectFlags, flags);
+ SkRect, dst);
+RECORD4(DrawBitmapRectToRectBleed, Optional<SkPaint>, paint,
+ ImmutableBitmap, bitmap,
+ Optional<SkRect>, src,
+ SkRect, dst);
RECORD3(DrawDRRect, SkPaint, paint, SkRRect, outer, SkRRect, inner);
RECORD2(DrawDrawable, SkRect, worstCaseBounds, int32_t, index);
RECORD4(DrawImage, Optional<SkPaint>, paint,
@@ -260,16 +264,16 @@ RECORD2(DrawPath, SkPaint, paint, SkPath, path);
RECORD3(DrawPicture, Optional<SkPaint>, paint,
RefBox<const SkPicture>, picture,
Optional<SkMatrix>, matrix);
-RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, size_t, count, SkPoint*, pts);
+RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, unsigned, count, SkPoint*, pts);
RECORD4(DrawPosText, SkPaint, paint,
PODArray<char>, text,
size_t, byteLength,
PODArray<SkPoint>, pos);
RECORD5(DrawPosTextH, SkPaint, paint,
PODArray<char>, text,
- size_t, byteLength,
- PODArray<SkScalar>, xpos,
- SkScalar, y);
+ unsigned, byteLength,
+ SkScalar, y,
+ PODArray<SkScalar>, xpos);
RECORD2(DrawRRect, SkPaint, paint, SkRRect, rrect);
RECORD2(DrawRect, SkPaint, paint, SkRect, rect);
RECORD4(DrawSprite, Optional<SkPaint>, paint, ImmutableBitmap, bitmap, int, left, int, top);