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

Unified Diff: src/lazy/SkLazyPixelRef.h

Issue 103033002: Big Cleanup: SkBitmapFactory, SkLazyPixelRef, SkImageCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase one last time Created 7 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 | « src/lazy/SkDiscardablePixelRef.cpp ('k') | src/lazy/SkLazyPixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkLazyPixelRef.h
diff --git a/src/lazy/SkLazyPixelRef.h b/src/lazy/SkLazyPixelRef.h
deleted file mode 100644
index f8a16d168914326b52726241358bab7d77b5c2d7..0000000000000000000000000000000000000000
--- a/src/lazy/SkLazyPixelRef.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkLazyPixelRef_DEFINED
-#define SkLazyPixelRef_DEFINED
-
-#include "SkBitmapFactory.h"
-#include "SkImage.h"
-#include "SkImageCache.h"
-#include "SkPixelRef.h"
-#include "SkFlattenable.h"
-#include "SkScaledImageCache.h"
-
-class SkColorTable;
-class SkData;
-class SkImageCache;
-
-#ifdef SK_DEBUG
- #define LAZY_CACHE_STATS 1
-#elif !defined(LAZY_CACHE_STATS)
- #define LAZY_CACHE_STATS 0
-#endif
-
-/**
- * PixelRef which defers decoding until SkBitmap::lockPixels() is called.
- */
-class SkLazyPixelRef : public SkPixelRef {
-
-public:
- /**
- * Create a new SkLazyPixelRef.
- * @param SkData Encoded data representing the pixels.
- * @param DecodeProc Called to decode the pixels when needed. Must be non-NULL.
- * @param SkImageCache Object that handles allocating and freeing
- * the pixel memory, as needed. If NULL, use the global
- * SkScaledImageCache.
- */
- SkLazyPixelRef(SkData*, SkBitmapFactory::DecodeProc, SkImageCache*);
-
- virtual ~SkLazyPixelRef();
-
-#ifdef SK_DEBUG
- intptr_t getCacheId() const { return fCacheId; }
-#endif
-
-#if LAZY_CACHE_STATS
- static int32_t GetCacheHits() { return gCacheHits; }
- static int32_t GetCacheMisses() { return gCacheMisses; }
- static void ResetCacheStats() { gCacheHits = gCacheMisses = 0; }
-#endif
-
- // No need to flatten this object. When flattening an SkBitmap, SkOrderedWriteBuffer will check
- // the encoded data and write that instead.
- // Future implementations of SkFlattenableWriteBuffer will need to special case for
- // onRefEncodedData as well.
- SK_DECLARE_UNFLATTENABLE_OBJECT()
-
-protected:
- virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE;
- virtual void onUnlockPixels() SK_OVERRIDE;
- virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
- virtual SkData* onRefEncodedData() SK_OVERRIDE;
- virtual bool onImplementsDecodeInto() SK_OVERRIDE;
- virtual bool onDecodeInto(int pow2, SkBitmap*) SK_OVERRIDE;
-
-private:
- bool fErrorInDecoding;
- SkData* fData;
- SkBitmapFactory::DecodeProc fDecodeProc;
- SkImageCache* fImageCache;
- union {
- SkImageCache::ID fCacheId;
- SkScaledImageCache::ID* fScaledCacheId;
- };
- size_t fRowBytes;
- SkImageInfo fLazilyCachedInfo;
-
-#if LAZY_CACHE_STATS
- static int32_t gCacheHits;
- static int32_t gCacheMisses;
-#endif
-
- // lazily initialized our cached info. Returns NULL on failure.
- const SkImage::Info* getCachedInfo();
- void* lockScaledImageCachePixels();
- void* lockImageCachePixels();
-
-
- typedef SkPixelRef INHERITED;
-};
-
-#endif // SkLazyPixelRef_DEFINED
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.cpp ('k') | src/lazy/SkLazyPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698