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

Unified Diff: include/core/SkBitmap.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 | « no previous file | include/core/SkColorTable.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkBitmap.h
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index cefc30ac821fbcab88140bad7b3b2813c7323fef..8ffa37953cc919e1124317ba2724f9e47dfc9824 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -271,13 +271,13 @@ public:
isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
return this->tryAllocPixels(info);
}
-
+
SK_ALLOCPIXELS_RETURN_TYPE allocN32Pixels(int width, int height, bool isOpaque = false) {
SkImageInfo info = SkImageInfo::MakeN32(width, height,
isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
return this->allocPixels(info);
}
-
+
/**
* Install a pixelref that wraps the specified pixels and rowBytes, and
* optional ReleaseProc and context. When the pixels are no longer
@@ -798,60 +798,6 @@ private:
//TODO(mtklein): uncomment when 71713004 lands and Chromium's fixed.
//#define SkAutoLockPixels(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockPixels)
-/** Helper class that performs the lock/unlockColors calls on a colortable.
- The destructor will call unlockColors(false) if it has a bitmap's colortable
-*/
-class SkAutoLockColors : SkNoncopyable {
-public:
- /** Initialize with no bitmap. Call lockColors(bitmap) to lock bitmap's
- colortable
- */
- SkAutoLockColors() : fCTable(NULL), fColors(NULL) {}
- /** Initialize with bitmap, locking its colortable if present
- */
- explicit SkAutoLockColors(const SkBitmap& bm) {
- fCTable = bm.getColorTable();
- fColors = fCTable ? fCTable->lockColors() : NULL;
- }
- /** Initialize with a colortable (may be null)
- */
- explicit SkAutoLockColors(SkColorTable* ctable) {
- fCTable = ctable;
- fColors = ctable ? ctable->lockColors() : NULL;
- }
- ~SkAutoLockColors() {
- if (fCTable) {
- fCTable->unlockColors();
- }
- }
-
- /** Return the currently locked colors, or NULL if no bitmap's colortable
- is currently locked.
- */
- const SkPMColor* colors() const { return fColors; }
-
- /** Locks the table and returns is colors (assuming ctable is not null) and
- unlocks the previous table if one was present
- */
- const SkPMColor* lockColors(SkColorTable* ctable) {
- if (fCTable) {
- fCTable->unlockColors();
- }
- fCTable = ctable;
- fColors = ctable ? ctable->lockColors() : NULL;
- return fColors;
- }
-
- const SkPMColor* lockColors(const SkBitmap& bm) {
- return this->lockColors(bm.getColorTable());
- }
-
-private:
- SkColorTable* fCTable;
- const SkPMColor* fColors;
-};
-#define SkAutoLockColors(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockColors)
-
///////////////////////////////////////////////////////////////////////////////
inline uint32_t* SkBitmap::getAddr32(int x, int y) const {
« no previous file with comments | « no previous file | include/core/SkColorTable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698