Index: samplecode/SampleApp.cpp |
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp |
index 0c9c3f0276d6005cfb4345051b77f845c00f2f68..804cf7a35484d9ecdbb9cbdd4ad9808896780ed6 100644 |
--- a/samplecode/SampleApp.cpp |
+++ b/samplecode/SampleApp.cpp |
@@ -15,6 +15,7 @@ |
#include "SkCommandLineFlags.h" |
#include "SkData.h" |
#include "SkDocument.h" |
+#include "SkGammaColorFilter.h" |
#include "SkGraphics.h" |
#include "SkImage_Base.h" |
#include "SkImageEncoder.h" |
@@ -36,8 +37,6 @@ |
#if SK_SUPPORT_GPU |
# include "gl/GrGLInterface.h" |
# include "gl/GrGLUtil.h" |
-# include "GrDrawContext.h" |
-# include "GrRenderTarget.h" |
# include "GrContext.h" |
# include "SkGr.h" |
# if SK_ANGLE |
@@ -335,17 +334,19 @@ public: |
SkCanvas* canvas = fGpuSurface->getCanvas(); |
- // Temporary code until applyGamma is replaced |
- GrDrawContext* dc = canvas->internal_private_accessTopLayerDrawContext(); |
- GrRenderTarget* rt = dc->accessRenderTarget(); |
- GrTexture* texture = image->getTexture(); |
- SkASSERT(texture); |
- |
// With ten-bit output, we need to manually apply the gamma of the output device |
// (unless we're in non-gamma correct mode, in which case our data is already |
// fake-sRGB, like we're expected to put in the 10-bit buffer): |
bool doGamma = (fActualColorBits == 30) && SkImageInfoIsGammaCorrect(win->info()); |
- fCurContext->applyGamma(rt, texture, doGamma ? 1.0f / 2.2f : 1.0f); |
+ |
+ SkPaint gammaPaint; |
+ gammaPaint.setXfermodeMode(SkXfermode::kSrc_Mode); |
+ if (doGamma) { |
+ gammaPaint.setColorFilter(SkGammaColorFilter::Make(1.0f / 2.2f)); |
+ } |
+ |
+ canvas->drawImage(image, 0, 0, &gammaPaint); |
+ canvas->flush(); |
bsalomon
2016/07/29 14:15:07
Move this canvas->flush() above win->present() at
robertphillips
2016/07/29 14:39:28
Done.
|
} |
#endif |