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

Unified Diff: src/core/SkMipMap.cpp

Issue 19789016: add mipmaps to scaledimagecache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkMipMap.h ('k') | src/core/SkScaledImageCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMipMap.cpp
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index c9f5145f0ab9517acb431405db8ea1b59071aea5..0673c7e093ca744bf2f945e8a333e0b8bea7b8d5 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -192,6 +192,7 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src) {
levels[i].fWidth = width;
levels[i].fHeight = height;
levels[i].fRowBytes = rowBytes;
+ levels[i].fScale = (float)width / src.width();
SkBitmap dstBM;
dstBM.setConfig(config, width, height, rowBytes);
@@ -210,7 +211,23 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src) {
}
SkASSERT(addr == baseAddr + size);
- return SkNEW_ARGS(SkMipMap, (levels, countLevels));
+ return SkNEW_ARGS(SkMipMap, (levels, countLevels, size));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+//static int gCounter;
+
+SkMipMap::SkMipMap(Level* levels, int count, size_t size)
+ : fSize(size), fLevels(levels), fCount(count) {
+ SkASSERT(levels);
+ SkASSERT(count > 0);
+// SkDebugf("mips %d\n", ++gCounter);
+}
+
+SkMipMap::~SkMipMap() {
+ sk_free(fLevels);
+// SkDebugf("mips %d\n", --gCounter);
}
static SkFixed compute_level(SkScalar scale) {
« no previous file with comments | « src/core/SkMipMap.h ('k') | src/core/SkScaledImageCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698