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

Unified Diff: include/core/SkColorTable.h

Issue 719213008: SkColorTable locking serves no purpose anymore. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: oops Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkBitmap.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkColorTable.h
diff --git a/include/core/SkColorTable.h b/include/core/SkColorTable.h
index cfd5110fe0f368a2e5263220e841109efea979d9..20d18d26143530b90db3b3d9ec9a9b56b267a84b 100644
--- a/include/core/SkColorTable.h
+++ b/include/core/SkColorTable.h
@@ -30,43 +30,26 @@ public:
virtual ~SkColorTable();
/** Returns the number of colors in the table.
- */
+ */
int count() const { return fCount; }
/** Returns the specified color from the table. In the debug build, this asserts that
- the index is in range (0 <= index < count).
- */
+ * the index is in range (0 <= index < count).
+ */
SkPMColor operator[](int index) const {
SkASSERT(fColors != NULL && (unsigned)index < (unsigned)fCount);
return fColors[index];
}
- /**
- * Return the array of colors for reading. This must be balanced by a call
- * to unlockColors().
+ // TODO: Would making the read() methods const allow us to avoid copies?
+
+ /** Return the array of colors for reading.
*/
- const SkPMColor* lockColors() {
- SkDEBUGCODE(sk_atomic_inc(&fColorLockCount);)
- return fColors;
- }
+ const SkPMColor* readColors() { return fColors; }
- /**
- * Balancing call to lockColors().
+ /** read16BitCache() returns the array of RGB16 colors that mirror the 32bit colors.
*/
- void unlockColors();
-
- /** Similar to lockColors(), lock16BitCache() returns the array of
- RGB16 colors that mirror the 32bit colors. However, this function
- will return null if kColorsAreOpaque_Flag is not set.
- Also, unlike lockColors(), the returned array here cannot be modified.
- */
- const uint16_t* lock16BitCache();
- /** Balancing call to lock16BitCache().
- */
- void unlock16BitCache() {
- SkASSERT(f16BitCacheLockCount > 0);
- SkDEBUGCODE(sk_atomic_dec(&f16BitCacheLockCount);)
- }
+ const uint16_t* read16BitCache();
explicit SkColorTable(SkReadBuffer&);
void writeToBuffer(SkWriteBuffer&) const;
@@ -75,13 +58,9 @@ private:
SkPMColor* fColors;
uint16_t* f16BitCache;
int fCount;
- SkDEBUGCODE(int fColorLockCount;)
- SkDEBUGCODE(int f16BitCacheLockCount;)
void init(const SkPMColor* colors, int count);
- void inval16BitCache();
-
typedef SkRefCnt INHERITED;
};
« no previous file with comments | « include/core/SkBitmap.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698