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

Side by Side Diff: src/core/SkPictureRecord.cpp

Issue 246393008: Add literal picture recording mode, triggered by a compile time switch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: stray newline Created 6 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkTSearch.h" 9 #include "SkTSearch.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
11 #include "SkRRect.h" 11 #include "SkRRect.h"
12 #include "SkBBoxHierarchy.h" 12 #include "SkBBoxHierarchy.h"
13 #include "SkDevice.h" 13 #include "SkDevice.h"
14 #include "SkPictureStateTree.h" 14 #include "SkPictureStateTree.h"
15 15
16 #define HEAP_BLOCK_SIZE 4096 16 #define HEAP_BLOCK_SIZE 4096
17 17
18 // If SK_RECORD_LITERAL_PICTURES is defined, record our inputs as literally as p ossible.
19 // Otherwise, we can be clever and record faster equivalents. kBeClever is norm ally true.
20 static const bool kBeClever =
21 #ifdef SK_RECORD_LITERAL_PICTURES
22 false;
23 #else
24 true;
25 #endif
26
18 enum { 27 enum {
19 // just need a value that save or getSaveCount would never return 28 // just need a value that save or getSaveCount would never return
20 kNoInitialSave = -1, 29 kNoInitialSave = -1,
21 }; 30 };
22 31
23 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et c. 32 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et c.
24 static int const kUInt32Size = 4; 33 static int const kUInt32Size = 4;
25 34
26 static const uint32_t kSaveSize = 2 * kUInt32Size; 35 static const uint32_t kSaveSize = 2 * kUInt32Size;
27 static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size; 36 static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size;
28 static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect ); 37 static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect );
29 38
30 SkPictureRecord::SkPictureRecord(const SkISize& dimensions, uint32_t flags) 39 SkPictureRecord::SkPictureRecord(const SkISize& dimensions, uint32_t flags)
31 : INHERITED(dimensions.width(), dimensions.height()) 40 : INHERITED(dimensions.width(), dimensions.height())
32 , fBoundingHierarchy(NULL) 41 , fBoundingHierarchy(NULL)
33 , fStateTree(NULL) 42 , fStateTree(NULL)
34 , fFlattenableHeap(HEAP_BLOCK_SIZE) 43 , fFlattenableHeap(HEAP_BLOCK_SIZE)
35 , fPaints(&fFlattenableHeap) 44 , fPaints(&fFlattenableHeap)
36 , fRecordFlags(flags) 45 , fRecordFlags(flags)
37 , fOptsEnabled(true) { 46 , fOptsEnabled(kBeClever) {
38 #ifdef SK_DEBUG_SIZE 47 #ifdef SK_DEBUG_SIZE
39 fPointBytes = fRectBytes = fTextBytes = 0; 48 fPointBytes = fRectBytes = fTextBytes = 0;
40 fPointWrites = fRectWrites = fTextWrites = 0; 49 fPointWrites = fRectWrites = fTextWrites = 0;
41 #endif 50 #endif
42 51
43 fBitmapHeap = SkNEW(SkBitmapHeap); 52 fBitmapHeap = SkNEW(SkBitmapHeap);
44 fFlattenableHeap.setBitmapStorage(fBitmapHeap); 53 fFlattenableHeap.setBitmapStorage(fBitmapHeap);
45 fPathHeap = NULL; // lazy allocate 54 fPathHeap = NULL; // lazy allocate
46 55
47 #ifndef SK_COLLAPSE_MATRIX_CLIP_STATE 56 #ifndef SK_COLLAPSE_MATRIX_CLIP_STATE
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 this->addRect(rect); 1034 this->addRect(rect);
1026 this->validate(initialOffset, size); 1035 this->validate(initialOffset, size);
1027 } 1036 }
1028 1037
1029 void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) { 1038 void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
1030 1039
1031 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1040 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1032 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1041 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1033 #endif 1042 #endif
1034 1043
1035 if (rrect.isRect()) { 1044 if (rrect.isRect() && kBeClever) {
1036 this->SkPictureRecord::drawRect(rrect.getBounds(), paint); 1045 this->SkPictureRecord::drawRect(rrect.getBounds(), paint);
1037 } else if (rrect.isOval()) { 1046 } else if (rrect.isOval() && kBeClever) {
1038 this->SkPictureRecord::drawOval(rrect.getBounds(), paint); 1047 this->SkPictureRecord::drawOval(rrect.getBounds(), paint);
1039 } else { 1048 } else {
1040 // op + paint index + rrect 1049 // op + paint index + rrect
1041 size_t size = 2 * kUInt32Size + SkRRect::kSizeInMemory; 1050 size_t size = 2 * kUInt32Size + SkRRect::kSizeInMemory;
1042 size_t initialOffset = this->addDraw(DRAW_RRECT, &size); 1051 size_t initialOffset = this->addDraw(DRAW_RRECT, &size);
1043 SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.bytes Written()); 1052 SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.bytes Written());
1044 this->addPaint(paint); 1053 this->addPaint(paint);
1045 this->addRRect(rrect); 1054 this->addRRect(rrect);
1046 this->validate(initialOffset, size); 1055 this->validate(initialOffset, size);
1047 } 1056 }
(...skipping 26 matching lines...) Expand all
1074 size_t size = 3 * kUInt32Size; 1083 size_t size = 3 * kUInt32Size;
1075 size_t initialOffset = this->addDraw(DRAW_PATH, &size); 1084 size_t initialOffset = this->addDraw(DRAW_PATH, &size);
1076 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritt en()); 1085 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritt en());
1077 this->addPaint(paint); 1086 this->addPaint(paint);
1078 this->addPath(path); 1087 this->addPath(path);
1079 this->validate(initialOffset, size); 1088 this->validate(initialOffset, size);
1080 } 1089 }
1081 1090
1082 void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, 1091 void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
1083 const SkPaint* paint = NULL) { 1092 const SkPaint* paint = NULL) {
1084 if (bitmap.drawsNothing()) { 1093 if (bitmap.drawsNothing() && kBeClever) {
1085 return; 1094 return;
1086 } 1095 }
1087 1096
1088 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1097 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1089 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1098 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1090 #endif 1099 #endif
1091 1100
1092 // op + paint index + bitmap index + left + top 1101 // op + paint index + bitmap index + left + top
1093 size_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar); 1102 size_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar);
1094 size_t initialOffset = this->addDraw(DRAW_BITMAP, &size); 1103 size_t initialOffset = this->addDraw(DRAW_BITMAP, &size);
1095 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.bytesWri tten()); 1104 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.bytesWri tten());
1096 this->addPaintPtr(paint); 1105 this->addPaintPtr(paint);
1097 this->addBitmap(bitmap); 1106 this->addBitmap(bitmap);
1098 this->addScalar(left); 1107 this->addScalar(left);
1099 this->addScalar(top); 1108 this->addScalar(top);
1100 this->validate(initialOffset, size); 1109 this->validate(initialOffset, size);
1101 } 1110 }
1102 1111
1103 void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, 1112 void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
1104 const SkRect& dst, const SkPaint* pai nt, 1113 const SkRect& dst, const SkPaint* pai nt,
1105 DrawBitmapRectFlags flags) { 1114 DrawBitmapRectFlags flags) {
1106 if (bitmap.drawsNothing()) { 1115 if (bitmap.drawsNothing() && kBeClever) {
1107 return; 1116 return;
1108 } 1117 }
1109 1118
1110 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1119 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1111 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1120 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1112 #endif 1121 #endif
1113 // id + paint index + bitmap index + bool for 'src' + flags 1122 // id + paint index + bitmap index + bool for 'src' + flags
1114 size_t size = 5 * kUInt32Size; 1123 size_t size = 5 * kUInt32Size;
1115 if (NULL != src) { 1124 if (NULL != src) {
1116 size += sizeof(*src); // + rect 1125 size += sizeof(*src); // + rect
1117 } 1126 }
1118 size += sizeof(dst); // + rect 1127 size += sizeof(dst); // + rect
1119 1128
1120 size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size); 1129 size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size);
1121 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) 1130 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size)
1122 == fWriter.bytesWritten()); 1131 == fWriter.bytesWritten());
1123 this->addPaintPtr(paint); 1132 this->addPaintPtr(paint);
1124 this->addBitmap(bitmap); 1133 this->addBitmap(bitmap);
1125 this->addRectPtr(src); // may be null 1134 this->addRectPtr(src); // may be null
1126 this->addRect(dst); 1135 this->addRect(dst);
1127 this->addInt(flags); 1136 this->addInt(flags);
1128 this->validate(initialOffset, size); 1137 this->validate(initialOffset, size);
1129 } 1138 }
1130 1139
1131 void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m atrix, 1140 void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m atrix,
1132 const SkPaint* paint) { 1141 const SkPaint* paint) {
1133 if (bitmap.drawsNothing()) { 1142 if (bitmap.drawsNothing() && kBeClever) {
1134 return; 1143 return;
1135 } 1144 }
1136 1145
1137 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1146 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1138 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1147 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1139 #endif 1148 #endif
1140 1149
1141 // id + paint index + bitmap index + matrix 1150 // id + paint index + bitmap index + matrix
1142 size_t size = 3 * kUInt32Size + matrix.writeToMemory(NULL); 1151 size_t size = 3 * kUInt32Size + matrix.writeToMemory(NULL);
1143 size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size); 1152 size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size);
1144 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.b ytesWritten()); 1153 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.b ytesWritten());
1145 this->addPaintPtr(paint); 1154 this->addPaintPtr(paint);
1146 this->addBitmap(bitmap); 1155 this->addBitmap(bitmap);
1147 this->addMatrix(matrix); 1156 this->addMatrix(matrix);
1148 this->validate(initialOffset, size); 1157 this->validate(initialOffset, size);
1149 } 1158 }
1150 1159
1151 void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& cent er, 1160 void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& cent er,
1152 const SkRect& dst, const SkPaint* paint) { 1161 const SkRect& dst, const SkPaint* paint) {
1153 if (bitmap.drawsNothing()) { 1162 if (bitmap.drawsNothing() && kBeClever) {
1154 return; 1163 return;
1155 } 1164 }
1156 1165
1157 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1166 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1158 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1167 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1159 #endif 1168 #endif
1160 1169
1161 // op + paint index + bitmap id + center + dst rect 1170 // op + paint index + bitmap id + center + dst rect
1162 size_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst); 1171 size_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst);
1163 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size); 1172 size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
1164 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.byt esWritten()); 1173 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.byt esWritten());
1165 this->addPaintPtr(paint); 1174 this->addPaintPtr(paint);
1166 this->addBitmap(bitmap); 1175 this->addBitmap(bitmap);
1167 this->addIRect(center); 1176 this->addIRect(center);
1168 this->addRect(dst); 1177 this->addRect(dst);
1169 this->validate(initialOffset, size); 1178 this->validate(initialOffset, size);
1170 } 1179 }
1171 1180
1172 void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top, 1181 void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top,
1173 const SkPaint* paint = NULL) { 1182 const SkPaint* paint = NULL) {
1174 if (bitmap.drawsNothing()) { 1183 if (bitmap.drawsNothing() && kBeClever) {
1175 return; 1184 return;
1176 } 1185 }
1177 1186
1178 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1187 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1179 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1188 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1180 #endif 1189 #endif
1181 1190
1182 // op + paint index + bitmap index + left + top 1191 // op + paint index + bitmap index + left + top
1183 size_t size = 5 * kUInt32Size; 1192 size_t size = 5 * kUInt32Size;
1184 size_t initialOffset = this->addDraw(DRAW_SPRITE, &size); 1193 size_t initialOffset = this->addDraw(DRAW_SPRITE, &size);
(...skipping 24 matching lines...) Expand all
1209 this->addScalar(flat.topBot()[1] + maxY); 1218 this->addScalar(flat.topBot()[1] + maxY);
1210 } 1219 }
1211 1220
1212 void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x, 1221 void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x,
1213 SkScalar y, const SkPaint& paint) { 1222 SkScalar y, const SkPaint& paint) {
1214 1223
1215 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1224 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1216 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1225 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1217 #endif 1226 #endif
1218 1227
1219 bool fast = !paint.isVerticalText() && paint.canComputeFastBounds(); 1228 bool fast = !paint.isVerticalText() && paint.canComputeFastBounds() && kBeCl ever;
1220 1229
1221 // op + paint index + length + 'length' worth of chars + x + y 1230 // op + paint index + length + 'length' worth of chars + x + y
1222 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * sizeof(SkScalar); 1231 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * sizeof(SkScalar);
1223 if (fast) { 1232 if (fast) {
1224 size += 2 * sizeof(SkScalar); // + top & bottom 1233 size += 2 * sizeof(SkScalar); // + top & bottom
1225 } 1234 }
1226 1235
1227 DrawType op = fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT; 1236 DrawType op = fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT;
1228 size_t initialOffset = this->addDraw(op, &size); 1237 size_t initialOffset = this->addDraw(op, &size);
1229 SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten()); 1238 SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten());
(...skipping 30 matching lines...) Expand all
1260 canUseDrawH = false; 1269 canUseDrawH = false;
1261 if (pos[index].fY < minY) { 1270 if (pos[index].fY < minY) {
1262 minY = pos[index].fY; 1271 minY = pos[index].fY;
1263 } else if (pos[index].fY > maxY) { 1272 } else if (pos[index].fY > maxY) {
1264 maxY = pos[index].fY; 1273 maxY = pos[index].fY;
1265 } 1274 }
1266 } 1275 }
1267 } 1276 }
1268 } 1277 }
1269 1278
1270 bool fastBounds = !paint.isVerticalText() && paint.canComputeFastBounds(); 1279 bool fastBounds = !paint.isVerticalText() && paint.canComputeFastBounds() && kBeClever;
1271 bool fast = canUseDrawH && fastBounds; 1280 bool fast = canUseDrawH && fastBounds && kBeClever;
1272 1281
1273 // op + paint index + length + 'length' worth of data + num points 1282 // op + paint index + length + 'length' worth of data + num points
1274 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 1 * kUInt32Size; 1283 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 1 * kUInt32Size;
1275 if (canUseDrawH) { 1284 if (canUseDrawH) {
1276 if (fast) { 1285 if (fast) {
1277 size += 2 * sizeof(SkScalar); // + top & bottom 1286 size += 2 * sizeof(SkScalar); // + top & bottom
1278 } 1287 }
1279 // + y-pos + actual x-point data 1288 // + y-pos + actual x-point data
1280 size += sizeof(SkScalar) + points * sizeof(SkScalar); 1289 size += sizeof(SkScalar) + points * sizeof(SkScalar);
1281 } else { 1290 } else {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 #endif 1345 #endif
1337 1346
1338 const SkFlatData* flatPaintData = this->getFlatPaintData(paint); 1347 const SkFlatData* flatPaintData = this->getFlatPaintData(paint);
1339 this->drawPosTextHImpl(text, byteLength, xpos, constY, paint, flatPaintData) ; 1348 this->drawPosTextHImpl(text, byteLength, xpos, constY, paint, flatPaintData) ;
1340 } 1349 }
1341 1350
1342 void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength, 1351 void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength,
1343 const SkScalar xpos[], SkScalar constY, 1352 const SkScalar xpos[], SkScalar constY,
1344 const SkPaint& paint, const SkFlatData* flatPaintData) { 1353 const SkPaint& paint, const SkFlatData* flatPaintData) {
1345 int points = paint.countText(text, byteLength); 1354 int points = paint.countText(text, byteLength);
1346 if (0 == points) 1355 if (0 == points && kBeClever) {
1347 return; 1356 return;
1357 }
1348 1358
1349 bool fast = !paint.isVerticalText() && paint.canComputeFastBounds(); 1359 bool fast = !paint.isVerticalText() && paint.canComputeFastBounds() && kBeCl ever;
1350 1360
1351 // op + paint index + length + 'length' worth of data + num points 1361 // op + paint index + length + 'length' worth of data + num points
1352 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 1 * kUInt32Size; 1362 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 1 * kUInt32Size;
1353 if (fast) { 1363 if (fast) {
1354 size += 2 * sizeof(SkScalar); // + top & bottom 1364 size += 2 * sizeof(SkScalar); // + top & bottom
1355 } 1365 }
1356 // + y + the actual points 1366 // + y + the actual points
1357 size += 1 * kUInt32Size + points * sizeof(SkScalar); 1367 size += 1 * kUInt32Size + points * sizeof(SkScalar);
1358 size_t initialOffset = this->addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRA W_POS_TEXT_H, 1368 size_t initialOffset = this->addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRA W_POS_TEXT_H,
1359 &size); 1369 &size);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 this->validate(initialOffset, size); 1544 this->validate(initialOffset, size);
1535 } 1545 }
1536 1546
1537 void SkPictureRecord::onPopCull() { 1547 void SkPictureRecord::onPopCull() {
1538 SkASSERT(!fCullOffsetStack.isEmpty()); 1548 SkASSERT(!fCullOffsetStack.isEmpty());
1539 1549
1540 uint32_t cullSkipOffset = fCullOffsetStack.top(); 1550 uint32_t cullSkipOffset = fCullOffsetStack.top();
1541 fCullOffsetStack.pop(); 1551 fCullOffsetStack.pop();
1542 1552
1543 // Collapse empty push/pop pairs. 1553 // Collapse empty push/pop pairs.
1544 if ((size_t)(cullSkipOffset + kUInt32Size) == fWriter.bytesWritten()) { 1554 if ((size_t)(cullSkipOffset + kUInt32Size) == fWriter.bytesWritten() && kBeC lever) {
1545 SkASSERT(fWriter.bytesWritten() >= kPushCullOpSize); 1555 SkASSERT(fWriter.bytesWritten() >= kPushCullOpSize);
1546 SkASSERT(PUSH_CULL == peek_op(&fWriter, fWriter.bytesWritten() - kPushCu llOpSize)); 1556 SkASSERT(PUSH_CULL == peek_op(&fWriter, fWriter.bytesWritten() - kPushCu llOpSize));
1547 fWriter.rewindToOffset(fWriter.bytesWritten() - kPushCullOpSize); 1557 fWriter.rewindToOffset(fWriter.bytesWritten() - kPushCullOpSize);
1548 return; 1558 return;
1549 } 1559 }
1550 1560
1551 // op only 1561 // op only
1552 size_t size = kUInt32Size; 1562 size_t size = kUInt32Size;
1553 size_t initialOffset = this->addDraw(POP_CULL, &size); 1563 size_t initialOffset = this->addDraw(POP_CULL, &size);
1554 1564
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 void SkPictureRecord::validateRegions() const { 1821 void SkPictureRecord::validateRegions() const {
1812 int count = fRegions.count(); 1822 int count = fRegions.count();
1813 SkASSERT((unsigned) count < 0x1000); 1823 SkASSERT((unsigned) count < 0x1000);
1814 for (int index = 0; index < count; index++) { 1824 for (int index = 0; index < count; index++) {
1815 const SkFlatData* region = fRegions[index]; 1825 const SkFlatData* region = fRegions[index];
1816 SkASSERT(region); 1826 SkASSERT(region);
1817 // region->validate(); 1827 // region->validate();
1818 } 1828 }
1819 } 1829 }
1820 #endif 1830 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698