aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkMipMap.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-06-10 11:41:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-10 11:41:47 -0700
commit6644d9353f3f0c09914385fd762e073f98d54205 (patch)
tree617f3b1d2ca2b06cc34decfb44c4c975ba903ca5 /src/core/SkMipMap.h
parent7049396b65660907af5292d899053280430d929a (diff)
respect srgb gamma when building mips
Proposed policy: - If the target is *legacy* (e.g. L32/PMColor) ignore gamma - If the target is S32/F16 respect gamma BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029373004 Review-Url: https://codereview.chromium.org/2029373004
Diffstat (limited to 'src/core/SkMipMap.h')
-rw-r--r--src/core/SkMipMap.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/core/SkMipMap.h b/src/core/SkMipMap.h
index 7c798ef833..0f31a9f703 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) {}