aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders/gradients
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-10-25 15:12:19 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-25 19:32:20 +0000
commit4cbb6e6d551e8bea2c040b1aa9dce253cffb9af0 (patch)
treea93401716e0f5d45760da36b49c8cf8ea8e1cc21 /src/shaders/gradients
parent291af4f17e0630f78a8c4d22f304243fb28ae42b (diff)
Pass GrRenderTargetContext's GrColorSpaceInfo to SkShader and SkColorFilter.
Also to SkColorTo(Premul|Unpremul)GrColor4f. This can avoid cache lookups to find GrColorSpaceXforms as the xform pointer is stored in GrColorSpaceInfo after the first lookup. Also uses GrColorSpaceInfo to construct GrTextUtils::Paint. Bug: skia: Change-Id: Idf19d512a60d2269e6921c7fb54d93aee499a70d Reviewed-on: https://skia-review.googlesource.com/63660 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/shaders/gradients')
-rw-r--r--src/shaders/gradients/SkGradientShaderPriv.h2
-rw-r--r--src/shaders/gradients/SkLinearGradient.cpp5
-rw-r--r--src/shaders/gradients/SkRadialGradient.cpp2
-rw-r--r--src/shaders/gradients/SkSweepGradient.cpp2
-rw-r--r--src/shaders/gradients/SkTwoPointConicalGradient.cpp5
5 files changed, 8 insertions, 8 deletions
diff --git a/src/shaders/gradients/SkGradientShaderPriv.h b/src/shaders/gradients/SkGradientShaderPriv.h
index 7916e6951f..26bc033b58 100644
--- a/src/shaders/gradients/SkGradientShaderPriv.h
+++ b/src/shaders/gradients/SkGradientShaderPriv.h
@@ -257,7 +257,7 @@ static inline int next_dither_toggle(int toggle) {
#if SK_SUPPORT_GPU
-#include "GrColorSpaceXform.h"
+#include "GrColorSpaceInfo.h"
#include "GrCoordTransform.h"
#include "GrFragmentProcessor.h"
#include "glsl/GrGLSLFragmentProcessor.h"
diff --git a/src/shaders/gradients/SkLinearGradient.cpp b/src/shaders/gradients/SkLinearGradient.cpp
index c0cade38dc..10d0973c60 100644
--- a/src/shaders/gradients/SkLinearGradient.cpp
+++ b/src/shaders/gradients/SkLinearGradient.cpp
@@ -5,9 +5,9 @@
* found in the LICENSE file.
*/
+#include "SkLinearGradient.h"
#include "Sk4fLinearGradient.h"
#include "SkColorSpaceXformer.h"
-#include "SkLinearGradient.h"
#include "SkRefCnt.h"
static SkMatrix pts_to_unit_matrix(const SkPoint pts[2]) {
@@ -88,7 +88,6 @@ SkShader::GradientType SkLinearGradient::asAGradient(GradientInfo* info) const {
#if SK_SUPPORT_GPU
-#include "GrColorSpaceXform.h"
#include "GrShaderCaps.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "SkGr.h"
@@ -214,7 +213,7 @@ std::unique_ptr<GrFragmentProcessor> SkLinearGradient::asFragmentProcessor(
matrix.postConcat(fPtsToUnit);
return GrLinearGradient::Make(GrGradientEffect::CreateArgs(
- args.fContext, this, &matrix, fTileMode, args.fDstColorSpace));
+ args.fContext, this, &matrix, fTileMode, args.fDstColorSpaceInfo->colorSpace()));
}
diff --git a/src/shaders/gradients/SkRadialGradient.cpp b/src/shaders/gradients/SkRadialGradient.cpp
index e704554fcb..d411c3a014 100644
--- a/src/shaders/gradients/SkRadialGradient.cpp
+++ b/src/shaders/gradients/SkRadialGradient.cpp
@@ -187,7 +187,7 @@ std::unique_ptr<GrFragmentProcessor> SkRadialGradient::asFragmentProcessor(
matrix.postConcat(fPtsToUnit);
return GrRadialGradient::Make(GrGradientEffect::CreateArgs(
- args.fContext, this, &matrix, fTileMode, args.fDstColorSpace));
+ args.fContext, this, &matrix, fTileMode, args.fDstColorSpaceInfo->colorSpace()));
}
#endif
diff --git a/src/shaders/gradients/SkSweepGradient.cpp b/src/shaders/gradients/SkSweepGradient.cpp
index 551a6fbd02..b505426c58 100644
--- a/src/shaders/gradients/SkSweepGradient.cpp
+++ b/src/shaders/gradients/SkSweepGradient.cpp
@@ -243,7 +243,7 @@ std::unique_ptr<GrFragmentProcessor> SkSweepGradient::asFragmentProcessor(
return GrSweepGradient::Make(
GrGradientEffect::CreateArgs(args.fContext, this, &matrix, fTileMode,
- args.fDstColorSpace),
+ args.fDstColorSpaceInfo->colorSpace()),
fTBias, fTScale);
}
diff --git a/src/shaders/gradients/SkTwoPointConicalGradient.cpp b/src/shaders/gradients/SkTwoPointConicalGradient.cpp
index d84108b98c..22555e02a3 100644
--- a/src/shaders/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/shaders/gradients/SkTwoPointConicalGradient.cpp
@@ -130,8 +130,9 @@ void SkTwoPointConicalGradient::flatten(SkWriteBuffer& buffer) const {
std::unique_ptr<GrFragmentProcessor> SkTwoPointConicalGradient::asFragmentProcessor(
const AsFPArgs& args) const {
SkASSERT(args.fContext);
- return Gr2PtConicalGradientEffect::Make(GrGradientEffect::CreateArgs(
- args.fContext, this, args.fLocalMatrix, fTileMode, args.fDstColorSpace));
+ return Gr2PtConicalGradientEffect::Make(
+ GrGradientEffect::CreateArgs(args.fContext, this, args.fLocalMatrix, fTileMode,
+ args.fDstColorSpaceInfo->colorSpace()));
}
#endif