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>
This commit is contained in:
parent
41eac798f8
commit
3b65598bce
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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",
|
||||
|
@ -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
|
@ -45,7 +45,7 @@
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrContext.h"
|
||||
#include "GrRenderTarget.h"
|
||||
#include "SkGrPriv.h"
|
||||
#include "SkGr.h"
|
||||
|
||||
#endif
|
||||
#include "SkClipOpPriv.h"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "GrSamplerParams.h"
|
||||
#include "GrTextureProxy.h"
|
||||
#include "SkGr.h"
|
||||
#include "SkGrPriv.h"
|
||||
#include "SkImage_Gpu.h"
|
||||
#endif
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "effects/GrTextureDomain.h"
|
||||
#include "effects/GrSimpleTextureEffect.h"
|
||||
#include "SkGr.h"
|
||||
#include "SkGrPriv.h"
|
||||
#endif
|
||||
#include "SkClipOpPriv.h"
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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(); }
|
||||
|
@ -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"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "GrTextureContext.h"
|
||||
|
||||
#include "SkConvertPixels.h"
|
||||
#include "SkGrPriv.h"
|
||||
#include "SkGr.h"
|
||||
#include "SkUnPreMultiplyPriv.h"
|
||||
|
||||
#include "effects/GrConfigConversionEffect.h"
|
||||
|
@ -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"
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "GrOpList.h"
|
||||
#include "GrSurfacePriv.h"
|
||||
|
||||
#include "SkGrPriv.h"
|
||||
#include "SkGr.h"
|
||||
#include "SkMathPriv.h"
|
||||
|
||||
GrSurface::~GrSurface() {
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define SkGpuDevice_DEFINED
|
||||
|
||||
#include "SkGr.h"
|
||||
#include "SkGrPriv.h"
|
||||
#include "SkBitmap.h"
|
||||
#include "SkClipStackDevice.h"
|
||||
#include "SkPicture.h"
|
||||
|
@ -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"
|
||||
|
@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "SkGr.h"
|
||||
#include "SkGrPriv.h"
|
||||
|
||||
#include "GrBitmapTextureMaker.h"
|
||||
#include "GrCaps.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;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Color type conversions
|
||||
|
||||
/** 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 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);
|
||||
|
||||
/** 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 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;
|
||||
}
|
||||
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);
|
||||
|
||||
static inline GrColor4f SkPM4fToGrColor4f(const SkPM4f& c) {
|
||||
return GrColor4f{c.r(), c.g(), c.b(), c.a()};
|
||||
}
|
||||
#define SkXfermodeCoeffToGrBlendCoeff(X) ((GrBlendCoeff)(X))
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Texture management
|
||||
|
||||
GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&);
|
||||
|
||||
bool GrPixelConfigToColorType(GrPixelConfig, SkColorType*);
|
||||
|
||||
/** 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.
|
||||
/** 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
|
@ -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.
|
||||
|
@ -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,
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "GrTextBlobCache.h"
|
||||
#include "SkDraw.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkGrPriv.h"
|
||||
#include "SkGr.h"
|
||||
|
||||
GrAtlasTextContext::GrAtlasTextContext()
|
||||
: fDistanceAdjustTable(new GrDistanceFieldAdjustTable) {
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "GrContext.h"
|
||||
#include "GrTextureAdjuster.h"
|
||||
#include "SkGr.h"
|
||||
#include "SkGrPriv.h"
|
||||
#endif
|
||||
|
||||
// fixes https://bug.skia.org/5096
|
||||
|
@ -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);
|
||||
|
@ -18,7 +18,7 @@
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrContext.h"
|
||||
#include "GrSurfaceProxy.h"
|
||||
#include "SkGrPriv.h"
|
||||
#include "SkGr.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user