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

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

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Refactoring the mipmap level count out. Cleaning includes. Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkMipMap_DEFINED 8 #ifndef SkMipMap_DEFINED
9 #define SkMipMap_DEFINED 9 #define SkMipMap_DEFINED
10 10
(...skipping 10 matching lines...) Expand all
21 public: 21 public:
22 static SkMipMap* Build(const SkPixmap& src, SkDiscardableFactoryProc); 22 static SkMipMap* Build(const SkPixmap& src, SkDiscardableFactoryProc);
23 static SkMipMap* Build(const SkBitmap& src, SkDiscardableFactoryProc); 23 static SkMipMap* Build(const SkBitmap& src, SkDiscardableFactoryProc);
24 24
25 struct Level { 25 struct Level {
26 SkPixmap fPixmap; 26 SkPixmap fPixmap;
27 float fScale; // < 1.0 27 float fScale; // < 1.0
28 }; 28 };
29 29
30 bool extractLevel(SkScalar scale, Level*) const; 30 bool extractLevel(SkScalar scale, Level*) const;
31 int getLevelsCount() const;
32 // getLevel() is 1-indexed because the SkMipMap contains the generated
reed1 2016/01/22 16:29:13 All of skia's other apis are zero-based for indice
Chris Blume 2016/01/25 08:18:00 Done.
33 // mipmaps, which does not include the base level (which is normally
34 // mipmap level 0). SkMipMap contains mipmap levels 1-x, not 0-x.
35 bool getLevel(int levelIndex, Level* levelPtr) const;
31 36
32 protected: 37 protected:
33 void onDataChange(void* oldData, void* newData) override { 38 void onDataChange(void* oldData, void* newData) override {
34 fLevels = (Level*)newData; // could be nullptr 39 fLevels = (Level*)newData; // could be nullptr
35 } 40 }
36 41
37 private: 42 private:
38 Level* fLevels; 43 Level* fLevels;
39 int fCount; 44 int fCount;
40 45
41 // we take ownership of levels, and will free it with sk_free() 46 // we take ownership of levels, and will free it with sk_free()
42 SkMipMap(void* malloc, size_t size) : INHERITED(malloc, size) {} 47 SkMipMap(void* malloc, size_t size) : INHERITED(malloc, size) {}
43 SkMipMap(size_t size, SkDiscardableMemory* dm) : INHERITED(size, dm) {} 48 SkMipMap(size_t size, SkDiscardableMemory* dm) : INHERITED(size, dm) {}
44 49
45 static size_t AllocLevelsSize(int levelCount, size_t pixelSize); 50 static size_t AllocLevelsSize(int levelCount, size_t pixelSize);
46 51
47 typedef SkCachedData INHERITED; 52 typedef SkCachedData INHERITED;
48 }; 53 };
49 54
50 #endif 55 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageCacherator.cpp ('k') | src/core/SkMipMap.cpp » ('j') | src/gpu/gl/GrGLGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698