From f276ac5c16d39a2b877300d760041f0291bb5ec9 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Fri, 9 Oct 2015 13:36:42 -0700 Subject: Move functions from SkGr to SkGrPriv.h Review URL: https://codereview.chromium.org/1397123002 --- src/core/SkBitmapProcShader.cpp | 1 + src/core/SkLightingShader.cpp | 1 + src/effects/SkTableColorFilter.cpp | 7 ++-- src/gpu/GrContext.cpp | 2 +- src/gpu/GrSurface.cpp | 3 +- src/gpu/SkGpuDevice.cpp | 1 + src/gpu/SkGr.cpp | 1 + src/gpu/SkGrPriv.h | 44 +++++++++++++++++++++++++ src/gpu/effects/GrTextureStripAtlas.cpp | 4 ++- src/gpu/effects/GrXfermodeFragmentProcessor.cpp | 2 +- src/image/SkImageShader.cpp | 1 + src/image/SkImage_Gpu.cpp | 2 +- src/utils/SkImageGeneratorUtils.cpp | 2 +- src/views/SkWindow.cpp | 1 + 14 files changed, 63 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp index b3bbb72314..3dd528dbda 100644 --- a/src/core/SkBitmapProcShader.cpp +++ b/src/core/SkBitmapProcShader.cpp @@ -15,6 +15,7 @@ #include "SkWriteBuffer.h" #if SK_SUPPORT_GPU +#include "SkGrPriv.h" #include "effects/GrBicubicEffect.h" #include "effects/GrSimpleTextureEffect.h" #endif diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp index 3a1ea873b8..6121f21534 100644 --- a/src/core/SkLightingShader.cpp +++ b/src/core/SkLightingShader.cpp @@ -133,6 +133,7 @@ private: #include "gl/GrGLProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" #include "SkGr.h" +#include "SkGrPriv.h" class LightingFP : public GrFragmentProcessor { public: diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index ceb666325b..f0ed7b40c9 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -5,13 +5,14 @@ * found in the LICENSE file. */ -#include "SkBitmap.h" #include "SkTableColorFilter.h" + +#include "SkBitmap.h" #include "SkColorPriv.h" #include "SkReadBuffer.h" -#include "SkWriteBuffer.h" -#include "SkUnPreMultiply.h" #include "SkString.h" +#include "SkUnPreMultiply.h" +#include "SkWriteBuffer.h" class SkTable_ColorFilter : public SkColorFilter { public: diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index c379bd611a..d402604198 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -37,7 +37,7 @@ #include "GrVertices.h" #include "SkDashPathPriv.h" #include "SkConfig8888.h" -#include "SkGr.h" +#include "SkGrPriv.h" #include "SkRRect.h" #include "SkStrokeRec.h" #include "SkSurfacePriv.h" diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp index a7be0f47d9..382550e41f 100644 --- a/src/gpu/GrSurface.cpp +++ b/src/gpu/GrSurface.cpp @@ -6,10 +6,11 @@ */ #include "GrSurface.h" +#include "GrContext.h" #include "GrSurfacePriv.h" #include "SkBitmap.h" -#include "SkGr.h" +#include "SkGrPriv.h" #include "SkImageEncoder.h" #include diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index c4239bd40f..9d129d579f 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -23,6 +23,7 @@ #include "SkErrorInternals.h" #include "SkGlyphCache.h" #include "SkGrTexturePixelRef.h" +#include "SkGr.h" #include "SkGrPriv.h" #include "SkImage_Base.h" #include "SkImageFilter.h" diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index cff61727d8..8f9555ad52 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -10,6 +10,7 @@ #include "SkGr.h" #include "GrCaps.h" +#include "GrContext.h" #include "GrDrawContext.h" #include "GrXferProcessor.h" #include "GrYUVProvider.h" diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGrPriv.h index 36601fc3e3..88bee5cc33 100644 --- a/src/gpu/SkGrPriv.h +++ b/src/gpu/SkGrPriv.h @@ -9,6 +9,7 @@ #define SkGrPriv_DEFINED #include "GrTypes.h" +#include "GrBlend.h" #include "GrTextureAccess.h" #include "SkImageInfo.h" #include "SkXfermode.h" @@ -17,6 +18,7 @@ class GrCaps; class GrContext; class GrFragmentProcessor; class GrPaint; +class GrTexture; class GrUniqueKey; class SkPaint; class SkMatrix; @@ -94,6 +96,48 @@ inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, const SkPaint false, grPaint); } +////////////////////////////////////////////////////////////////////////////// + bool GrTextureUsageSupported(const GrCaps&, int width, int height, SkImageUsageType); +GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&); + +bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfileType*); + +/** +* 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); + +bool GrIsImageInCache(const GrContext* ctx, uint32_t imageID, const SkIRect& subset, + GrTexture* nativeTexture, const GrTextureParams*); + +GrTexture* GrCreateTextureForPixels(GrContext*, const GrUniqueKey& optionalKey, GrSurfaceDesc, + SkPixelRef* pixelRefForInvalidationNotificationOrNull, + const void* pixels, size_t rowBytesOrZero); + + +////////////////////////////////////////////////////////////////////////////// + +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); + +#define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X)) + #endif diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp index ca688d821b..f2133d12f2 100644 --- a/src/gpu/effects/GrTextureStripAtlas.cpp +++ b/src/gpu/effects/GrTextureStripAtlas.cpp @@ -7,9 +7,11 @@ */ #include "GrTextureStripAtlas.h" +#include "GrContext.h" +#include "GrTexture.h" +#include "SkGr.h" #include "SkPixelRef.h" #include "SkTSearch.h" -#include "GrTexture.h" #ifdef SK_DEBUG #define VALIDATE this->validate() diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp index ec2f1f3130..895838f673 100644 --- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp +++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp @@ -11,7 +11,7 @@ #include "effects/GrConstColorProcessor.h" #include "gl/GrGLSLBlend.h" #include "gl/builders/GrGLProgramBuilder.h" -#include "SkGr.h" +#include "SkGrPriv.h" class ComposeTwoFragmentProcessor : public GrFragmentProcessor { public: diff --git a/src/image/SkImageShader.cpp b/src/image/SkImageShader.cpp index 6c82fa91f8..cf613e8735 100644 --- a/src/image/SkImageShader.cpp +++ b/src/image/SkImageShader.cpp @@ -78,6 +78,7 @@ void SkImageShader::toString(SkString* str) const { #include "GrTextureAccess.h" #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 00b5c350a3..72b98cd589 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -14,7 +14,7 @@ #include "effects/GrYUVtoRGBEffect.h" #include "SkCanvas.h" #include "SkGpuDevice.h" -#include "SkGrPriv.h" +#include "SkGr.h" #include "SkPixelRef.h" SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrTexture* tex, diff --git a/src/utils/SkImageGeneratorUtils.cpp b/src/utils/SkImageGeneratorUtils.cpp index c9b2252d16..42a0fe518d 100644 --- a/src/utils/SkImageGeneratorUtils.cpp +++ b/src/utils/SkImageGeneratorUtils.cpp @@ -47,7 +47,7 @@ SkImageGenerator* SkImageGeneratorUtils::NewFromBitmap(const SkBitmap& bm) { #include "GrContext.h" #include "GrTexture.h" -#include "SkGr.h" +#include "SkGrPriv.h" class GeneratorFromTexture : public SkImageGenerator { public: diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp index 9234ac1395..7f9b683315 100644 --- a/src/views/SkWindow.cpp +++ b/src/views/SkWindow.cpp @@ -6,6 +6,7 @@ */ #include "SkWindow.h" +#include "GrContext.h" #include "SkCanvas.h" #include "SkOSMenu.h" #include "SkSurface.h" -- cgit v1.2.3