aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-10-09 13:36:42 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-09 13:36:42 -0700
commitf276ac5c16d39a2b877300d760041f0291bb5ec9 (patch)
tree18f612b69351d42440f19e51347d14bfd182b91d
parentcda8ec2b030c6fcb58d2d11f4983a14c0f355235 (diff)
Move functions from SkGr to SkGrPriv.h
-rw-r--r--example/HelloWorld.cpp1
-rw-r--r--gyp/utils.gyp1
-rw-r--r--include/gpu/SkGr.h87
-rw-r--r--src/core/SkBitmapProcShader.cpp1
-rw-r--r--src/core/SkLightingShader.cpp1
-rw-r--r--src/effects/SkTableColorFilter.cpp7
-rw-r--r--src/gpu/GrContext.cpp2
-rw-r--r--src/gpu/GrSurface.cpp3
-rw-r--r--src/gpu/SkGpuDevice.cpp1
-rw-r--r--src/gpu/SkGr.cpp1
-rw-r--r--src/gpu/SkGrPriv.h44
-rw-r--r--src/gpu/effects/GrTextureStripAtlas.cpp4
-rw-r--r--src/gpu/effects/GrXfermodeFragmentProcessor.cpp2
-rw-r--r--src/image/SkImageShader.cpp1
-rw-r--r--src/image/SkImage_Gpu.cpp2
-rw-r--r--src/utils/SkImageGeneratorUtils.cpp2
-rw-r--r--src/views/SkWindow.cpp1
-rw-r--r--tests/GrGetCoeffBlendKnownComponentsTest.cpp1
-rw-r--r--tools/VisualBench/VisualBench.cpp1
19 files changed, 85 insertions, 78 deletions
diff --git a/example/HelloWorld.cpp b/example/HelloWorld.cpp
index 0d12d0fb04..c7c6bcd1dc 100644
--- a/example/HelloWorld.cpp
+++ b/example/HelloWorld.cpp
@@ -10,6 +10,7 @@
#include "HelloWorld.h"
#include "gl/GrGLInterface.h"
+#include "GrContext.h"
#include "SkApplication.h"
#include "SkCanvas.h"
#include "SkGradientShader.h"
diff --git a/gyp/utils.gyp b/gyp/utils.gyp
index 9881aa10c1..e677b2a089 100644
--- a/gyp/utils.gyp
+++ b/gyp/utils.gyp
@@ -29,6 +29,7 @@
'../include/utils/unix',
'../include/utils/win',
'../src/core',
+ '../src/gpu',
'../src/image',
'../src/opts',
'../src/utils',
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index bf92fe80f1..8ea3af12c7 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -6,54 +6,24 @@
* found in the LICENSE file.
*/
-
-
#ifndef SkGr_DEFINED
#define SkGr_DEFINED
-#include <stddef.h>
-
-// Gr headers
-#include "GrContext.h"
+#include "GrColor.h"
#include "GrTextureAccess.h"
-#include "GrTypes.h"
+#include "SkColor.h"
+#include "SkColorPriv.h"
+#include "SkFilterQuality.h"
+#include "SkImageInfo.h"
-// skia headers
-#include "SkBitmap.h"
-#include "SkPath.h"
-#include "SkPoint.h"
-#include "SkRegion.h"
-#include "SkClipStack.h"
+class GrContext;
+class GrTexture;
+class GrTextureParams;
+class SkBitmap;
////////////////////////////////////////////////////////////////////////////////
// Sk to Gr Type conversions
-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))
-
-///////////////////////////////////////////////////////////////////////////////
-
-#include "SkColorPriv.h"
-
-GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType, SkColorProfileType);
-
-static inline GrPixelConfig SkImageInfo2GrPixelConfig(const SkImageInfo& info) {
- return SkImageInfo2GrPixelConfig(info.colorType(), info.alphaType(), info.profileType());
-}
-
-bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfileType*);
-
static inline GrColor SkColorToPremulGrColor(SkColor c) {
SkPMColor pm = SkPreMultiplyColor(c);
unsigned r = SkGetPackedR32(pm);
@@ -94,39 +64,17 @@ static inline GrColor SkPMColorToGrColor(SkPMColor c) {
SkGetPackedA32(c));
}
-GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&);
-
////////////////////////////////////////////////////////////////////////////////
-/**
- * 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* GrRefCachedBitmapTexture(GrContext*, const SkBitmap&, const GrTextureParams*);
GrTexture* GrRefCachedBitmapTexture(GrContext*, const SkBitmap&, SkImageUsageType);
-GrTexture* GrCreateTextureForPixels(GrContext*, const GrUniqueKey& optionalKey, GrSurfaceDesc,
- SkPixelRef* pixelRefForInvalidationNotificationOrNull,
- const void* pixels, size_t rowBytesOrZero);
-
-////////////////////////////////////////////////////////////////////////////////
-
-SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque);
+// TODO: Move SkImageInfo2GrPixelConfig to SkGrPriv.h (requires cleanup to SkWindow its subclasses).
+GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType, SkColorProfileType);
-// Using the dreaded SkGrPixelRef ...
-SK_API void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque,
- SkBitmap* dst);
+static inline GrPixelConfig SkImageInfo2GrPixelConfig(const SkImageInfo& info) {
+ return SkImageInfo2GrPixelConfig(info.colorType(), info.alphaType(), info.profileType());
+}
GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality paintFilterQuality,
const SkMatrix& viewM,
@@ -134,10 +82,11 @@ GrTextureParams::FilterMode GrSkFilterQualityToGrFilterMode(SkFilterQuality pain
bool* doBicubic);
////////////////////////////////////////////////////////////////////////////////
-// Classes
-class SkGlyphCache;
+SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque);
-////////////////////////////////////////////////////////////////////////////////
+// Using the dreaded SkGrPixelRef ...
+SK_API void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque,
+ SkBitmap* dst);
#endif
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 <stdio.h>
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"
diff --git a/tests/GrGetCoeffBlendKnownComponentsTest.cpp b/tests/GrGetCoeffBlendKnownComponentsTest.cpp
index e733103a77..c55b02b960 100644
--- a/tests/GrGetCoeffBlendKnownComponentsTest.cpp
+++ b/tests/GrGetCoeffBlendKnownComponentsTest.cpp
@@ -11,6 +11,7 @@
#include "GrBlend.h"
#include "SkGr.h"
+#include "SkGrPriv.h"
#include "SkRandom.h"
#include "SkXfermode.h"
diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp
index 8164762a4a..39d249197b 100644
--- a/tools/VisualBench/VisualBench.cpp
+++ b/tools/VisualBench/VisualBench.cpp
@@ -8,6 +8,7 @@
#include "VisualBench.h"
+#include "GrContext.h"
#include "ProcStats.h"
#include "SkApplication.h"
#include "SkCanvas.h"