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

Side by Side Diff: include/core/SkPathRef.h

Issue 1260363007: Revert "Implement caching of filled paths in the tessellated path renderer." (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | include/gpu/GrResourceKey.h » ('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 2012 Google Inc. 3 * Copyright 2012 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 8
9 #ifndef SkPathRef_DEFINED 9 #ifndef SkPathRef_DEFINED
10 #define SkPathRef_DEFINED 10 #define SkPathRef_DEFINED
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 static SkPathRef* CreateFromBuffer(SkRBuffer* buffer); 174 static SkPathRef* CreateFromBuffer(SkRBuffer* buffer);
175 175
176 /** 176 /**
177 * Rollsback a path ref to zero verbs and points with the assumption that th e path ref will be 177 * Rollsback a path ref to zero verbs and points with the assumption that th e path ref will be
178 * repopulated with approximately the same number of verbs and points. A new path ref is created 178 * repopulated with approximately the same number of verbs and points. A new path ref is created
179 * only if necessary. 179 * only if necessary.
180 */ 180 */
181 static void Rewind(SkAutoTUnref<SkPathRef>* pathRef); 181 static void Rewind(SkAutoTUnref<SkPathRef>* pathRef);
182 182
183 virtual ~SkPathRef(); 183 virtual ~SkPathRef() {
184 SkDEBUGCODE(this->validate();)
185 sk_free(fPoints);
186
187 SkDEBUGCODE(fPoints = NULL;)
188 SkDEBUGCODE(fVerbs = NULL;)
189 SkDEBUGCODE(fVerbCnt = 0x9999999;)
190 SkDEBUGCODE(fPointCnt = 0xAAAAAAA;)
191 SkDEBUGCODE(fPointCnt = 0xBBBBBBB;)
192 SkDEBUGCODE(fGenerationID = 0xEEEEEEEE;)
193 SkDEBUGCODE(fEditorsAttached = 0x7777777;)
194 }
195
184 int countPoints() const { SkDEBUGCODE(this->validate();) return fPointCnt; } 196 int countPoints() const { SkDEBUGCODE(this->validate();) return fPointCnt; }
185 int countVerbs() const { SkDEBUGCODE(this->validate();) return fVerbCnt; } 197 int countVerbs() const { SkDEBUGCODE(this->validate();) return fVerbCnt; }
186 int countWeights() const { SkDEBUGCODE(this->validate();) return fConicWeigh ts.count(); } 198 int countWeights() const { SkDEBUGCODE(this->validate();) return fConicWeigh ts.count(); }
187 199
188 /** 200 /**
189 * Returns a pointer one beyond the first logical verb (last verb in memory order). 201 * Returns a pointer one beyond the first logical verb (last verb in memory order).
190 */ 202 */
191 const uint8_t* verbs() const { SkDEBUGCODE(this->validate();) return fVerbs; } 203 const uint8_t* verbs() const { SkDEBUGCODE(this->validate();) return fVerbs; }
192 204
193 /** 205 /**
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 */ 244 */
233 uint32_t writeSize() const; 245 uint32_t writeSize() const;
234 246
235 /** 247 /**
236 * Gets an ID that uniquely identifies the contents of the path ref. If two path refs have the 248 * Gets an ID that uniquely identifies the contents of the path ref. If two path refs have the
237 * same ID then they have the same verbs and points. However, two path refs may have the same 249 * same ID then they have the same verbs and points. However, two path refs may have the same
238 * contents but different genIDs. 250 * contents but different genIDs.
239 */ 251 */
240 uint32_t genID() const; 252 uint32_t genID() const;
241 253
242 struct GenIDChangeListener {
243 virtual ~GenIDChangeListener() {}
244 virtual void onChange() = 0;
245 };
246
247 void addGenIDChangeListener(GenIDChangeListener* listener);
248
249 SkDEBUGCODE(void validate() const;) 254 SkDEBUGCODE(void validate() const;)
250 255
251 private: 256 private:
252 enum SerializationOffsets { 257 enum SerializationOffsets {
253 kIsFinite_SerializationShift = 25, // requires 1 bit 258 kIsFinite_SerializationShift = 25, // requires 1 bit
254 kIsOval_SerializationShift = 24, // requires 1 bit 259 kIsOval_SerializationShift = 24, // requires 1 bit
255 kSegmentMask_SerializationShift = 0 // requires 4 bits 260 kSegmentMask_SerializationShift = 0 // requires 4 bits
256 }; 261 };
257 262
258 SkPathRef() { 263 SkPathRef() {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 friend SkPathRef* sk_create_empty_pathref(); 415 friend SkPathRef* sk_create_empty_pathref();
411 416
412 void setIsOval(bool isOval) { fIsOval = isOval; } 417 void setIsOval(bool isOval) { fIsOval = isOval; }
413 418
414 SkPoint* getPoints() { 419 SkPoint* getPoints() {
415 SkDEBUGCODE(this->validate();) 420 SkDEBUGCODE(this->validate();)
416 fIsOval = false; 421 fIsOval = false;
417 return fPoints; 422 return fPoints;
418 } 423 }
419 424
420 void callGenIDChangeListeners();
421
422 enum { 425 enum {
423 kMinSize = 256, 426 kMinSize = 256,
424 }; 427 };
425 428
426 mutable SkRect fBounds; 429 mutable SkRect fBounds;
427 mutable uint8_t fBoundsIsDirty; 430 mutable uint8_t fBoundsIsDirty;
428 mutable SkBool8 fIsFinite; // only meaningful if bounds are valid 431 mutable SkBool8 fIsFinite; // only meaningful if bounds are valid
429 432
430 SkBool8 fIsOval; 433 SkBool8 fIsOval;
431 uint8_t fSegmentMask; 434 uint8_t fSegmentMask;
432 435
433 SkPoint* fPoints; // points to begining of the allocation 436 SkPoint* fPoints; // points to begining of the allocation
434 uint8_t* fVerbs; // points just past the end of the allocation (v erbs grow backwards) 437 uint8_t* fVerbs; // points just past the end of the allocation (v erbs grow backwards)
435 int fVerbCnt; 438 int fVerbCnt;
436 int fPointCnt; 439 int fPointCnt;
437 size_t fFreeSpace; // redundant but saves computation 440 size_t fFreeSpace; // redundant but saves computation
438 SkTDArray<SkScalar> fConicWeights; 441 SkTDArray<SkScalar> fConicWeights;
439 442
440 enum { 443 enum {
441 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer o verbs. 444 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer o verbs.
442 }; 445 };
443 mutable uint32_t fGenerationID; 446 mutable uint32_t fGenerationID;
444 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use at any time. 447 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use at any time.
445 448
446 SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owne d
447
448 friend class PathRefTest_Private; 449 friend class PathRefTest_Private;
449 typedef SkRefCnt INHERITED; 450 typedef SkRefCnt INHERITED;
450 }; 451 };
451 452
452 #endif 453 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrResourceKey.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698