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

Side by Side Diff: src/core/SkPictureFlat.h

Issue 222343002: SkTDynamicHash: remove need for Equals(const T&, const Key&) param. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | src/core/SkScaledImageCache.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 #ifndef SkPictureFlat_DEFINED 8 #ifndef SkPictureFlat_DEFINED
9 #define SkPictureFlat_DEFINED 9 #define SkPictureFlat_DEFINED
10 10
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // Return the topbot[] after it has been recorded. 331 // Return the topbot[] after it has been recorded.
332 const SkScalar* topBot() const { 332 const SkScalar* topBot() const {
333 SkASSERT(this->isTopBotWritten()); 333 SkASSERT(this->isTopBotWritten());
334 return fTopBot; 334 return fTopBot;
335 } 335 }
336 336
337 private: 337 private:
338 // For SkTDynamicHash. 338 // For SkTDynamicHash.
339 static const SkFlatData& Identity(const SkFlatData& flat) { return flat; } 339 static const SkFlatData& Identity(const SkFlatData& flat) { return flat; }
340 static uint32_t Hash(const SkFlatData& flat) { return flat.checksum(); } 340 static uint32_t Hash(const SkFlatData& flat) { return flat.checksum(); }
341 static bool Equal(const SkFlatData& a, const SkFlatData& b) { return a == b; }
342 341
343 void setIndex(int index) { fIndex = index; } 342 void setIndex(int index) { fIndex = index; }
344 uint8_t* data() { return (uint8_t*)this + sizeof(*this); } 343 uint8_t* data() { return (uint8_t*)this + sizeof(*this); }
345 344
346 // This assumes the payload flat data has already been written and does not modify it. 345 // This assumes the payload flat data has already been written and does not modify it.
347 void stampHeader(int index, int32_t size) { 346 void stampHeader(int index, int32_t size) {
348 SkASSERT(SkIsAlign4(size)); 347 SkASSERT(SkIsAlign4(size));
349 fIndex = index; 348 fIndex = index;
350 fFlatSize = size; 349 fFlatSize = size;
351 fTopBot[0] = SK_ScalarNaN; // Mark as unwritten. 350 fTopBot[0] = SK_ScalarNaN; // Mark as unwritten.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 556
558 // All SkFlatData* stored in fIndexedData and fHash are owned by the control ler. 557 // All SkFlatData* stored in fIndexedData and fHash are owned by the control ler.
559 SkAutoTUnref<SkFlatController> fController; 558 SkAutoTUnref<SkFlatController> fController;
560 SkWriteBuffer fScratch; 559 SkWriteBuffer fScratch;
561 bool fReady; 560 bool fReady;
562 561
563 // For index -> SkFlatData. 0-based, while all indices in the API are 1-bas ed. Careful! 562 // For index -> SkFlatData. 0-based, while all indices in the API are 1-bas ed. Careful!
564 SkTDArray<const SkFlatData*> fIndexedData; 563 SkTDArray<const SkFlatData*> fIndexedData;
565 564
566 // For SkFlatData -> cached SkFlatData, which has index(). 565 // For SkFlatData -> cached SkFlatData, which has index().
567 SkTDynamicHash<SkFlatData, SkFlatData, 566 SkTDynamicHash<SkFlatData, SkFlatData, SkFlatData::Identity, SkFlatData::Has h> fHash;
568 SkFlatData::Identity, SkFlatData::Hash, SkFlatData::Equal> fH ash;
569 }; 567 };
570 568
571 typedef SkFlatDictionary<SkPaint, SkPaint::FlatteningTraits> SkPaintDictionary; 569 typedef SkFlatDictionary<SkPaint, SkPaint::FlatteningTraits> SkPaintDictionary;
572 570
573 class SkChunkFlatController : public SkFlatController { 571 class SkChunkFlatController : public SkFlatController {
574 public: 572 public:
575 SkChunkFlatController(size_t minSize) 573 SkChunkFlatController(size_t minSize)
576 : fHeap(minSize) 574 : fHeap(minSize)
577 , fTypefaceSet(SkNEW(SkRefCntSet)) 575 , fTypefaceSet(SkNEW(SkRefCntSet))
578 , fLastAllocated(NULL) { 576 , fLastAllocated(NULL) {
(...skipping 21 matching lines...) Expand all
600 } 598 }
601 599
602 private: 600 private:
603 SkChunkAlloc fHeap; 601 SkChunkAlloc fHeap;
604 SkAutoTUnref<SkRefCntSet> fTypefaceSet; 602 SkAutoTUnref<SkRefCntSet> fTypefaceSet;
605 void* fLastAllocated; 603 void* fLastAllocated;
606 mutable SkTypefacePlayback fTypefacePlayback; 604 mutable SkTypefacePlayback fTypefacePlayback;
607 }; 605 };
608 606
609 #endif 607 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698