Add SkNVRefCnt, prune down SkPicture's size
SkNVRefCnt is a variant of SkRefCnt that's Not Virtual, so weighs 4 bytes
instead of 8 or 16. There's only benefit to doing this if the deriving class
does not otherwise need a vtable, e.g. SkPicture.
I've stripped out some cruft from SkPicture, rearranged fields to pack tightly,
and added compile asserts for the sizes of SkPicture, SkRecord, and
SkVarAlloc.
BUG=skia:3144
Review URL: https://codereview.chromium.org/741793002
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 62d4e74..3eb1247 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1581,7 +1581,7 @@
compareConfig.fName);
SkPicture* pict = gmmain.generate_new_picture(gm, kNone_BbhType, 0);
- SkAutoUnref aur(pict);
+ SkAutoTUnref<SkPicture> aur(pict);
if (FLAGS_replay) {
const char renderModeDescriptor[] = "-replay";
if (gmFlags & GM::kSkipPicture_Flag) {
@@ -1605,7 +1605,7 @@
errorsForAllModes.add(kIntentionallySkipped_ErrorType);
} else {
SkPicture* repict = gmmain.stream_to_new_picture(*pict);
- SkAutoUnref aurr(repict);
+ SkAutoTUnref<SkPicture> aurr(repict);
SkBitmap bitmap;
gmmain.generate_image_from_picture(gm, compareConfig, repict, &bitmap);
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
@@ -1638,7 +1638,7 @@
errorsForAllModes.add(kIntentionallySkipped_ErrorType);
} else {
SkPicture* pict = gmmain.generate_new_picture(gm, kRTree_BbhType, 0);
- SkAutoUnref aur(pict);
+ SkAutoTUnref<SkPicture> aur(pict);
SkBitmap bitmap;
gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
@@ -1668,7 +1668,7 @@
SkScalar recordScale = SkScalarInvert(replayScale);
SkPicture* pict = gmmain.generate_new_picture(
gm, kTileGrid_BbhType, 0, recordScale);
- SkAutoUnref aur(pict);
+ SkAutoTUnref<SkPicture> aur(pict);
SkBitmap bitmap;
// We cannot yet pass 'true' to generate_image_from_picture to
// perform actual tiled rendering (see Issue 1198 -