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

Unified Diff: src/core/SkMipMap.h

Issue 2029373004: respect srgb gamma when building mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 4 years, 6 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/SkLightingShader.cpp ('k') | src/core/SkMipMap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMipMap.h
diff --git a/src/core/SkMipMap.h b/src/core/SkMipMap.h
index 7c798ef8337069c27dcc2efc5a1ac311aa545a4a..0f31a9f703d48904946e142c273918ae508acfbc 100644
--- a/src/core/SkMipMap.h
+++ b/src/core/SkMipMap.h
@@ -12,6 +12,7 @@
#include "SkPixmap.h"
#include "SkScalar.h"
#include "SkSize.h"
+#include "SkShader.h"
class SkBitmap;
class SkDiscardableMemory;
@@ -27,8 +28,13 @@ typedef SkDiscardableMemory* (*SkDiscardableFactoryProc)(size_t bytes);
*/
class SkMipMap : public SkCachedData {
public:
- static SkMipMap* Build(const SkPixmap& src, SkDiscardableFactoryProc);
- static SkMipMap* Build(const SkBitmap& src, SkDiscardableFactoryProc);
+ static SkMipMap* Build(const SkPixmap& src, SkSourceGammaTreatment, SkDiscardableFactoryProc);
+ static SkMipMap* Build(const SkBitmap& src, SkSourceGammaTreatment, SkDiscardableFactoryProc);
+
+ static SkSourceGammaTreatment DeduceTreatment(const SkShader::ContextRec& rec) {
+ return (SkShader::ContextRec::kPMColor_DstType == rec.fPreferredDstType) ?
+ SkSourceGammaTreatment::kIgnore : SkSourceGammaTreatment::kRespect;
+ }
// Determines how many levels a SkMipMap will have without creating that mipmap.
// This does not include the base mipmap level that the user provided when
@@ -61,10 +67,10 @@ protected:
}
private:
- Level* fLevels;
- int fCount;
+ sk_sp<SkColorSpace> fCS;
+ Level* fLevels; // managed by the baseclass, may be null due to onDataChanged.
+ int fCount;
- // we take ownership of levels, and will free it with sk_free()
SkMipMap(void* malloc, size_t size) : INHERITED(malloc, size) {}
SkMipMap(size_t size, SkDiscardableMemory* dm) : INHERITED(size, dm) {}
« no previous file with comments | « src/core/SkLightingShader.cpp ('k') | src/core/SkMipMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698