aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-03-07 16:58:08 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-08 20:55:21 +0000
commit3b65598bceb65736486db27ed49a56d787032747 (patch)
treedd52a8a485d767167f845ef97d40ae2d8ea70997
parent41eac798f8ae5bb0fd3af3c16390d75501259f8d (diff)
Make SkGr.h private and remove unused functions
BUG=skia: Change-Id: I6699d00c5412ed9d9bf14b032a08b06b1c766bce Reviewed-on: https://skia-review.googlesource.com/9398 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
-rw-r--r--experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp1
-rw-r--r--gm/constcolorprocessor.cpp2
-rw-r--r--gn/gpu.gni4
-rw-r--r--include/gpu/SkGr.h99
-rw-r--r--src/core/SkCanvas.cpp2
-rw-r--r--src/core/SkImageCacherator.cpp1
-rw-r--r--src/core/SkImageFilter.cpp2
-rw-r--r--src/core/SkLightingShader.cpp1
-rw-r--r--src/core/SkRadialShadowMapShader.cpp1
-rw-r--r--src/core/SkShadowShader.cpp1
-rw-r--r--src/core/SkSpecialImage.cpp1
-rw-r--r--src/effects/SkArithmeticImageFilter.cpp1
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp1
-rw-r--r--src/effects/SkLightingImageFilter.cpp1
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp1
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp1
-rw-r--r--src/effects/SkRRectsGaussianEdgeMaskFilter.cpp1
-rw-r--r--src/effects/SkTableColorFilter.cpp1
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp1
-rw-r--r--src/effects/gradients/SkGradientShader.cpp1
-rw-r--r--src/gpu/GrBitmapTextureMaker.cpp2
-rw-r--r--src/gpu/GrBlurUtils.cpp2
-rw-r--r--src/gpu/GrContext.cpp2
-rw-r--r--src/gpu/GrImageTextureMaker.cpp2
-rw-r--r--src/gpu/GrSurface.cpp2
-rw-r--r--src/gpu/GrTextureAdjuster.cpp2
-rw-r--r--src/gpu/SkGpuDevice.cpp1
-rw-r--r--src/gpu/SkGpuDevice.h1
-rw-r--r--src/gpu/SkGpuDevice_drawTexture.cpp2
-rw-r--r--src/gpu/SkGr.cpp1
-rw-r--r--src/gpu/SkGr.h (renamed from src/gpu/SkGrPriv.h)193
-rw-r--r--src/gpu/effects/GrXfermodeFragmentProcessor.cpp2
-rw-r--r--src/gpu/ops/GrDrawVerticesOp.cpp2
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp2
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.cpp2
-rw-r--r--src/gpu/text/GrTextUtils.cpp2
-rw-r--r--src/image/SkImageShader.cpp1
-rw-r--r--src/image/SkImage_Gpu.cpp2
-rw-r--r--src/image/SkImage_Raster.cpp1
-rw-r--r--tests/GrGetCoeffBlendKnownComponentsTest.cpp11
-rw-r--r--tests/SpecialImageTest.cpp2
-rw-r--r--tools/gpu/GrTest.cpp2
42 files changed, 161 insertions, 202 deletions
diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
index a90baae1de..be8b1b1878 100644
--- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
+++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
@@ -20,7 +20,6 @@
#include "GrContext.h"
#include "GrCoordTransform.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "effects/GrConstColorProcessor.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp
index 17a1bc5820..831ba69b89 100644
--- a/gm/constcolorprocessor.cpp
+++ b/gm/constcolorprocessor.cpp
@@ -13,7 +13,7 @@
#include "GrContext.h"
#include "GrRenderTargetContextPriv.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkGradientShader.h"
#include "effects/GrConstColorProcessor.h"
#include "ops/GrDrawOp.h"
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 4cab21f811..e34ff45c30 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -453,13 +453,11 @@ skia_gpu_sources = [
"$_src/gpu/glsl/GrGLSLXferProcessor.h",
# Sk files
- "$_include/gpu/SkGr.h",
-
"$_src/gpu/SkGpuDevice.cpp",
"$_src/gpu/SkGpuDevice.h",
"$_src/gpu/SkGpuDevice_drawTexture.cpp",
+ "$_src/gpu/SkGr.h",
"$_src/gpu/SkGr.cpp",
- "$_src/gpu/SkGrPriv.h",
"$_src/image/SkImage_Gpu.h",
"$_src/image/SkImage_Gpu.cpp",
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
deleted file mode 100644
index 02df699ab4..0000000000
--- a/include/gpu/SkGr.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkGr_DEFINED
-#define SkGr_DEFINED
-
-#include "GrColor.h"
-#include "GrSamplerParams.h"
-#include "SkColor.h"
-#include "SkColorPriv.h"
-#include "SkFilterQuality.h"
-#include "SkImageInfo.h"
-
-class GrCaps;
-class GrColorSpaceXform;
-class GrContext;
-class GrTexture;
-class SkBitmap;
-
-////////////////////////////////////////////////////////////////////////////////
-// Sk to Gr Type conversions
-
-static inline GrColor SkColorToPremulGrColor(SkColor c) {
- SkPMColor pm = SkPreMultiplyColor(c);
- unsigned r = SkGetPackedR32(pm);
- unsigned g = SkGetPackedG32(pm);
- unsigned b = SkGetPackedB32(pm);
- unsigned a = SkGetPackedA32(pm);
- return GrColorPackRGBA(r, g, b, a);
-}
-
-static inline GrColor SkColorToUnpremulGrColor(SkColor c) {
- unsigned r = SkColorGetR(c);
- unsigned g = SkColorGetG(c);
- unsigned b = SkColorGetB(c);
- unsigned a = SkColorGetA(c);
- return GrColorPackRGBA(r, g, b, a);
-}
-
-/** Transform an SkColor (sRGB bytes) to GrColor4f for the specified color space. */
-GrColor4f SkColorToPremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace);
-GrColor4f SkColorToUnpremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace);
-
-/**
- * As above, but with a caller-supplied color space xform object. Faster for the cases where we
- * have that cached.
- */
-GrColor4f SkColorToPremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace,
- GrColorSpaceXform* gamutXform);
-GrColor4f SkColorToUnpremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace,
- GrColorSpaceXform* gamutXform);
-
-static inline GrColor SkColorToOpaqueGrColor(SkColor c) {
- unsigned r = SkColorGetR(c);
- unsigned g = SkColorGetG(c);
- unsigned b = SkColorGetB(c);
- return GrColorPackRGBA(r, g, b, 0xFF);
-}
-
-/** Replicates the SkColor's alpha to all four channels of the GrColor. */
-static inline GrColor SkColorAlphaToGrColor(SkColor c) {
- U8CPU a = SkColorGetA(c);
- return GrColorPackRGBA(a, a, a, a);
-}
-
-static inline SkPMColor GrColorToSkPMColor(GrColor c) {
- GrColorIsPMAssert(c);
- return SkPackARGB32(GrColorUnpackA(c), GrColorUnpackR(c), GrColorUnpackG(c), GrColorUnpackB(c));
-}
-
-static inline GrColor SkPMColorToGrColor(SkPMColor c) {
- return GrColorPackRGBA(SkGetPackedR32(c), SkGetPackedG32(c), SkGetPackedB32(c),
- SkGetPackedA32(c));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-/** Returns a texture representing the bitmap that is compatible with the GrSamplerParams. The
- * texture is inserted into the cache (unless the bitmap is marked volatile) and can be
- * retrieved again via this function.
- * The 'scaleAdjust' in/out parameter will be updated to hold any rescaling that needs to be
- * performed on the absolute texture coordinates (e.g., if the texture is resized out to
- * the next power of two). It can be null if the caller is sure the bitmap won't be resized.
- */
-GrTexture* GrRefCachedBitmapTexture(GrContext*, const SkBitmap&,
- const GrSamplerParams&, SkScalar scaleAdjust[2]);
-
-// TODO: Move SkImageInfo2GrPixelConfig to SkGrPriv.h (requires cleanup to SkWindow its subclasses).
-GrPixelConfig SkImageInfo2GrPixelConfig(const SkImageInfo& info, const GrCaps& caps);
-
-GrSamplerParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality,
- const SkMatrix& viewM,
- const SkMatrix& localM,
- bool* doBicubic);
-
-#endif
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 68a11bf67c..fc1c23a6c2 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -45,7 +45,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrRenderTarget.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#endif
#include "SkClipOpPriv.h"
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index b4f9e8b949..196723cec0 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -25,7 +25,6 @@
#include "GrSamplerParams.h"
#include "GrYUVProvider.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#endif
// Until we actually have codecs/etc. that can contain/support a GPU texture format
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index d66d99c01f..a0d3df7500 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -24,7 +24,7 @@
#include "GrFixedClip.h"
#include "GrRenderTargetContext.h"
#include "GrTextureProxy.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#endif
#ifndef SK_IGNORE_TO_STRING
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index 2deacc28b8..e1e188296d 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -105,7 +105,6 @@ private:
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLUniformHandler.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
// This FP expects a premul'd color input for its diffuse color. Premul'ing of the paint's color is
// handled by the asFragmentProcessor() factory, but shaders providing diffuse color must output it
diff --git a/src/core/SkRadialShadowMapShader.cpp b/src/core/SkRadialShadowMapShader.cpp
index 0cc60f12bd..45cc1d9a59 100644
--- a/src/core/SkRadialShadowMapShader.cpp
+++ b/src/core/SkRadialShadowMapShader.cpp
@@ -87,7 +87,6 @@ private:
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "SkImage_Base.h"
#include "GrInvariantOutput.h"
#include "SkSpecialImage.h"
diff --git a/src/core/SkShadowShader.cpp b/src/core/SkShadowShader.cpp
index afefa95618..5f4ce66ec1 100644
--- a/src/core/SkShadowShader.cpp
+++ b/src/core/SkShadowShader.cpp
@@ -101,7 +101,6 @@ private:
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "SkSpecialImage.h"
#include "SkImage_Base.h"
#include "GrContext.h"
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 9ded6aafd8..1940fb9fc7 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -23,7 +23,6 @@
#include "GrSamplerParams.h"
#include "GrTextureProxy.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "SkImage_Gpu.h"
#endif
diff --git a/src/effects/SkArithmeticImageFilter.cpp b/src/effects/SkArithmeticImageFilter.cpp
index 7f9dc7f594..189171ae6e 100644
--- a/src/effects/SkArithmeticImageFilter.cpp
+++ b/src/effects/SkArithmeticImageFilter.cpp
@@ -19,7 +19,6 @@
#include "GrRenderTargetContext.h"
#include "GrTextureProxy.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "effects/GrConstColorProcessor.h"
#include "effects/GrTextureDomain.h"
#include "glsl/GrGLSLFragmentProcessor.h"
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 8384058370..0a3b6a8d1c 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -20,7 +20,6 @@
#include "GrTextureProxy.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "effects/GrTextureDomain.h"
#include "glsl/GrGLSLColorSpaceXformHelper.h"
#include "glsl/GrGLSLFragmentProcessor.h"
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 3ed017ee61..6e1e8b8cbc 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -23,7 +23,6 @@
#include "GrTextureProxy.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "effects/GrSingleTextureEffect.h"
#include "effects/GrTextureDomain.h"
#include "glsl/GrGLSLFragmentProcessor.h"
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 81d9f8d322..e54b5c1965 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -23,7 +23,6 @@
#include "GrTextureProxy.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "effects/Gr1DKernelEffect.h"
#include "effects/GrProxyMove.h"
#include "glsl/GrGLSLFragmentProcessor.h"
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 4ebf36a803..73e10184e3 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -19,7 +19,6 @@
#include "GrContext.h"
#include "GrCoordTransform.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "effects/GrConstColorProcessor.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
diff --git a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
index b3967ecabb..609f37ecd5 100644
--- a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
+++ b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
@@ -195,7 +195,6 @@ bool SkRRectsGaussianEdgeMaskFilterImpl::filterMask(SkMask* dst, const SkMask& s
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLUniformHandler.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
class RRectsGaussianEdgeFP : public GrFragmentProcessor {
public:
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index ba3f084d74..099846d2b3 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -363,7 +363,6 @@ sk_sp<SkColorFilter> SkTable_ColorFilter::makeComposed(sk_sp<SkColorFilter> inne
#include "GrFragmentProcessor.h"
#include "GrTextureStripAtlas.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index c9e5a8a601..5e1a8b56c0 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -23,7 +23,6 @@
#include "effects/GrTextureDomain.h"
#include "effects/GrSimpleTextureEffect.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#endif
#include "SkClipOpPriv.h"
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 8538ddd7fe..afb4f8b95a 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1131,7 +1131,6 @@ SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLUniformHandler.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
static inline bool close_to_one_half(const SkFixed& val) {
return SkScalarNearlyEqual(SkFixedToScalar(val), SK_ScalarHalf);
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp
index 24cb05f937..d2bf67ede3 100644
--- a/src/gpu/GrBitmapTextureMaker.cpp
+++ b/src/gpu/GrBitmapTextureMaker.cpp
@@ -11,7 +11,7 @@
#include "GrGpuResourcePriv.h"
#include "GrResourceProvider.h"
#include "SkBitmap.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkPixelRef.h"
static bool bmp_is_alpha_only(const SkBitmap& bm) { return kAlpha_8_SkColorType == bm.colorType(); }
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 6716fdec77..c2b8809f87 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -18,7 +18,7 @@
#include "GrTexture.h"
#include "GrTextureProxy.h"
#include "SkDraw.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkMaskFilter.h"
#include "SkPaint.h"
#include "SkTLazy.h"
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 38ab1a46aa..67c497b680 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -21,7 +21,7 @@
#include "GrTextureContext.h"
#include "SkConvertPixels.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkUnPreMultiplyPriv.h"
#include "effects/GrConfigConversionEffect.h"
diff --git a/src/gpu/GrImageTextureMaker.cpp b/src/gpu/GrImageTextureMaker.cpp
index 086e40e06b..fa96656e8c 100644
--- a/src/gpu/GrImageTextureMaker.cpp
+++ b/src/gpu/GrImageTextureMaker.cpp
@@ -9,7 +9,7 @@
#include "GrContext.h"
#include "GrGpuResourcePriv.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkImage_Base.h"
#include "SkImageCacherator.h"
#include "SkPixelRef.h"
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index c3ac224a04..b292377b12 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -10,7 +10,7 @@
#include "GrOpList.h"
#include "GrSurfacePriv.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkMathPriv.h"
GrSurface::~GrSurface() {
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index 63d9a11be7..6baf299329 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -12,7 +12,7 @@
#include "GrGpuResourcePriv.h"
#include "GrResourceProvider.h"
#include "GrTexture.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, SkAlphaType alphaType,
const SkIRect& contentArea, uint32_t uniqueID,
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index bcc2930821..e7e776fc7d 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -22,7 +22,6 @@
#include "SkDraw.h"
#include "SkGlyphCache.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "SkImageCacherator.h"
#include "SkImageFilter.h"
#include "SkImageFilterCache.h"
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 655724ca90..a3312698fe 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -9,7 +9,6 @@
#define SkGpuDevice_DEFINED
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "SkBitmap.h"
#include "SkClipStackDevice.h"
#include "SkPicture.h"
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index cff26b4591..187152a4d1 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -13,7 +13,7 @@
#include "GrStyle.h"
#include "GrTextureAdjuster.h"
#include "SkDraw.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkMaskFilter.h"
#include "effects/GrBicubicEffect.h"
#include "effects/GrSimpleTextureEffect.h"
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 69f6061d78..2ba71bcecd 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -6,7 +6,6 @@
*/
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "GrBitmapTextureMaker.h"
#include "GrCaps.h"
diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGr.h
index 7f52ee8596..9844e8a2aa 100644
--- a/src/gpu/SkGrPriv.h
+++ b/src/gpu/SkGr.h
@@ -1,23 +1,28 @@
/*
- * Copyright 2015 Google Inc.
+ * Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#ifndef SkGrPriv_DEFINED
-#define SkGrPriv_DEFINED
+#ifndef SkGr_DEFINED
+#define SkGr_DEFINED
#include "GrBlend.h"
+#include "GrColor.h"
#include "GrSamplerParams.h"
#include "GrTypes.h"
#include "SkCanvas.h"
+#include "SkColor.h"
+#include "SkColorPriv.h"
+#include "SkFilterQuality.h"
#include "SkImageInfo.h"
#include "SkMatrix.h"
#include "SkPM4f.h"
#include "SkXfermodePriv.h"
class GrCaps;
+class GrColorSpaceXform;
class GrContext;
class GrRenderTargetContext;
class GrFragmentProcessor;
@@ -32,22 +37,62 @@ class SkPixelRef;
class SkPixmap;
struct SkIRect;
+////////////////////////////////////////////////////////////////////////////////
+// Color type conversions
+
+static inline GrColor SkColorToPremulGrColor(SkColor c) {
+ SkPMColor pm = SkPreMultiplyColor(c);
+ unsigned r = SkGetPackedR32(pm);
+ unsigned g = SkGetPackedG32(pm);
+ unsigned b = SkGetPackedB32(pm);
+ unsigned a = SkGetPackedA32(pm);
+ return GrColorPackRGBA(r, g, b, a);
+}
+
+static inline GrColor SkColorToUnpremulGrColor(SkColor c) {
+ unsigned r = SkColorGetR(c);
+ unsigned g = SkColorGetG(c);
+ unsigned b = SkColorGetB(c);
+ unsigned a = SkColorGetA(c);
+ return GrColorPackRGBA(r, g, b, a);
+}
+
+/** Transform an SkColor (sRGB bytes) to GrColor4f for the specified color space. */
+GrColor4f SkColorToPremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace);
+GrColor4f SkColorToUnpremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace);
+
/**
- * Our key includes the offset, width, and height so that bitmaps created by extractSubset()
- * are unique.
- *
- * The imageID is in the shared namespace (see SkNextID::ImageID())
- * - SkBitmap/SkPixelRef
- * - SkImage
- * - SkImageGenerator
- *
- * Note: width/height must fit in 16bits for this impl.
+ * As above, but with a caller-supplied color space xform object. Faster for the cases where we
+ * have that cached.
*/
-void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& imageBounds);
+GrColor4f SkColorToPremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace,
+ GrColorSpaceXform* gamutXform);
+GrColor4f SkColorToUnpremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace,
+ GrColorSpaceXform* gamutXform);
+
+/** Replicates the SkColor's alpha to all four channels of the GrColor. */
+static inline GrColor SkColorAlphaToGrColor(SkColor c) {
+ U8CPU a = SkColorGetA(c);
+ return GrColorPackRGBA(a, a, a, a);
+}
-/** Call this after installing a GrUniqueKey on texture. It will cause the texture's key to be
- removed should the bitmap's contents change or be destroyed. */
-void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pixelRef);
+//////////////////////////////////////////////////////////////////////////////
+
+static inline SkPM4f GrColor4fToSkPM4f(const GrColor4f& c) {
+ SkPM4f pm4f;
+ pm4f.fVec[SkPM4f::R] = c.fRGBA[0];
+ pm4f.fVec[SkPM4f::G] = c.fRGBA[1];
+ pm4f.fVec[SkPM4f::B] = c.fRGBA[2];
+ pm4f.fVec[SkPM4f::A] = c.fRGBA[3];
+ return pm4f;
+}
+
+static inline GrColor4f SkPM4fToGrColor4f(const SkPM4f& c) {
+ return GrColor4f{c.r(), c.g(), c.b(), c.a()};
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Paint conversion
/** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is required in order
to convert the SkShader (if any) on the SkPaint. The primitive itself has no color. */
@@ -104,6 +149,19 @@ bool SkPaintToGrPaintWithTexture(GrContext* context,
bool textureIsAlphaOnly,
GrPaint* grPaint);
+////////////////////////////////////////////////////////////////////////////////
+// Misc Sk to Gr type conversions
+
+GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&);
+GrPixelConfig SkImageInfo2GrPixelConfig(const SkImageInfo& info, const GrCaps& caps);
+
+bool GrPixelConfigToColorType(GrPixelConfig, SkColorType*);
+
+GrSamplerParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality,
+ const SkMatrix& viewM,
+ const SkMatrix& localM,
+ bool* doBicubic);
+
//////////////////////////////////////////////////////////////////////////////
static inline GrPrimitiveType SkVertexModeToGrPrimitiveType(const SkCanvas::VertexMode mode) {
@@ -121,43 +179,32 @@ static inline GrPrimitiveType SkVertexModeToGrPrimitiveType(const SkCanvas::Vert
//////////////////////////////////////////////////////////////////////////////
-static inline SkPM4f GrColor4fToSkPM4f(const GrColor4f& c) {
- SkPM4f pm4f;
- pm4f.fVec[SkPM4f::R] = c.fRGBA[0];
- pm4f.fVec[SkPM4f::G] = c.fRGBA[1];
- pm4f.fVec[SkPM4f::B] = c.fRGBA[2];
- pm4f.fVec[SkPM4f::A] = c.fRGBA[3];
- return pm4f;
-}
-
-static inline GrColor4f SkPM4fToGrColor4f(const SkPM4f& c) {
- return GrColor4f{c.r(), c.g(), c.b(), c.a()};
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&);
+GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff);
+GR_STATIC_ASSERT((int)kOne_GrBlendCoeff == (int)SkXfermode::kOne_Coeff);
+GR_STATIC_ASSERT((int)kSC_GrBlendCoeff == (int)SkXfermode::kSC_Coeff);
+GR_STATIC_ASSERT((int)kISC_GrBlendCoeff == (int)SkXfermode::kISC_Coeff);
+GR_STATIC_ASSERT((int)kDC_GrBlendCoeff == (int)SkXfermode::kDC_Coeff);
+GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff);
+GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff);
+GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff);
+GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff);
+GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff);
+GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10);
-bool GrPixelConfigToColorType(GrPixelConfig, SkColorType*);
+#define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X))
-/** When image filter code needs to construct a render target context to do intermediate rendering,
- we need a renderable pixel config. The source (SkSpecialImage) may not be in a renderable
- format, but we want to preserve the color space of that source. This picks an appropriate format
- to use. */
-GrPixelConfig GrRenderableConfigForColorSpace(const SkColorSpace*);
+////////////////////////////////////////////////////////////////////////////////
+// Texture management
-/**
- * If the compressed data in the SkData is supported (as a texture format, this returns
- * the pixel-config that should be used, and sets outStartOfDataToUpload to the ptr into
- * the data where the actual raw data starts (skipping any header bytes).
- *
- * If the compressed data is not supported, this returns kUnknown_GrPixelConfig, and
- * ignores outStartOfDataToUpload.
+/** Returns a texture representing the bitmap that is compatible with the GrSamplerParams. The
+ * texture is inserted into the cache (unless the bitmap is marked volatile) and can be
+ * retrieved again via this function.
+ * The 'scaleAdjust' in/out parameter will be updated to hold any rescaling that needs to be
+ * performed on the absolute texture coordinates (e.g., if the texture is resized out to
+ * the next power of two). It can be null if the caller is sure the bitmap won't be resized.
*/
-GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data,
- int expectedW, int expectedH,
- const void** outStartOfDataToUpload);
-
+GrTexture* GrRefCachedBitmapTexture(GrContext*, const SkBitmap&,
+ const GrSamplerParams&, SkScalar scaleAdjust[2]);
/**
* Creates a new texture for the bitmap. Does not concern itself with cache keys or texture params.
@@ -196,20 +243,44 @@ sk_sp<GrTexture> GrMakeCachedBitmapTexture(GrContext*, const SkBitmap&,
// }
sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrContext* context, const SkBitmap& bitmap);
+
+/**
+ * Our key includes the offset, width, and height so that bitmaps created by extractSubset()
+ * are unique.
+ *
+ * The imageID is in the shared namespace (see SkNextID::ImageID())
+ * - SkBitmap/SkPixelRef
+ * - SkImage
+ * - SkImageGenerator
+ *
+ * Note: width/height must fit in 16bits for this impl.
+ */
+void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& imageBounds);
+
+/** Call this after installing a GrUniqueKey on texture. It will cause the texture's key to be
+ removed should the bitmap's contents change or be destroyed. */
+void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pixelRef);
+
//////////////////////////////////////////////////////////////////////////////
-GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff);
-GR_STATIC_ASSERT((int)kOne_GrBlendCoeff == (int)SkXfermode::kOne_Coeff);
-GR_STATIC_ASSERT((int)kSC_GrBlendCoeff == (int)SkXfermode::kSC_Coeff);
-GR_STATIC_ASSERT((int)kISC_GrBlendCoeff == (int)SkXfermode::kISC_Coeff);
-GR_STATIC_ASSERT((int)kDC_GrBlendCoeff == (int)SkXfermode::kDC_Coeff);
-GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff);
-GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff);
-GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff);
-GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff);
-GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff);
-GR_STATIC_ASSERT(SkXfermode::kCoeffCount == 10);
+/** When image filter code needs to construct a render target context to do intermediate rendering,
+ we need a renderable pixel config. The source (SkSpecialImage) may not be in a renderable
+ format, but we want to preserve the color space of that source. This picks an appropriate format
+ to use. */
+GrPixelConfig GrRenderableConfigForColorSpace(const SkColorSpace*);
+
+/**
+ * If the compressed data in the SkData is supported (as a texture format, this returns
+ * the pixel-config that should be used, and sets outStartOfDataToUpload to the ptr into
+ * the data where the actual raw data starts (skipping any header bytes).
+ *
+ * If the compressed data is not supported, this returns kUnknown_GrPixelConfig, and
+ * ignores outStartOfDataToUpload.
+ */
+GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data,
+ int expectedW, int expectedH,
+ const void** outStartOfDataToUpload);
+
-#define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X))
#endif
diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
index eb6f04b075..923c82fd26 100644
--- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
@@ -12,7 +12,7 @@
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
// Some of the cpu implementations of blend modes differ too much from the GPU enough that
// we can't use the cpu implementation to implement constantOutputForConstantInput.
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index 79f7c0a4c9..5b59b13b4b 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -8,7 +8,7 @@
#include "GrDrawVerticesOp.h"
#include "GrDefaultGeoProcFactory.h"
#include "GrOpFlushState.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
std::unique_ptr<GrDrawOp> GrDrawVerticesOp::Make(
GrColor color, GrPrimitiveType primitiveType, const SkMatrix& viewMatrix,
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index e1dc7e2dbd..512df0a870 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -11,7 +11,7 @@
#include "GrTextBlobCache.h"
#include "SkDraw.h"
#include "SkDrawFilter.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
GrAtlasTextContext::GrAtlasTextContext()
: fDistanceAdjustTable(new GrDistanceFieldAdjustTable) {
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index ab28ae70b3..afa54d5c43 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -20,7 +20,7 @@
#include "SkDrawFilter.h"
#include "SkDrawProcs.h"
#include "SkGlyphCache.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkPath.h"
#include "SkTextBlobRunIterator.h"
#include "SkTextFormatParams.h"
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index a199d8c92d..4c74dbe76a 100644
--- a/src/gpu/text/GrTextUtils.cpp
+++ b/src/gpu/text/GrTextUtils.cpp
@@ -18,7 +18,7 @@
#include "SkDrawProcs.h"
#include "SkFindAndPlaceGlyph.h"
#include "SkGlyphCache.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkPaint.h"
#include "SkRect.h"
#include "SkTextBlobRunIterator.h"
diff --git a/src/image/SkImageShader.cpp b/src/image/SkImageShader.cpp
index 7e3874891c..4f739f3893 100644
--- a/src/image/SkImageShader.cpp
+++ b/src/image/SkImageShader.cpp
@@ -123,7 +123,6 @@ void SkImageShader::toString(SkString* str) const {
#if SK_SUPPORT_GPU
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "effects/GrSimpleTextureEffect.h"
#include "effects/GrBicubicEffect.h"
#include "effects/GrSimpleTextureEffect.h"
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index ced544723e..bac4b40fab 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -26,7 +26,7 @@
#include "SkCanvas.h"
#include "SkCrossContextImageData.h"
#include "SkBitmapCache.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkImage_Gpu.h"
#include "SkImageCacherator.h"
#include "SkImageInfoPriv.h"
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 01b92a7dac..61be7b715a 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -19,7 +19,6 @@
#include "GrContext.h"
#include "GrTextureAdjuster.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#endif
// fixes https://bug.skia.org/5096
diff --git a/tests/GrGetCoeffBlendKnownComponentsTest.cpp b/tests/GrGetCoeffBlendKnownComponentsTest.cpp
index 31a41943d9..53bd09e251 100644
--- a/tests/GrGetCoeffBlendKnownComponentsTest.cpp
+++ b/tests/GrGetCoeffBlendKnownComponentsTest.cpp
@@ -11,9 +11,18 @@
#include "GrBlend.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "SkRandom.h"
+static inline SkPMColor GrColorToSkPMColor(GrColor c) {
+ GrColorIsPMAssert(c);
+ return SkPackARGB32(GrColorUnpackA(c), GrColorUnpackR(c), GrColorUnpackG(c), GrColorUnpackB(c));
+}
+
+static inline GrColor SkPMColorToGrColor(SkPMColor c) {
+ return GrColorPackRGBA(SkGetPackedR32(c), SkGetPackedG32(c), SkGetPackedB32(c),
+ SkGetPackedA32(c));
+}
+
static GrColor make_baseline_color(GrColor src, GrColor dst, const SkXfermode* xm) {
SkPMColor skSrc = GrColorToSkPMColor(src);
SkPMColor skDst = GrColorToSkPMColor(dst);
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index c033ebc529..f9a0147bd7 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -18,7 +18,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrSurfaceProxy.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#endif
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 7e27583bd9..f70aa26e63 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -17,7 +17,7 @@
#include "GrResourceCache.h"
#include "GrSemaphore.h"
-#include "SkGrPriv.h"
+#include "SkGr.h"
#include "SkImage_Gpu.h"
#include "SkMathPriv.h"
#include "SkString.h"