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

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

Issue 1617183004: Anisotropic mipmap fixes (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: SkIntToScalar 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
« no previous file with comments | « src/core/SkBitmapController.cpp ('k') | src/core/SkMipMap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "SkCachedData.h" 11 #include "SkCachedData.h"
12 #include "SkPixmap.h" 12 #include "SkPixmap.h"
13 #include "SkScalar.h" 13 #include "SkScalar.h"
14 #include "SkSize.h"
14 15
15 class SkBitmap; 16 class SkBitmap;
16 class SkDiscardableMemory; 17 class SkDiscardableMemory;
17 18
18 typedef SkDiscardableMemory* (*SkDiscardableFactoryProc)(size_t bytes); 19 typedef SkDiscardableMemory* (*SkDiscardableFactoryProc)(size_t bytes);
19 20
20 class SkMipMap : public SkCachedData { 21 class SkMipMap : public SkCachedData {
21 public: 22 public:
22 static SkMipMap* Build(const SkPixmap& src, SkDiscardableFactoryProc); 23 static SkMipMap* Build(const SkPixmap& src, SkDiscardableFactoryProc);
23 static SkMipMap* Build(const SkBitmap& src, SkDiscardableFactoryProc); 24 static SkMipMap* Build(const SkBitmap& src, SkDiscardableFactoryProc);
24 25
25 struct Level { 26 struct Level {
26 SkPixmap fPixmap; 27 SkPixmap fPixmap;
27 float fScale; // < 1.0 28 SkSize fScale; // < 1.0
28 }; 29 };
29 30
30 bool extractLevel(SkScalar scale, Level*) const; 31 bool extractLevel(SkScalar scale, Level*) const;
31 32
32 protected: 33 protected:
33 void onDataChange(void* oldData, void* newData) override { 34 void onDataChange(void* oldData, void* newData) override {
34 fLevels = (Level*)newData; // could be nullptr 35 fLevels = (Level*)newData; // could be nullptr
35 } 36 }
36 37
37 private: 38 private:
38 Level* fLevels; 39 Level* fLevels;
39 int fCount; 40 int fCount;
40 41
41 // we take ownership of levels, and will free it with sk_free() 42 // we take ownership of levels, and will free it with sk_free()
42 SkMipMap(void* malloc, size_t size) : INHERITED(malloc, size) {} 43 SkMipMap(void* malloc, size_t size) : INHERITED(malloc, size) {}
43 SkMipMap(size_t size, SkDiscardableMemory* dm) : INHERITED(size, dm) {} 44 SkMipMap(size_t size, SkDiscardableMemory* dm) : INHERITED(size, dm) {}
44 45
45 static size_t AllocLevelsSize(int levelCount, size_t pixelSize); 46 static size_t AllocLevelsSize(int levelCount, size_t pixelSize);
46 47
47 typedef SkCachedData INHERITED; 48 typedef SkCachedData INHERITED;
48 }; 49 };
49 50
50 #endif 51 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapController.cpp ('k') | src/core/SkMipMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698