OLD | NEW |
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 "SkOffsetTable.h" | 14 #include "SkOffsetTable.h" |
15 #include "SkPictureStateTree.h" | 15 #include "SkPictureStateTree.h" |
16 #include "SkSurface.h" | |
17 | 16 |
18 #define HEAP_BLOCK_SIZE 4096 | 17 #define HEAP_BLOCK_SIZE 4096 |
19 | 18 |
20 enum { | 19 enum { |
21 // just need a value that save or getSaveCount would never return | 20 // just need a value that save or getSaveCount would never return |
22 kNoInitialSave = -1, | 21 kNoInitialSave = -1, |
23 }; | 22 }; |
24 | 23 |
25 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et
c. | 24 // A lot of basic types get stored as a uint32_t: bools, ints, paint indices, et
c. |
26 static int const kUInt32Size = 4; | 25 static int const kUInt32Size = 4; |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 | 1563 |
1565 // update the cull skip offset to point past this op. | 1564 // update the cull skip offset to point past this op. |
1566 fWriter.overwriteTAt<uint32_t>(cullSkipOffset, fWriter.bytesWritten()); | 1565 fWriter.overwriteTAt<uint32_t>(cullSkipOffset, fWriter.bytesWritten()); |
1567 | 1566 |
1568 this->validate(initialOffset, size); | 1567 this->validate(initialOffset, size); |
1569 } | 1568 } |
1570 | 1569 |
1571 /////////////////////////////////////////////////////////////////////////////// | 1570 /////////////////////////////////////////////////////////////////////////////// |
1572 | 1571 |
1573 SkSurface* SkPictureRecord::onNewSurface(const SkImageInfo& info) { | 1572 SkSurface* SkPictureRecord::onNewSurface(const SkImageInfo& info) { |
1574 return SkSurface::NewPicture(info.fWidth, info.fHeight); | 1573 return NULL; |
1575 } | 1574 } |
1576 | 1575 |
1577 void SkPictureRecord::trackBitmapUse(int bitmapID, size_t offset) { | 1576 void SkPictureRecord::trackBitmapUse(int bitmapID, size_t offset) { |
1578 #ifndef SK_ALLOW_BITMAP_TRACKING | 1577 #ifndef SK_ALLOW_BITMAP_TRACKING |
1579 return; | 1578 return; |
1580 #endif | 1579 #endif |
1581 | 1580 |
1582 if (!(fRecordFlags & SkPicture::kOptimizeForClippedPlayback_RecordingFlag))
{ | 1581 if (!(fRecordFlags & SkPicture::kOptimizeForClippedPlayback_RecordingFlag))
{ |
1583 return; | 1582 return; |
1584 } | 1583 } |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 void SkPictureRecord::validateRegions() const { | 1840 void SkPictureRecord::validateRegions() const { |
1842 int count = fRegions.count(); | 1841 int count = fRegions.count(); |
1843 SkASSERT((unsigned) count < 0x1000); | 1842 SkASSERT((unsigned) count < 0x1000); |
1844 for (int index = 0; index < count; index++) { | 1843 for (int index = 0; index < count; index++) { |
1845 const SkFlatData* region = fRegions[index]; | 1844 const SkFlatData* region = fRegions[index]; |
1846 SkASSERT(region); | 1845 SkASSERT(region); |
1847 // region->validate(); | 1846 // region->validate(); |
1848 } | 1847 } |
1849 } | 1848 } |
1850 #endif | 1849 #endif |
OLD | NEW |