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

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

Issue 137433003: Convert SkWriter32 to use an SkTDArray for its internal storage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: of course 0's fine too... Created 6 years, 11 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 | « src/core/SkPicturePlayback.cpp ('k') | src/core/SkScalerContext.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
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 MIN_WRITER_SIZE 16384
17 #define HEAP_BLOCK_SIZE 4096 16 #define HEAP_BLOCK_SIZE 4096
18 17
19 enum { 18 enum {
20 // just need a value that save or getSaveCount would never return 19 // just need a value that save or getSaveCount would never return
21 kNoInitialSave = -1, 20 kNoInitialSave = -1,
22 }; 21 };
23 22
24 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et c. 23 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et c.
25 static int const kUInt32Size = 4; 24 static int const kUInt32Size = 4;
26 25
27 static const uint32_t kSaveSize = 2 * kUInt32Size; 26 static const uint32_t kSaveSize = 2 * kUInt32Size;
28 static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size; 27 static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size;
29 static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect ); 28 static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect );
30 29
31 SkPictureRecord::SkPictureRecord(uint32_t flags, SkBaseDevice* device) : 30 SkPictureRecord::SkPictureRecord(uint32_t flags, SkBaseDevice* device) :
32 INHERITED(device), 31 INHERITED(device),
33 fBoundingHierarchy(NULL), 32 fBoundingHierarchy(NULL),
34 fStateTree(NULL), 33 fStateTree(NULL),
35 fFlattenableHeap(HEAP_BLOCK_SIZE), 34 fFlattenableHeap(HEAP_BLOCK_SIZE),
36 fMatrices(&fFlattenableHeap), 35 fMatrices(&fFlattenableHeap),
37 fPaints(&fFlattenableHeap), 36 fPaints(&fFlattenableHeap),
38 fRegions(&fFlattenableHeap), 37 fRegions(&fFlattenableHeap),
39 fWriter(MIN_WRITER_SIZE),
40 fRecordFlags(flags) { 38 fRecordFlags(flags) {
41 #ifdef SK_DEBUG_SIZE 39 #ifdef SK_DEBUG_SIZE
42 fPointBytes = fRectBytes = fTextBytes = 0; 40 fPointBytes = fRectBytes = fTextBytes = 0;
43 fPointWrites = fRectWrites = fTextWrites = 0; 41 fPointWrites = fRectWrites = fTextWrites = 0;
44 #endif 42 #endif
45 43
46 fRestoreOffsetStack.setReserve(32); 44 fRestoreOffsetStack.setReserve(32);
47 45
48 fBitmapHeap = SkNEW(SkBitmapHeap); 46 fBitmapHeap = SkNEW(SkBitmapHeap);
49 fFlattenableHeap.setBitmapStorage(fBitmapHeap); 47 fFlattenableHeap.setBitmapStorage(fBitmapHeap);
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 void SkPictureRecord::validateRegions() const { 1528 void SkPictureRecord::validateRegions() const {
1531 int count = fRegions.count(); 1529 int count = fRegions.count();
1532 SkASSERT((unsigned) count < 0x1000); 1530 SkASSERT((unsigned) count < 0x1000);
1533 for (int index = 0; index < count; index++) { 1531 for (int index = 0; index < count; index++) {
1534 const SkFlatData* region = fRegions[index]; 1532 const SkFlatData* region = fRegions[index];
1535 SkASSERT(region); 1533 SkASSERT(region);
1536 // region->validate(); 1534 // region->validate();
1537 } 1535 }
1538 } 1536 }
1539 #endif 1537 #endif
OLDNEW
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | src/core/SkScalerContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698