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

Unified Diff: src/core/SkPictureRecord.cpp

Issue 324293004: Remove picture pre-allocation from SkPictureRecorder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix initializer list order Created 6 years, 6 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 | « src/core/SkPictureRecord.h ('k') | src/core/SkPictureRecorder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureRecord.cpp
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 1a1aecc6007dae75c977078186434c1d855f18d6..5d2eca7a558ef3bbbaf0561e29a599b1ba3bc4f4 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -36,7 +36,7 @@ static const uint32_t kSaveSize = 2 * kUInt32Size;
static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size;
static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect);
-SkPictureRecord::SkPictureRecord(SkPicture* picture, const SkISize& dimensions, uint32_t flags)
+SkPictureRecord::SkPictureRecord(const SkISize& dimensions, uint32_t flags)
: INHERITED(dimensions.width(), dimensions.height())
, fBoundingHierarchy(NULL)
, fStateTree(NULL)
@@ -49,7 +49,6 @@ SkPictureRecord::SkPictureRecord(SkPicture* picture, const SkISize& dimensions,
fPointWrites = fRectWrites = fTextWrites = 0;
#endif
- fPicture = picture;
fBitmapHeap = SkNEW(SkBitmapHeap);
fFlattenableHeap.setBitmapStorage(fBitmapHeap);
@@ -1066,11 +1065,11 @@ void SkPictureRecord::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
if (paint.isAntiAlias() && !path.isConvex()) {
- fPicture->incAAConcavePaths();
+ fContentInfo.incAAConcavePaths();
if (SkPaint::kStroke_Style == paint.getStyle() &&
0 == paint.getStrokeWidth()) {
- fPicture->incAAHairlineConcavePaths();
+ fContentInfo.incAAHairlineConcavePaths();
}
}
@@ -1589,7 +1588,7 @@ const SkFlatData* SkPictureRecord::getFlatPaintData(const SkPaint& paint) {
const SkFlatData* SkPictureRecord::addPaintPtr(const SkPaint* paint) {
if (NULL != paint && NULL != paint->getPathEffect()) {
- fPicture->incPaintWithPathEffectUses();
+ fContentInfo.incPaintWithPathEffectUses();
}
const SkFlatData* data = paint ? getFlatPaintData(*paint) : NULL;
@@ -1603,7 +1602,14 @@ void SkPictureRecord::addFlatPaint(const SkFlatData* flatPaint) {
}
int SkPictureRecord::addPathToHeap(const SkPath& path) {
- return fPicture->addPathToHeap(path);
+ if (NULL == fPathHeap) {
+ fPathHeap.reset(SkNEW(SkPathHeap));
+ }
+#ifdef SK_DEDUP_PICTURE_PATHS
+ return fPathHeap->insert(path);
+#else
+ return fPathHeap->append(path);
+#endif
}
void SkPictureRecord::addPath(const SkPath& path) {
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | src/core/SkPictureRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698