aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-03-01 12:53:06 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-01 12:53:06 -0800
commita6f58194733c1c50e4fe5f98585e42344f29b6f0 (patch)
tree788d199ef37b8596e5be52bb94b32208282afbc9 /dm
parent4bc31815ba1aa42ea13c5637c6b52262422b7bdb (diff)
Progress on gamma-correctness in the GPU backend. Fixed conversion of color and profile type to pixel config, which makes many things "just work".
Added (color=8888|f16|srgb) option to gpu configurations, along with gpuf16, gpusrgb, and anglesrgb predefined configs. Runs the gpu backend in gamma-correct mode (with either FP16 linear or sRGB 8888 frambuffers). BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1750383002 Review URL: https://codereview.chromium.org/1750383002
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp3
-rw-r--r--dm/DMSrcSink.cpp7
-rw-r--r--dm/DMSrcSink.h5
3 files changed, 12 insertions, 3 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 0190262787..0bd5b79292 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -739,7 +739,8 @@ static Sink* create_sink(const SkCommandLineConfig* config) {
return nullptr;
}
return new GPUSink(contextType, contextOptions, gpuConfig->getSamples(),
- gpuConfig->getUseDIText(), FLAGS_gpu_threading);
+ gpuConfig->getUseDIText(), gpuConfig->getColorType(),
+ gpuConfig->getProfileType(), FLAGS_gpu_threading);
}
}
#endif
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 2d2a455e7b..c1db17814a 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -856,11 +856,15 @@ GPUSink::GPUSink(GrContextFactory::GLContextType ct,
GrContextFactory::GLContextOptions options,
int samples,
bool diText,
+ SkColorType colorType,
+ SkColorProfileType profileType,
bool threaded)
: fContextType(ct)
, fContextOptions(options)
, fSampleCount(samples)
, fUseDIText(diText)
+ , fColorType(colorType)
+ , fProfileType(profileType)
, fThreaded(threaded) {}
void PreAbandonGpuContextErrorHandler(SkError, void*) {}
@@ -882,7 +886,8 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
GrContextFactory factory(grOptions);
const SkISize size = src.size();
const SkImageInfo info =
- SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul_SkAlphaType);
+ SkImageInfo::Make(size.width(), size.height(), fColorType,
+ kPremul_SkAlphaType, fProfileType);
#if SK_SUPPORT_GPU
const int maxDimension = factory.getContextInfo(fContextType, fContextOptions).
fGrContext->caps()->maxTextureSize();
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
index bbf47cffd8..babe14d135 100644
--- a/dm/DMSrcSink.h
+++ b/dm/DMSrcSink.h
@@ -213,7 +213,8 @@ public:
class GPUSink : public Sink {
public:
GPUSink(GrContextFactory::GLContextType, GrContextFactory::GLContextOptions,
- int samples, bool diText, bool threaded);
+ int samples, bool diText, SkColorType colorType, SkColorProfileType profileType,
+ bool threaded);
Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
bool serial() const override { return !fThreaded; }
@@ -224,6 +225,8 @@ private:
GrContextFactory::GLContextOptions fContextOptions;
int fSampleCount;
bool fUseDIText;
+ SkColorType fColorType;
+ SkColorProfileType fProfileType;
bool fThreaded;
};