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

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

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | src/device/xps/SkXPSDevice.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"
(...skipping 10 matching lines...) Expand all
21 kNoInitialSave = -1, 21 kNoInitialSave = -1,
22 }; 22 };
23 23
24 // 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.
25 static int const kUInt32Size = 4; 25 static int const kUInt32Size = 4;
26 26
27 static const uint32_t kSaveSize = 2 * kUInt32Size; 27 static const uint32_t kSaveSize = 2 * kUInt32Size;
28 static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size; 28 static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size;
29 static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect ); 29 static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect );
30 30
31 SkPictureRecord::SkPictureRecord(uint32_t flags, SkDevice* device) : 31 SkPictureRecord::SkPictureRecord(uint32_t flags, SkBaseDevice* device) :
32 INHERITED(device), 32 INHERITED(device),
33 fBoundingHierarchy(NULL), 33 fBoundingHierarchy(NULL),
34 fStateTree(NULL), 34 fStateTree(NULL),
35 fFlattenableHeap(HEAP_BLOCK_SIZE), 35 fFlattenableHeap(HEAP_BLOCK_SIZE),
36 fMatrices(&fFlattenableHeap), 36 fMatrices(&fFlattenableHeap),
37 fPaints(&fFlattenableHeap), 37 fPaints(&fFlattenableHeap),
38 fRegions(&fFlattenableHeap), 38 fRegions(&fFlattenableHeap),
39 fWriter(MIN_WRITER_SIZE), 39 fWriter(MIN_WRITER_SIZE),
40 fRecordFlags(flags) { 40 fRecordFlags(flags) {
41 #ifdef SK_DEBUG_SIZE 41 #ifdef SK_DEBUG_SIZE
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } else { 131 } else {
132 SkASSERT(kSaveLayerWithBoundsSize == opSize); 132 SkASSERT(kSaveLayerWithBoundsSize == opSize);
133 return kSaveLayerWithBoundsPaintOffset + overflow; 133 return kSaveLayerWithBoundsPaintOffset + overflow;
134 } 134 }
135 } 135 }
136 136
137 SkASSERT(0 != gPaintOffsets[op]); // really shouldn't be calling this meth od 137 SkASSERT(0 != gPaintOffsets[op]); // really shouldn't be calling this meth od
138 return gPaintOffsets[op] * sizeof(uint32_t) + overflow; 138 return gPaintOffsets[op] * sizeof(uint32_t) + overflow;
139 } 139 }
140 140
141 SkDevice* SkPictureRecord::setDevice(SkDevice* device) { 141 SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) {
142 SkDEBUGFAIL("eeek, don't try to change the device on a recording canvas"); 142 SkDEBUGFAIL("eeek, don't try to change the device on a recording canvas");
143 return this->INHERITED::setDevice(device); 143 return this->INHERITED::setDevice(device);
144 } 144 }
145 145
146 int SkPictureRecord::save(SaveFlags flags) { 146 int SkPictureRecord::save(SaveFlags flags) {
147 // record the offset to us, making it non-positive to distinguish a save 147 // record the offset to us, making it non-positive to distinguish a save
148 // from a clip entry. 148 // from a clip entry.
149 fRestoreOffsetStack.push(-(int32_t)fWriter.size()); 149 fRestoreOffsetStack.push(-(int32_t)fWriter.size());
150 150
151 // op + flags 151 // op + flags
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 void SkPictureRecord::validateRegions() const { 1501 void SkPictureRecord::validateRegions() const {
1502 int count = fRegions.count(); 1502 int count = fRegions.count();
1503 SkASSERT((unsigned) count < 0x1000); 1503 SkASSERT((unsigned) count < 0x1000);
1504 for (int index = 0; index < count; index++) { 1504 for (int index = 0; index < count; index++) {
1505 const SkFlatData* region = fRegions[index]; 1505 const SkFlatData* region = fRegions[index];
1506 SkASSERT(region); 1506 SkASSERT(region);
1507 // region->validate(); 1507 // region->validate();
1508 } 1508 }
1509 } 1509 }
1510 #endif 1510 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | src/device/xps/SkXPSDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698