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

Unified Diff: src/core/SkRecorder.cpp

Issue 773433003: Force SkMatrix type while recording too. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase again Created 6 years 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 | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecords.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecorder.cpp
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 9ca4224a2a86b5a632e458e7081e6f523bf014db..5ba43099b76a015af5a500aa43346c21fbb1e808 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -74,13 +74,6 @@ private:
template <typename T>
static Reference<T> delay_copy(const T& x) { return Reference<T>(x); }
-// SkPath::getBounds() isn't thread safe unless we precache the bounds in a singlethreaded context.
-// Recording is a convenient time to do this, but we could delay it to between record and playback.
-static Reference<SkPath> force_path_bounds(const SkPath& p) {
- p.updateBoundsCache();
- return Reference<SkPath>(p);
-}
-
// Use copy() only for optional arguments, to be copied if present or skipped if not.
// (For most types we just pass by value and let copy constructors do their thing.)
template <typename T>
@@ -165,7 +158,7 @@ void SkRecorder::onDrawDrawable(SkCanvasDrawable* drawable) {
}
void SkRecorder::drawPath(const SkPath& path, const SkPaint& paint) {
- APPEND(DrawPath, delay_copy(paint), force_path_bounds(path));
+ APPEND(DrawPath, delay_copy(paint), delay_copy(path));
}
void SkRecorder::drawBitmap(const SkBitmap& bitmap,
@@ -251,8 +244,8 @@ void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkP
delay_copy(paint),
this->copy((const char*)text, byteLength),
byteLength,
- force_path_bounds(path),
- this->copy(matrix));
+ delay_copy(path),
+ matrix ? *matrix : SkMatrix::I());
}
void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
@@ -261,7 +254,7 @@ void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
}
void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, const SkPaint* paint) {
- APPEND(DrawPicture, this->copy(paint), pic, this->copy(matrix));
+ APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I());
}
void SkRecorder::drawVertices(VertexMode vmode,
@@ -348,7 +341,7 @@ void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
INHERITED(onClipPath, path, op, edgeStyle);
SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
- APPEND(ClipPath, this->devBounds(), force_path_bounds(path), opAA);
+ APPEND(ClipPath, this->devBounds(), delay_copy(path), opAA);
}
void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698