Rename GrColorSpaceInfo -> GrColorInfo
Add version SkImageInfo::Make() that takes SkISize instead of separate
width and height.
Change-Id: I42aa79d23b19e22f5405631728c245b04bce0559
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245172
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/bench/ReadPixBench.cpp b/bench/ReadPixBench.cpp
index 3e5d0dc..95aa94b 100644
--- a/bench/ReadPixBench.cpp
+++ b/bench/ReadPixBench.cpp
@@ -35,7 +35,7 @@
SkISize size = canvas->getBaseLayerSize();
- auto info = SkImageInfo::Make(size.width(), size.height(), fCT, fAT, fCS);
+ auto info = SkImageInfo::Make(size, fCT, fAT, fCS);
SkBitmap bitmap;
bitmap.allocPixels(info);
diff --git a/bench/WritePixelsBench.cpp b/bench/WritePixelsBench.cpp
index 6d532b0..3f3baaf 100644
--- a/bench/WritePixelsBench.cpp
+++ b/bench/WritePixelsBench.cpp
@@ -35,8 +35,7 @@
void onDraw(int loops, SkCanvas* canvas) override {
SkISize size = canvas->getBaseLayerSize();
- SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), fColorType, fAlphaType,
- fCS);
+ SkImageInfo info = SkImageInfo::Make(size, fColorType, fAlphaType, fCS);
SkBitmap bmp;
bmp.allocPixels(info);
bmp.eraseColor(SK_ColorBLACK);
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 48ac428..b0bc346 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1367,8 +1367,7 @@
GrContextFactory factory(grOptions);
const SkISize size = src.size();
- SkImageInfo info =
- SkImageInfo::Make(size.width(), size.height(), fColorType, fAlphaType, fColorSpace);
+ SkImageInfo info = SkImageInfo::Make(size, fColorType, fAlphaType, fColorSpace);
sk_sp<SkSurface> surface;
GrContext* context = factory.getContextInfo(fContextType, fContextOverrides).grContext();
if (initContext) {
@@ -1427,8 +1426,7 @@
info.colorType() == kRGB_888x_SkColorType) {
// We don't currently support readbacks into these formats on the GPU backend. Convert to
// 32 bit.
- info = SkImageInfo::Make(size.width(), size.height(), kRGBA_8888_SkColorType,
- kPremul_SkAlphaType, fColorSpace);
+ info = SkImageInfo::Make(size, kRGBA_8888_SkColorType, kPremul_SkAlphaType, fColorSpace);
}
dst->allocPixels(info);
canvas->readPixels(*dst, 0, 0);
@@ -1729,8 +1727,7 @@
SkAlphaType alphaType = kPremul_SkAlphaType;
(void)SkColorTypeValidateAlphaType(fColorType, alphaType, &alphaType);
- dst->allocPixelsFlags(SkImageInfo::Make(size.width(), size.height(),
- fColorType, alphaType, fColorSpace),
+ dst->allocPixelsFlags(SkImageInfo::Make(size, fColorType, alphaType, fColorSpace),
SkBitmap::kZeroPixels_AllocFlag);
SkCanvas canvas(*dst);
diff --git a/experimental/ffmpeg/SkVideoEncoder.cpp b/experimental/ffmpeg/SkVideoEncoder.cpp
index 84c465b..96daeb6 100644
--- a/experimental/ffmpeg/SkVideoEncoder.cpp
+++ b/experimental/ffmpeg/SkVideoEncoder.cpp
@@ -234,7 +234,7 @@
// need opaque and bgra to efficiently use libyuv / convert-to-yuv-420
SkAlphaType alphaType = kOpaque_SkAlphaType;
sk_sp<SkColorSpace> cs = nullptr; // should we use this?
- fInfo = SkImageInfo::Make(dim.width(), dim.height(), kRGBA_8888_SkColorType, alphaType, cs);
+ fInfo = SkImageInfo::Make(dim, kRGBA_8888_SkColorType, alphaType, cs);
if (!this->init(fps)) {
return false;
}
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp
index 400a2f1..62121e8 100644
--- a/fuzz/FuzzCanvas.cpp
+++ b/fuzz/FuzzCanvas.cpp
@@ -1666,7 +1666,7 @@
auto surface = SkSurface::MakeRenderTarget(
context,
SkBudgeted::kNo,
- SkImageInfo::Make(kCanvasSize.width(), kCanvasSize.height(), kRGBA_8888_SkColorType, kPremul_SkAlphaType));
+ SkImageInfo::Make(kCanvasSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType));
SkASSERT(surface && surface->getCanvas());
fuzz_canvas(fuzz, surface->getCanvas());
}
diff --git a/gm/clockwise.cpp b/gm/clockwise.cpp
index 7865840..7d1bd41 100644
--- a/gm/clockwise.cpp
+++ b/gm/clockwise.cpp
@@ -189,7 +189,7 @@
// Draw the test to an off-screen, top-down render target.
if (auto topLeftRTC = ctx->priv().makeDeferredRenderTargetContext(
- SkBackingFit::kExact, 100, 200, rtc->colorSpaceInfo().colorType(), nullptr, 1,
+ SkBackingFit::kExact, 100, 200, rtc->colorInfo().colorType(), nullptr, 1,
GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin, nullptr, SkBudgeted::kYes)) {
topLeftRTC->clear(nullptr, SK_PMColor4fTRANSPARENT,
GrRenderTargetContext::CanClearFullscreen::kYes);
@@ -205,7 +205,7 @@
// Draw the test to an off-screen, bottom-up render target.
if (auto topLeftRTC = ctx->priv().makeDeferredRenderTargetContext(
- SkBackingFit::kExact, 100, 200, rtc->colorSpaceInfo().colorType(), nullptr, 1,
+ SkBackingFit::kExact, 100, 200, rtc->colorInfo().colorType(), nullptr, 1,
GrMipMapped::kNo, kBottomLeft_GrSurfaceOrigin, nullptr, SkBudgeted::kYes)) {
topLeftRTC->clear(nullptr, SK_PMColor4fTRANSPARENT,
GrRenderTargetContext::CanClearFullscreen::kYes);
diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp
index d678af8..7bc7bdb 100644
--- a/gm/constcolorprocessor.cpp
+++ b/gm/constcolorprocessor.cpp
@@ -112,7 +112,7 @@
} else {
skPaint.setColor(kPaintColors[paintType]);
}
- SkAssertResult(SkPaintToGrPaint(context, renderTargetContext->colorSpaceInfo(),
+ SkAssertResult(SkPaintToGrPaint(context, renderTargetContext->colorInfo(),
skPaint, viewMatrix, &grPaint));
GrConstColorProcessor::InputMode mode = (GrConstColorProcessor::InputMode) m;
diff --git a/gm/drawquadset.cpp b/gm/drawquadset.cpp
index 1a42c6a..a2e8e58 100644
--- a/gm/drawquadset.cpp
+++ b/gm/drawquadset.cpp
@@ -82,7 +82,7 @@
// Use non-public API to leverage general GrPaint capabilities
SkMatrix view = canvas->getTotalMatrix();
GrPaint grPaint;
- SkPaintToGrPaint(context, rtc->colorSpaceInfo(), paint, view, &grPaint);
+ SkPaintToGrPaint(context, rtc->colorInfo(), paint, view, &grPaint);
rtc->fillRectWithEdgeAA(GrNoClip(), std::move(grPaint), GrAA::kYes,
static_cast<GrQuadAAFlags>(aa), view, tile);
} else {
diff --git a/gm/samplelocations.cpp b/gm/samplelocations.cpp
index f8eec48..5be8164 100644
--- a/gm/samplelocations.cpp
+++ b/gm/samplelocations.cpp
@@ -266,7 +266,7 @@
}
auto offscreenRTC = ctx->priv().makeDeferredRenderTargetContext(
- SkBackingFit::kExact, 200, 200, rtc->colorSpaceInfo().colorType(), nullptr,
+ SkBackingFit::kExact, 200, 200, rtc->colorInfo().colorType(), nullptr,
rtc->numSamples(), GrMipMapped::kNo, fOrigin);
if (!offscreenRTC) {
*errorMsg = "Failed to create offscreen render target.";
diff --git a/gm/wacky_yuv_formats.cpp b/gm/wacky_yuv_formats.cpp
index 23c868d..0444279 100644
--- a/gm/wacky_yuv_formats.cpp
+++ b/gm/wacky_yuv_formats.cpp
@@ -503,20 +503,20 @@
SkASSERT(!(bm.width() % 2));
SkASSERT(!(bm.height() % 2));
- planes->fYFull.allocPixels(SkImageInfo::Make(bm.width(), bm.height(), kGray_8_SkColorType,
- kUnpremul_SkAlphaType));
- planes->fUFull.allocPixels(SkImageInfo::Make(bm.width(), bm.height(), kGray_8_SkColorType,
- kUnpremul_SkAlphaType));
- planes->fVFull.allocPixels(SkImageInfo::Make(bm.width(), bm.height(), kGray_8_SkColorType,
- kUnpremul_SkAlphaType));
+ planes->fYFull.allocPixels(
+ SkImageInfo::Make(bm.dimensions(), kGray_8_SkColorType, kUnpremul_SkAlphaType));
+ planes->fUFull.allocPixels(
+ SkImageInfo::Make(bm.dimensions(), kGray_8_SkColorType, kUnpremul_SkAlphaType));
+ planes->fVFull.allocPixels(
+ SkImageInfo::Make(bm.dimensions(), kGray_8_SkColorType, kUnpremul_SkAlphaType));
planes->fAFull.allocPixels(SkImageInfo::MakeA8(bm.width(), bm.height()));
planes->fUQuarter.allocPixels(SkImageInfo::Make(bm.width()/2, bm.height()/2,
kGray_8_SkColorType, kUnpremul_SkAlphaType));
planes->fVQuarter.allocPixels(SkImageInfo::Make(bm.width()/2, bm.height()/2,
kGray_8_SkColorType, kUnpremul_SkAlphaType));
- planes->fFull.allocPixels(SkImageInfo::Make(bm.width(), bm.height(),
- kRGBA_F32_SkColorType, kUnpremul_SkAlphaType));
+ planes->fFull.allocPixels(
+ SkImageInfo::Make(bm.dimensions(), kRGBA_F32_SkColorType, kUnpremul_SkAlphaType));
planes->fQuarter.allocPixels(SkImageInfo::Make(bm.width()/2, bm.height()/2,
kRGBA_F32_SkColorType, kUnpremul_SkAlphaType));
@@ -625,8 +625,7 @@
SkBitmap result;
- result.allocPixels(SkImageInfo::Make(src.width(), src.height(), dstCT,
- kUnpremul_SkAlphaType));
+ result.allocPixels(SkImageInfo::Make(src.dimensions(), dstCT, kUnpremul_SkAlphaType));
for (int y = 0; y < src.height(); ++y) {
for (int x = 0; x < src.width(); ++x) {
diff --git a/gn/gpu.gni b/gn/gpu.gni
index fcade41..a08c5a7 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -64,7 +64,8 @@
"$_src/gpu/GrClipStackClip.h",
"$_src/gpu/GrClipStackClip.cpp",
"$_src/gpu/GrColor.h",
- "$_src/gpu/GrColorSpaceInfo.cpp",
+ "$_src/gpu/GrColorInfo.cpp",
+ "$_src/gpu/GrColorInfo.h",
"$_src/gpu/GrColorSpaceXform.cpp",
"$_src/gpu/GrColorSpaceXform.h",
"$_src/gpu/GrContext.cpp",
diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h
index 2cb9e65..7f1e979 100644
--- a/include/core/SkColorFilter.h
+++ b/include/core/SkColorFilter.h
@@ -13,7 +13,7 @@
#include "include/core/SkFlattenable.h"
#include "include/core/SkRefCnt.h"
-class GrColorSpaceInfo;
+class GrColorInfo;
class GrFragmentProcessor;
class GrRecordingContext;
class SkBitmap;
@@ -96,7 +96,7 @@
* A null return indicates that the color filter isn't implemented for the GPU backend.
*/
virtual std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo& dstColorSpaceInfo) const;
+ GrRecordingContext*, const GrColorInfo& dstColorInfo) const;
#endif
bool affectsTransparentBlack() const {
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index c70cd97..8054aed 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -235,7 +235,11 @@
*/
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
sk_sp<SkColorSpace> cs = nullptr) {
- return SkImageInfo(width, height, ct, at, std::move(cs));
+ return SkImageInfo({width, height}, ct, at, std::move(cs));
+ }
+ static SkImageInfo Make(SkISize dimensions, SkColorType ct, SkAlphaType at,
+ sk_sp<SkColorSpace> cs = nullptr) {
+ return SkImageInfo(dimensions, ct, at, std::move(cs));
}
/** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType,
@@ -258,7 +262,7 @@
*/
static SkImageInfo MakeN32(int width, int height, SkAlphaType at,
sk_sp<SkColorSpace> cs = nullptr) {
- return Make(width, height, kN32_SkColorType, at, std::move(cs));
+ return Make({width, height}, kN32_SkColorType, at, std::move(cs));
}
/** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType,
@@ -291,7 +295,7 @@
@return created SkImageInfo
*/
static SkImageInfo MakeN32Premul(int width, int height, sk_sp<SkColorSpace> cs = nullptr) {
- return Make(width, height, kN32_SkColorType, kPremul_SkAlphaType, std::move(cs));
+ return Make({width, height}, kN32_SkColorType, kPremul_SkAlphaType, std::move(cs));
}
/** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType,
@@ -318,7 +322,7 @@
@return created SkImageInfo
*/
static SkImageInfo MakeA8(int width, int height) {
- return Make(width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType, nullptr);
+ return Make({width, height}, kAlpha_8_SkColorType, kPremul_SkAlphaType, nullptr);
}
/** Creates SkImageInfo from integral dimensions width and height, kUnknown_SkColorType,
@@ -332,7 +336,7 @@
@return created SkImageInfo
*/
static SkImageInfo MakeUnknown(int width, int height) {
- return Make(width, height, kUnknown_SkColorType, kUnknown_SkAlphaType, nullptr);
+ return Make({width, height}, kUnknown_SkColorType, kUnknown_SkAlphaType, nullptr);
}
/** Creates SkImageInfo from integral dimensions width and height set to zero,
@@ -619,9 +623,9 @@
SkColorType fColorType;
SkAlphaType fAlphaType;
- SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, sk_sp<SkColorSpace> cs)
+ SkImageInfo(SkISize dimensions, SkColorType ct, SkAlphaType at, sk_sp<SkColorSpace> cs)
: fColorSpace(std::move(cs))
- , fDimensions{width, height}
+ , fDimensions(dimensions)
, fColorType(ct)
, fAlphaType(at)
{}
diff --git a/include/effects/SkLumaColorFilter.h b/include/effects/SkLumaColorFilter.h
index 54d2672..d35540c 100644
--- a/include/effects/SkLumaColorFilter.h
+++ b/include/effects/SkLumaColorFilter.h
@@ -38,8 +38,8 @@
static sk_sp<SkColorFilter> Make();
#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const override;
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
+ const GrColorInfo&) const override;
#endif
protected:
diff --git a/include/effects/SkOverdrawColorFilter.h b/include/effects/SkOverdrawColorFilter.h
index 74f25d6..a34c376 100644
--- a/include/effects/SkOverdrawColorFilter.h
+++ b/include/effects/SkOverdrawColorFilter.h
@@ -28,8 +28,8 @@
}
#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const override;
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
+ const GrColorInfo&) const override;
#endif
static void RegisterFlattenables();
diff --git a/src/android/SkBitmapRegionCodec.cpp b/src/android/SkBitmapRegionCodec.cpp
index f74f9db..5cb9ccb 100644
--- a/src/android/SkBitmapRegionCodec.cpp
+++ b/src/android/SkBitmapRegionCodec.cpp
@@ -50,8 +50,8 @@
// Create the image info for the decode
SkAlphaType dstAlphaType = fCodec->computeOutputAlphaType(requireUnpremul);
- SkImageInfo decodeInfo = SkImageInfo::Make(scaledSize.width(), scaledSize.height(),
- dstColorType, dstAlphaType, dstColorSpace);
+ SkImageInfo decodeInfo =
+ SkImageInfo::Make(scaledSize, dstColorType, dstAlphaType, dstColorSpace);
// Initialize the destination bitmap
int scaledOutX = 0;
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp
index 1adae89..80ef553 100644
--- a/src/atlastext/SkAtlasTextTarget.cpp
+++ b/src/atlastext/SkAtlasTextTarget.cpp
@@ -73,8 +73,7 @@
//////////////////////////////////////////////////////////////////////////////
-static const GrColorSpaceInfo kColorSpaceInfo(GrColorType::kRGBA_8888, kPremul_SkAlphaType,
- nullptr);
+static const GrColorInfo kColorInfo(GrColorType::kRGBA_8888, kPremul_SkAlphaType, nullptr);
static const SkSurfaceProps kProps(
SkSurfaceProps::kUseDistanceFieldFonts_Flag, kUnknown_SkPixelGeometry);
@@ -82,12 +81,11 @@
class SkInternalAtlasTextTarget : public GrTextTarget, public SkAtlasTextTarget {
public:
- SkInternalAtlasTextTarget(sk_sp<SkAtlasTextContext> context,
- int width, int height,
+ SkInternalAtlasTextTarget(sk_sp<SkAtlasTextContext> context, int width, int height,
void* handle)
- : GrTextTarget(width, height, kColorSpaceInfo)
+ : GrTextTarget(width, height, kColorInfo)
, SkAtlasTextTarget(std::move(context), width, height, handle)
- , fGlyphPainter(kProps, kColorSpaceInfo) {
+ , fGlyphPainter(kProps, kColorInfo) {
fOpMemoryPool = fContext->internal().grContext()->priv().refOpMemoryPool();
}
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 073add0..9bf45a0 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -284,8 +284,8 @@
SkBitmap coverage;
if (trackCoverage) {
- SkImageInfo ci = SkImageInfo::Make(info.width(), info.height(), kAlpha_8_SkColorType,
- kPremul_SkAlphaType);
+ SkImageInfo ci =
+ SkImageInfo::Make(info.dimensions(), kAlpha_8_SkColorType, kPremul_SkAlphaType);
if (!coverage.tryAllocPixelsFlags(ci, SkBitmap::kZeroPixels_AllocFlag)) {
return nullptr;
}
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index e35dabf..d4bdb41 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -33,8 +33,8 @@
}
#if SK_SUPPORT_GPU
-std::unique_ptr<GrFragmentProcessor> SkColorFilter::asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const {
+std::unique_ptr<GrFragmentProcessor> SkColorFilter::asFragmentProcessor(GrRecordingContext*,
+ const GrColorInfo&) const {
return nullptr;
}
#endif
@@ -110,9 +110,9 @@
#if SK_SUPPORT_GPU
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext* context, const GrColorSpaceInfo& dstColorSpaceInfo) const override {
- auto innerFP = fInner->asFragmentProcessor(context, dstColorSpaceInfo);
- auto outerFP = fOuter->asFragmentProcessor(context, dstColorSpaceInfo);
+ GrRecordingContext* context, const GrColorInfo& dstColorInfo) const override {
+ auto innerFP = fInner->asFragmentProcessor(context, dstColorInfo);
+ auto outerFP = fOuter->asFragmentProcessor(context, dstColorInfo);
if (!innerFP || !outerFP) {
return nullptr;
}
@@ -196,8 +196,8 @@
}()) {}
#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const override {
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
+ const GrColorInfo&) const override {
// wish our caller would let us know if our input was opaque...
GrSRGBEffect::Alpha alpha = GrSRGBEffect::Alpha::kPremul;
switch (fDir) {
@@ -310,10 +310,10 @@
#if SK_SUPPORT_GPU
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext* context, const GrColorSpaceInfo& dstColorSpaceInfo) const override {
+ GrRecordingContext* context, const GrColorInfo& dstColorInfo) const override {
return GrMixerEffect::Make(
- fCF0->asFragmentProcessor(context, dstColorSpaceInfo),
- fCF1 ? fCF1->asFragmentProcessor(context, dstColorSpaceInfo) : nullptr,
+ fCF0->asFragmentProcessor(context, dstColorInfo),
+ fCF1 ? fCF1->asFragmentProcessor(context, dstColorInfo) : nullptr,
fWeight);
}
#endif
@@ -388,8 +388,8 @@
, fCpuFunction(cpuFunction) {}
#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext* context, const GrColorSpaceInfo&) const override {
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext* context,
+ const GrColorInfo&) const override {
return GrSkSLFP::Make(context, fIndex, "Runtime Color Filter", fSkSL,
fInputs ? fInputs->data() : nullptr,
fInputs ? fInputs->size() : 0);
diff --git a/src/core/SkColorFilter_Matrix.cpp b/src/core/SkColorFilter_Matrix.cpp
index e1820ad..cdc15dd 100644
--- a/src/core/SkColorFilter_Matrix.cpp
+++ b/src/core/SkColorFilter_Matrix.cpp
@@ -82,7 +82,7 @@
#if SK_SUPPORT_GPU
#include "src/gpu/effects/generated/GrColorMatrixFragmentProcessor.h"
std::unique_ptr<GrFragmentProcessor> SkColorFilter_Matrix::asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const {
+ GrRecordingContext*, const GrColorInfo&) const {
if (fDomain == Domain::kHSLA) {
// TODO
return nullptr;
diff --git a/src/core/SkColorFilter_Matrix.h b/src/core/SkColorFilter_Matrix.h
index 0cc5cb2..7f01988 100644
--- a/src/core/SkColorFilter_Matrix.h
+++ b/src/core/SkColorFilter_Matrix.h
@@ -20,8 +20,8 @@
uint32_t getFlags() const override;
#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const override;
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
+ const GrColorInfo&) const override;
#endif
static void RegisterFlattenables();
diff --git a/src/core/SkDevice.h b/src/core/SkDevice.h
index 2e49fa6..ce2629f 100644
--- a/src/core/SkDevice.h
+++ b/src/core/SkDevice.h
@@ -381,9 +381,9 @@
public:
SkNoPixelsDevice(const SkIRect& bounds, const SkSurfaceProps& props,
sk_sp<SkColorSpace> colorSpace = nullptr)
- : SkBaseDevice(SkImageInfo::Make(bounds.width(), bounds.height(), kUnknown_SkColorType,
- kUnknown_SkAlphaType, std::move(colorSpace)), props)
- {
+ : SkBaseDevice(SkImageInfo::Make(bounds.size(), kUnknown_SkColorType,
+ kUnknown_SkAlphaType, std::move(colorSpace)),
+ props) {
// this fails if we enable this assert: DiscardableImageMapTest.GetDiscardableImagesInRectMaxImage
//SkASSERT(bounds.width() >= 0 && bounds.height() >= 0);
diff --git a/src/core/SkGlyphRunPainter.cpp b/src/core/SkGlyphRunPainter.cpp
index b7216f1..d1366c2 100644
--- a/src/core/SkGlyphRunPainter.cpp
+++ b/src/core/SkGlyphRunPainter.cpp
@@ -10,7 +10,7 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
@@ -85,15 +85,14 @@
: SkGlyphRunListPainter(props, colorType, compute_scaler_context_flags(cs), strikeCache) {}
#if SK_SUPPORT_GPU
-SkGlyphRunListPainter::SkGlyphRunListPainter(const SkSurfaceProps& props,
- const GrColorSpaceInfo& csi)
+SkGlyphRunListPainter::SkGlyphRunListPainter(const SkSurfaceProps& props, const GrColorInfo& csi)
: SkGlyphRunListPainter(props,
kUnknown_SkColorType,
compute_scaler_context_flags(csi.colorSpace()),
SkStrikeCache::GlobalStrikeCache()) {}
SkGlyphRunListPainter::SkGlyphRunListPainter(const GrRenderTargetContext& rtc)
- : SkGlyphRunListPainter{rtc.surfaceProps(), rtc.colorSpaceInfo()} {}
+ : SkGlyphRunListPainter{rtc.surfaceProps(), rtc.colorInfo()} {}
#endif
@@ -581,15 +580,14 @@
#if SK_SUPPORT_GPU
// -- GrTextContext --------------------------------------------------------------------------------
-SkPMColor4f generate_filtered_color(const SkPaint& paint, const GrColorSpaceInfo& colorSpaceInfo) {
+SkPMColor4f generate_filtered_color(const SkPaint& paint, const GrColorInfo& colorInfo) {
SkColor4f filteredColor = paint.getColor4f();
- if (auto* xform = colorSpaceInfo.colorSpaceXformFromSRGB()) {
+ if (auto* xform = colorInfo.colorSpaceXformFromSRGB()) {
filteredColor = xform->apply(filteredColor);
}
if (paint.getColorFilter() != nullptr) {
- filteredColor = paint.getColorFilter()->filterColor4f(filteredColor,
- colorSpaceInfo.colorSpace(),
- colorSpaceInfo.colorSpace());
+ filteredColor = paint.getColorFilter()->filterColor4f(filteredColor, colorInfo.colorSpace(),
+ colorInfo.colorSpace());
}
return filteredColor.premul();
}
@@ -603,8 +601,8 @@
// Get the first paint to use as the key paint.
const SkPaint& listPaint = glyphRunList.paint();
- SkPMColor4f filteredColor = generate_filtered_color(listPaint, target->colorSpaceInfo());
- GrColor color = generate_filtered_color(listPaint, target->colorSpaceInfo()).toBytes_RGBA();
+ SkPMColor4f filteredColor = generate_filtered_color(listPaint, target->colorInfo());
+ GrColor color = generate_filtered_color(listPaint, target->colorInfo()).toBytes_RGBA();
// If we have been abandoned, then don't draw
if (context->priv().abandoned()) {
@@ -617,7 +615,7 @@
const SkMaskFilter* mf = listPaint.getMaskFilter();
bool canCache = glyphRunList.canCache() && !(listPaint.getPathEffect() ||
(mf && !as_MFB(mf)->asABlur(&blurRec)));
- SkScalerContextFlags scalerContextFlags = ComputeScalerContextFlags(target->colorSpaceInfo());
+ SkScalerContextFlags scalerContextFlags = ComputeScalerContextFlags(target->colorInfo());
auto grStrikeCache = context->priv().getGrStrikeCache();
GrTextBlobCache* textBlobCache = context->priv().getTextBlobCache();
@@ -926,7 +924,7 @@
size_t textLen = (int)strlen(text);
- SkPMColor4f filteredColor = generate_filtered_color(skPaint, rtc->colorSpaceInfo());
+ SkPMColor4f filteredColor = generate_filtered_color(skPaint, rtc->colorInfo());
GrColor color = filteredColor.toBytes_RGBA();
auto origin = SkPoint::Make(x, y);
@@ -938,8 +936,7 @@
if (!glyphRunList.empty()) {
blob = direct->priv().getTextBlobCache()->makeBlob(glyphRunList, color, strikeCache);
// Use the text and textLen below, because we don't want to mess with the paint.
- SkScalerContextFlags scalerContextFlags =
- ComputeScalerContextFlags(rtc->colorSpaceInfo());
+ SkScalerContextFlags scalerContextFlags = ComputeScalerContextFlags(rtc->colorInfo());
blob->generateFromGlyphRunList(
*context->priv().caps()->shaderCaps(), textContext->fOptions,
skPaint, scalerContextFlags, viewMatrix, surfaceProps,
diff --git a/src/core/SkGlyphRunPainter.h b/src/core/SkGlyphRunPainter.h
index 94d42ad..48812c0 100644
--- a/src/core/SkGlyphRunPainter.h
+++ b/src/core/SkGlyphRunPainter.h
@@ -16,7 +16,7 @@
#if SK_SUPPORT_GPU
#include "src/gpu/text/GrTextContext.h"
-class GrColorSpaceInfo;
+class GrColorInfo;
class GrRenderTargetContext;
#endif
@@ -43,7 +43,7 @@
#if SK_SUPPORT_GPU
// The following two ctors are used exclusively by the GPU, and will always use the global
// strike cache.
- SkGlyphRunListPainter(const SkSurfaceProps&, const GrColorSpaceInfo&);
+ SkGlyphRunListPainter(const SkSurfaceProps&, const GrColorInfo&);
explicit SkGlyphRunListPainter(const GrRenderTargetContext& renderTargetContext);
#endif // SK_SUPPORT_GPU
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index 4312332..a06c048 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -387,7 +387,7 @@
return nullptr;
}
- GrColorType srcColorType = srcRenderTargetContext->colorSpaceInfo().colorType();
+ GrColorType srcColorType = srcRenderTargetContext->colorInfo().colorType();
srcRenderTargetContext = nullptr; // no longer needed
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 0dbceb2..4dbb25c 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -462,9 +462,8 @@
return SkSpecialImage::MakeDeferredFromGpu(
context, dstIRect, kNeedNewImageUniqueID_SpecialImage,
- renderTargetContext->asTextureProxyRef(),
- renderTargetContext->colorSpaceInfo().colorType(),
- renderTargetContext->colorSpaceInfo().refColorSpace());
+ renderTargetContext->asTextureProxyRef(), renderTargetContext->colorInfo().colorType(),
+ renderTargetContext->colorInfo().refColorSpace());
}
sk_sp<SkSpecialImage> SkImageFilter_Base::ImageToColorSpace(SkSpecialImage* src,
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 9ec1a52..e1a8347 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -62,8 +62,7 @@
}
SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) {
- return SkImageInfo(width, height, kN32_SkColorType, at,
- SkColorSpace::MakeSRGB());
+ return SkImageInfo({width, height}, kN32_SkColorType, at, SkColorSpace::MakeSRGB());
}
bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
diff --git a/src/core/SkModeColorFilter.cpp b/src/core/SkModeColorFilter.cpp
index aa2bac1..bad042b 100644
--- a/src/core/SkModeColorFilter.cpp
+++ b/src/core/SkModeColorFilter.cpp
@@ -79,12 +79,12 @@
#include "src/gpu/effects/generated/GrConstColorProcessor.h"
std::unique_ptr<GrFragmentProcessor> SkModeColorFilter::asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo& dstColorSpaceInfo) const {
+ GrRecordingContext*, const GrColorInfo& dstColorInfo) const {
if (SkBlendMode::kDst == fMode) {
return nullptr;
}
- auto constFP = GrConstColorProcessor::Make(SkColorToPMColor4f(fColor, dstColorSpaceInfo),
+ auto constFP = GrConstColorProcessor::Make(SkColorToPMColor4f(fColor, dstColorInfo),
GrConstColorProcessor::InputMode::kIgnore);
auto fp = GrXfermodeFragmentProcessor::MakeFromSrcProcessor(std::move(constFP), fMode);
if (!fp) {
diff --git a/src/core/SkModeColorFilter.h b/src/core/SkModeColorFilter.h
index 6561aca..ba10759 100644
--- a/src/core/SkModeColorFilter.h
+++ b/src/core/SkModeColorFilter.h
@@ -20,8 +20,8 @@
uint32_t getFlags() const override;
#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const override;
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
+ const GrColorInfo&) const override;
#endif
protected:
diff --git a/src/core/SkPictureImageGenerator.cpp b/src/core/SkPictureImageGenerator.cpp
index fcec6b5..21987f1 100644
--- a/src/core/SkPictureImageGenerator.cpp
+++ b/src/core/SkPictureImageGenerator.cpp
@@ -53,8 +53,8 @@
colorType = kRGBA_F16_SkColorType;
}
- SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType,
- kPremul_SkAlphaType, std::move(colorSpace));
+ SkImageInfo info =
+ SkImageInfo::Make(size, colorType, kPremul_SkAlphaType, std::move(colorSpace));
return std::unique_ptr<SkImageGenerator>(
new SkPictureImageGenerator(info, std::move(picture), matrix, paint));
}
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 40e8c02..109741a 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -276,8 +276,7 @@
const SkSurfaceProps* props) const override {
// Ignore the requested color type, the raster backend currently only supports N32
colorType = kN32_SkColorType; // TODO: find ways to allow f16
- SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType, at,
- sk_ref_sp(colorSpace));
+ SkImageInfo info = SkImageInfo::Make(size, colorType, at, sk_ref_sp(colorSpace));
return SkSpecialSurface::MakeRaster(info, props);
}
@@ -304,8 +303,7 @@
const SkISize& size, SkAlphaType at) const override {
// Ignore the requested color type, the raster backend currently only supports N32
colorType = kN32_SkColorType; // TODO: find ways to allow f16
- SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType, at,
- sk_ref_sp(colorSpace));
+ SkImageInfo info = SkImageInfo::Make(size, colorType, at, sk_ref_sp(colorSpace));
return SkSurface::MakeRaster(info);
}
@@ -525,8 +523,7 @@
// onMakeSurface() or is this unnecessary?
colorType = colorSpace && colorSpace->gammaIsLinear()
? kRGBA_F16_SkColorType : kRGBA_8888_SkColorType;
- SkImageInfo info = SkImageInfo::Make(size.width(), size.height(), colorType, at,
- sk_ref_sp(colorSpace));
+ SkImageInfo info = SkImageInfo::Make(size, colorType, at, sk_ref_sp(colorSpace));
// CONTEXT TODO: remove this use of 'backdoor' to create an SkSurface
return SkSurface::MakeRenderTarget(fContext->priv().backdoor(), SkBudgeted::kYes, info);
}
diff --git a/src/effects/SkHighContrastFilter.cpp b/src/effects/SkHighContrastFilter.cpp
index e9db7bd..8a5263f 100644
--- a/src/effects/SkHighContrastFilter.cpp
+++ b/src/effects/SkHighContrastFilter.cpp
@@ -16,7 +16,7 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrContext.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#endif
@@ -36,9 +36,9 @@
~SkHighContrast_Filter() override {}
#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const override;
- #endif
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
+ const GrColorInfo&) const override;
+#endif
bool onAppendStages(const SkStageRec& rec, bool shaderIsOpaque) const override;
@@ -354,7 +354,7 @@
}
std::unique_ptr<GrFragmentProcessor> SkHighContrast_Filter::asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo& csi) const {
+ GrRecordingContext*, const GrColorInfo& csi) const {
bool linearize = !csi.isLinearlyBlended();
return HighContrastFilterEffect::Make(fConfig, linearize);
}
diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp
index 0e6deb0..f164408 100644
--- a/src/effects/SkLumaColorFilter.cpp
+++ b/src/effects/SkLumaColorFilter.cpp
@@ -39,7 +39,7 @@
#if SK_SUPPORT_GPU
std::unique_ptr<GrFragmentProcessor> SkLumaColorFilter::asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const {
+ GrRecordingContext*, const GrColorInfo&) const {
return GrLumaColorFilterEffect::Make();
}
#endif
diff --git a/src/effects/SkOverdrawColorFilter.cpp b/src/effects/SkOverdrawColorFilter.cpp
index 1552ab8..c91748e 100644
--- a/src/effects/SkOverdrawColorFilter.cpp
+++ b/src/effects/SkOverdrawColorFilter.cpp
@@ -88,7 +88,7 @@
#include "include/private/GrRecordingContext.h"
std::unique_ptr<GrFragmentProcessor> SkOverdrawColorFilter::asFragmentProcessor(
- GrRecordingContext* context, const GrColorSpaceInfo&) const {
+ GrRecordingContext* context, const GrColorInfo&) const {
static int overdrawIndex = GrSkSLFP::NewIndex();
return GrSkSLFP::Make(context, overdrawIndex, "Overdraw", SKSL_OVERDRAW_SRC, fColors,
sizeof(fColors));
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 304babd..601da8f 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -85,8 +85,8 @@
~SkTable_ColorFilter() override { delete fBitmap; }
#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const override;
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
+ const GrColorInfo&) const override;
#endif
enum {
@@ -234,7 +234,7 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/SkGr.h"
@@ -399,15 +399,15 @@
));
sk_sp<SkColorSpace> colorSpace = GrTest::TestColorSpace(d->fRandom);
auto fp = filter->asFragmentProcessor(
- d->context(), GrColorSpaceInfo(GrColorType::kRGBA_8888, kUnknown_SkAlphaType,
- std::move(colorSpace)));
+ d->context(),
+ GrColorInfo(GrColorType::kRGBA_8888, kUnknown_SkAlphaType, std::move(colorSpace)));
SkASSERT(fp);
return fp;
}
#endif
std::unique_ptr<GrFragmentProcessor> SkTable_ColorFilter::asFragmentProcessor(
- GrRecordingContext* context, const GrColorSpaceInfo&) const {
+ GrRecordingContext* context, const GrColorInfo&) const {
SkBitmap bitmap;
this->getTableAsBitmap(&bitmap);
diff --git a/src/effects/imagefilters/SkArithmeticImageFilter.cpp b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
index 5d42e24..5ec1909 100644
--- a/src/effects/imagefilters/SkArithmeticImageFilter.cpp
+++ b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
@@ -422,13 +422,12 @@
renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, matrix,
SkRect::Make(bounds));
- return SkSpecialImage::MakeDeferredFromGpu(
- context,
- SkIRect::MakeWH(bounds.width(), bounds.height()),
- kNeedNewImageUniqueID_SpecialImage,
- renderTargetContext->asTextureProxyRef(),
- renderTargetContext->colorSpaceInfo().colorType(),
- renderTargetContext->colorSpaceInfo().refColorSpace());
+ return SkSpecialImage::MakeDeferredFromGpu(context,
+ SkIRect::MakeWH(bounds.width(), bounds.height()),
+ kNeedNewImageUniqueID_SpecialImage,
+ renderTargetContext->asTextureProxyRef(),
+ renderTargetContext->colorInfo().colorType(),
+ renderTargetContext->colorInfo().refColorSpace());
}
#endif
diff --git a/src/effects/imagefilters/SkBlurImageFilter.cpp b/src/effects/imagefilters/SkBlurImageFilter.cpp
index 1ffeb76..2dde5e2 100644
--- a/src/effects/imagefilters/SkBlurImageFilter.cpp
+++ b/src/effects/imagefilters/SkBlurImageFilter.cpp
@@ -687,7 +687,7 @@
SkIRect::MakeWH(dstBounds.width(), dstBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
renderTargetContext->asTextureProxyRef(),
- renderTargetContext->colorSpaceInfo().colorType(),
+ renderTargetContext->colorInfo().colorType(),
sk_ref_sp(input->getColorSpace()),
ctx.surfaceProps());
}
diff --git a/src/effects/imagefilters/SkDisplacementMapEffect.cpp b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
index 9a6ce26..3bce947 100644
--- a/src/effects/imagefilters/SkDisplacementMapEffect.cpp
+++ b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
@@ -389,8 +389,8 @@
SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
renderTargetContext->asTextureProxyRef(),
- renderTargetContext->colorSpaceInfo().colorType(),
- renderTargetContext->colorSpaceInfo().refColorSpace());
+ renderTargetContext->colorInfo().colorType(),
+ renderTargetContext->colorInfo().refColorSpace());
}
#endif
diff --git a/src/effects/imagefilters/SkLightingImageFilter.cpp b/src/effects/imagefilters/SkLightingImageFilter.cpp
index 8828c10..43d32dc 100644
--- a/src/effects/imagefilters/SkLightingImageFilter.cpp
+++ b/src/effects/imagefilters/SkLightingImageFilter.cpp
@@ -538,8 +538,8 @@
SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
renderTargetContext->asTextureProxyRef(),
- renderTargetContext->colorSpaceInfo().colorType(),
- renderTargetContext->colorSpaceInfo().refColorSpace());
+ renderTargetContext->colorInfo().colorType(),
+ renderTargetContext->colorInfo().refColorSpace());
}
#endif
diff --git a/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
index d934d02..a41e599 100644
--- a/src/effects/imagefilters/SkMorphologyImageFilter.cpp
+++ b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
@@ -796,8 +796,7 @@
return nullptr;
}
- SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(),
- inputBM.colorType(), inputBM.alphaType());
+ SkImageInfo info = SkImageInfo::Make(bounds.size(), inputBM.colorType(), inputBM.alphaType());
SkBitmap dst;
if (!dst.tryAllocPixels(info)) {
diff --git a/src/effects/imagefilters/SkXfermodeImageFilter.cpp b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
index 13ec99a..8b2e5d6 100644
--- a/src/effects/imagefilters/SkXfermodeImageFilter.cpp
+++ b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
@@ -317,13 +317,12 @@
renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, matrix,
SkRect::Make(bounds));
- return SkSpecialImage::MakeDeferredFromGpu(
- context,
- SkIRect::MakeWH(bounds.width(), bounds.height()),
- kNeedNewImageUniqueID_SpecialImage,
- renderTargetContext->asTextureProxyRef(),
- renderTargetContext->colorSpaceInfo().colorType(),
- renderTargetContext->colorSpaceInfo().refColorSpace());
+ return SkSpecialImage::MakeDeferredFromGpu(context,
+ SkIRect::MakeWH(bounds.width(), bounds.height()),
+ kNeedNewImageUniqueID_SpecialImage,
+ renderTargetContext->asTextureProxyRef(),
+ renderTargetContext->colorInfo().colorType(),
+ renderTargetContext->colorInfo().refColorSpace());
}
std::unique_ptr<GrFragmentProcessor> SkXfermodeImageFilterImpl::makeFGFrag(
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp
index 48ff321..42eaa41 100644
--- a/src/gpu/GrBitmapTextureMaker.cpp
+++ b/src/gpu/GrBitmapTextureMaker.cpp
@@ -17,9 +17,9 @@
#include "src/gpu/GrSurfaceContext.h"
#include "src/gpu/SkGr.h"
-static GrColorSpaceInfo make_info(const SkBitmap& bm) {
- return GrColorSpaceInfo(SkColorTypeToGrColorType(bm.colorType()), bm.alphaType(),
- bm.refColorSpace());
+static GrColorInfo make_info(const SkBitmap& bm) {
+ return GrColorInfo(SkColorTypeToGrColorType(bm.colorType()), bm.alphaType(),
+ bm.refColorSpace());
}
GrBitmapTextureMaker::GrBitmapTextureMaker(GrRecordingContext* context, const SkBitmap& bitmap,
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 130d840..71a54bd 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -411,8 +411,8 @@
if (maskRTC) {
filteredMask = maskFilter->filterMaskGPU(context,
maskRTC->asTextureProxyRef(),
- maskRTC->colorSpaceInfo().colorType(),
- maskRTC->colorSpaceInfo().alphaType(),
+ maskRTC->colorInfo().colorType(),
+ maskRTC->colorInfo().alphaType(),
viewMatrix,
maskRect);
SkASSERT(kTopLeft_GrSurfaceOrigin == filteredMask->origin());
@@ -459,8 +459,7 @@
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(context, renderTargetContext->colorSpaceInfo(), paint, viewMatrix,
- &grPaint)) {
+ if (!SkPaintToGrPaint(context, renderTargetContext->colorInfo(), paint, viewMatrix, &grPaint)) {
return;
}
diff --git a/src/gpu/GrColorSpaceInfo.cpp b/src/gpu/GrColorInfo.cpp
similarity index 75%
rename from src/gpu/GrColorSpaceInfo.cpp
rename to src/gpu/GrColorInfo.cpp
index 179e754..d5efec4 100644
--- a/src/gpu/GrColorSpaceInfo.cpp
+++ b/src/gpu/GrColorInfo.cpp
@@ -5,15 +5,15 @@
* found in the LICENSE file.
*/
-#include "src/core/SkColorSpacePriv.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
-GrColorSpaceInfo::GrColorSpaceInfo(GrColorType colorType,
- SkAlphaType alphaType,
- sk_sp<SkColorSpace> colorSpace)
+#include "src/core/SkColorSpacePriv.h"
+
+GrColorInfo::GrColorInfo(
+ GrColorType colorType, SkAlphaType alphaType, sk_sp<SkColorSpace> colorSpace)
: fColorSpace(std::move(colorSpace)), fColorType(colorType), fAlphaType(alphaType) {}
-GrColorSpaceXform* GrColorSpaceInfo::colorSpaceXformFromSRGB() const {
+GrColorSpaceXform* GrColorInfo::colorSpaceXformFromSRGB() const {
// TODO: Make this atomic if we start accessing this on multiple threads.
if (!fInitializedColorSpaceXformFromSRGB) {
// sRGB sources are very common (SkColor, etc...), so we cache that transformation
diff --git a/src/gpu/GrColorSpaceInfo.h b/src/gpu/GrColorInfo.h
similarity index 79%
rename from src/gpu/GrColorSpaceInfo.h
rename to src/gpu/GrColorInfo.h
index 672430a..4f5f594 100644
--- a/src/gpu/GrColorSpaceInfo.h
+++ b/src/gpu/GrColorInfo.h
@@ -5,19 +5,21 @@
* found in the LICENSE file.
*/
-#ifndef GrColorSpaceInfo_DEFINED
-#define GrColorSpaceInfo_DEFINED
+#ifndef GrColorInfo_DEFINED
+#define GrColorInfo_DEFINED
#include "include/core/SkColorSpace.h"
#include "include/core/SkRefCnt.h"
#include "include/gpu/GrTypes.h"
#include "src/gpu/GrColorSpaceXform.h"
-/** Describes the color space properties of a surface context. */
-class GrColorSpaceInfo {
+/**
+ * All the info needed to interpret a color: Color type + alpha type + color space. Also caches
+ * the GrColorSpaceXform from sRGB. */
+class GrColorInfo {
public:
- GrColorSpaceInfo() = default;
- GrColorSpaceInfo(GrColorType, SkAlphaType, sk_sp<SkColorSpace>);
+ GrColorInfo() = default;
+ GrColorInfo(GrColorType, SkAlphaType, sk_sp<SkColorSpace>);
bool isLinearlyBlended() const { return fColorSpace && fColorSpace->gammaIsLinear(); }
diff --git a/src/gpu/GrDataUtils.h b/src/gpu/GrDataUtils.h
index d978d4e..2fad128 100644
--- a/src/gpu/GrDataUtils.h
+++ b/src/gpu/GrDataUtils.h
@@ -10,7 +10,7 @@
#include "include/core/SkColor.h"
#include "include/private/GrTypesPriv.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrSwizzle.h"
class GrImageInfo;
diff --git a/src/gpu/GrFPArgs.h b/src/gpu/GrFPArgs.h
index 720d2fd..87b7e36 100644
--- a/src/gpu/GrFPArgs.h
+++ b/src/gpu/GrFPArgs.h
@@ -11,18 +11,18 @@
#include "include/core/SkFilterQuality.h"
#include "include/core/SkMatrix.h"
-class GrColorSpaceInfo;
+class GrColorInfo;
class GrRecordingContext;
struct GrFPArgs {
GrFPArgs(GrRecordingContext* context,
const SkMatrix* viewMatrix,
SkFilterQuality filterQuality,
- const GrColorSpaceInfo* dstColorSpaceInfo)
- : fContext(context)
- , fViewMatrix(viewMatrix)
- , fFilterQuality(filterQuality)
- , fDstColorSpaceInfo(dstColorSpaceInfo) {
+ const GrColorInfo* dstColorInfo)
+ : fContext(context)
+ , fViewMatrix(viewMatrix)
+ , fFilterQuality(filterQuality)
+ , fDstColorInfo(dstColorInfo) {
SkASSERT(fContext);
SkASSERT(fViewMatrix);
}
@@ -46,7 +46,7 @@
bool fInputColorIsOpaque = false;
SkFilterQuality fFilterQuality;
- const GrColorSpaceInfo* fDstColorSpaceInfo;
+ const GrColorInfo* fDstColorInfo;
};
class GrFPArgs::WithPreLocalMatrix final : public GrFPArgs {
diff --git a/src/gpu/GrImageInfo.h b/src/gpu/GrImageInfo.h
index 423d1d0..e2f1330 100644
--- a/src/gpu/GrImageInfo.h
+++ b/src/gpu/GrImageInfo.h
@@ -10,7 +10,7 @@
#include "include/core/SkImageInfo.h"
#include "include/private/GrTypesPriv.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
class GrImageInfo {
public:
@@ -88,7 +88,7 @@
bool isValid() const { return fColorInfo.isValid() && this->width() > 0 && this->height() > 0; }
private:
- GrColorSpaceInfo fColorInfo = {};
+ GrColorInfo fColorInfo = {};
SkISize fDimensions;
};
diff --git a/src/gpu/GrImageTextureMaker.cpp b/src/gpu/GrImageTextureMaker.cpp
index 9378b9c..b315bdb 100644
--- a/src/gpu/GrImageTextureMaker.cpp
+++ b/src/gpu/GrImageTextureMaker.cpp
@@ -13,10 +13,10 @@
#include "src/image/SkImage_GpuYUVA.h"
#include "src/image/SkImage_Lazy.h"
-static GrColorSpaceInfo make_info(const SkImage*& image) {
- return GrColorSpaceInfo(SkColorTypeToGrColorType(image->colorType()),
- image->alphaType(),
- image->refColorSpace());
+static GrColorInfo make_info(const SkImage*& image) {
+ return GrColorInfo(SkColorTypeToGrColorType(image->colorType()),
+ image->alphaType(),
+ image->refColorSpace());
}
GrImageTextureMaker::GrImageTextureMaker(GrRecordingContext* context, const SkImage* client,
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 7cd65b2..af6792c 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -73,9 +73,9 @@
public:
TextTarget(GrRenderTargetContext* renderTargetContext)
: GrTextTarget(renderTargetContext->width(), renderTargetContext->height(),
- renderTargetContext->colorSpaceInfo())
+ renderTargetContext->colorInfo())
, fRenderTargetContext(renderTargetContext)
- , fGlyphPainter{*renderTargetContext}{}
+ , fGlyphPainter{*renderTargetContext} {}
void addDrawOp(const GrClip& clip, std::unique_ptr<GrAtlasTextOp> op) override {
fRenderTargetContext->addDrawOp(clip, std::move(op));
@@ -90,11 +90,11 @@
void makeGrPaint(GrMaskFormat maskFormat, const SkPaint& skPaint, const SkMatrix& viewMatrix,
GrPaint* grPaint) override {
auto context = fRenderTargetContext->fContext;
- const GrColorSpaceInfo& colorSpaceInfo = fRenderTargetContext->colorSpaceInfo();
+ const GrColorInfo& colorInfo = fRenderTargetContext->colorInfo();
if (kARGB_GrMaskFormat == maskFormat) {
- SkPaintToGrPaintWithPrimitiveColor(context, colorSpaceInfo, skPaint, grPaint);
+ SkPaintToGrPaintWithPrimitiveColor(context, colorInfo, skPaint, grPaint);
} else {
- SkPaintToGrPaint(context, colorSpaceInfo, skPaint, viewMatrix, grPaint);
+ SkPaintToGrPaint(context, colorInfo, skPaint, viewMatrix, grPaint);
}
}
@@ -621,7 +621,7 @@
const GrClip& finalClip = opt == QuadOptimization::kClipApplied ? GrFixedClip::Disabled()
: clip;
GrAAType aaType = this->chooseAAType(aa);
- auto clampType = GrColorTypeClampType(this->colorSpaceInfo().colorType());
+ auto clampType = GrColorTypeClampType(this->colorInfo().colorType());
auto saturate = clampType == GrClampType::kManual ? GrTextureOp::Saturate::kYes
: GrTextureOp::Saturate::kNo;
// Use the provided domain, although hypothetically we could detect that the cropped local
@@ -887,7 +887,7 @@
// Can use a single op, avoiding GrPaint creation, and can batch across proxies
AutoCheckFlush acf(this->drawingManager());
GrAAType aaType = this->chooseAAType(aa);
- auto clampType = GrColorTypeClampType(this->colorSpaceInfo().colorType());
+ auto clampType = GrColorTypeClampType(this->colorInfo().colorType());
auto saturate = clampType == GrClampType::kManual ? GrTextureOp::Saturate::kYes
: GrTextureOp::Saturate::kNo;
auto op = GrTextureOp::MakeSet(fContext, set, cnt, filter, saturate, aaType, constraint,
@@ -914,7 +914,7 @@
GrAAType aaType = this->chooseAAType(GrAA::kNo);
std::unique_ptr<GrDrawOp> op = GrDrawVerticesOp::Make(
fContext, std::move(paint), std::move(vertices), bones, boneCount, viewMatrix, aaType,
- this->colorSpaceInfo().refColorSpaceXformFromSRGB(), overridePrimType);
+ this->colorInfo().refColorSpaceXformFromSRGB(), overridePrimType);
this->addDrawOp(clip, std::move(op));
}
@@ -1517,7 +1517,7 @@
return;
}
bool needsRescale = srcRect.width() != info.width() || srcRect.height() != info.height();
- auto colorTypeOfFinalContext = this->colorSpaceInfo().colorType();
+ auto colorTypeOfFinalContext = this->colorInfo().colorType();
auto backendFormatOfFinalContext = fRenderTargetProxy->backendFormat();
if (needsRescale) {
colorTypeOfFinalContext = dstCT;
@@ -1535,7 +1535,7 @@
// channels are in the src.
uint32_t dstComponents = GrColorTypeComponentFlags(dstCT);
uint32_t legalReadComponents = GrColorTypeComponentFlags(readInfo.fColorType);
- uint32_t srcComponents = GrColorTypeComponentFlags(this->colorSpaceInfo().colorType());
+ uint32_t srcComponents = GrColorTypeComponentFlags(this->colorInfo().colorType());
if ((~legalReadComponents & dstComponents) & srcComponents) {
callback(context, nullptr, 0);
return;
@@ -1550,14 +1550,14 @@
callback(context, nullptr, 0);
return;
}
- SkASSERT(SkColorSpace::Equals(tempRTC->colorSpaceInfo().colorSpace(), info.colorSpace()));
+ SkASSERT(SkColorSpace::Equals(tempRTC->colorInfo().colorSpace(), info.colorSpace()));
SkASSERT(tempRTC->origin() == kTopLeft_GrSurfaceOrigin);
x = y = 0;
} else {
- sk_sp<GrColorSpaceXform> xform =
- GrColorSpaceXform::Make(this->colorSpaceInfo().colorSpace(),
- this->colorSpaceInfo().alphaType(),
- info.colorSpace(), info.alphaType());
+ sk_sp<GrColorSpaceXform> xform = GrColorSpaceXform::Make(this->colorInfo().colorSpace(),
+ this->colorInfo().alphaType(),
+ info.colorSpace(),
+ info.alphaType());
// Insert a draw to a temporary surface if we need to do a y-flip or color space conversion.
if (this->origin() == kBottomLeft_GrSurfaceOrigin || xform) {
// We flip or color convert by drawing and we don't currently support drawing to
@@ -1581,7 +1581,7 @@
}
tempRTC = direct->priv().makeDeferredRenderTargetContext(
SkBackingFit::kApprox, srcRect.width(), srcRect.height(),
- this->colorSpaceInfo().colorType(), info.refColorSpace(), 1, GrMipMapped::kNo,
+ this->colorInfo().colorType(), info.refColorSpace(), 1, GrMipMapped::kNo,
kTopLeft_GrSurfaceOrigin);
if (!tempRTC) {
callback(context, nullptr, 0);
@@ -1610,9 +1610,9 @@
if (!transferResult.fTransferBuffer) {
SkAutoPixmapStorage pm;
- auto ii = SkImageInfo::Make(rect.width(), rect.height(), colorType,
- this->colorSpaceInfo().alphaType(),
- this->colorSpaceInfo().refColorSpace());
+ auto ii = SkImageInfo::Make(rect.size(), colorType,
+ this->colorInfo().alphaType(),
+ this->colorInfo().refColorSpace());
pm.alloc(ii);
if (!this->readPixels(ii, pm.writable_addr(), pm.rowBytes(), {rect.fLeft, rect.fTop})) {
callback(context, nullptr, 0);
@@ -1690,14 +1690,14 @@
callback(context, nullptr, nullptr);
return;
}
- SkASSERT(SkColorSpace::Equals(tempRTC->colorSpaceInfo().colorSpace(), info.colorSpace()));
+ SkASSERT(SkColorSpace::Equals(tempRTC->colorInfo().colorSpace(), info.colorSpace()));
SkASSERT(tempRTC->origin() == kTopLeft_GrSurfaceOrigin);
x = y = 0;
} else {
// We assume the caller wants kPremul. There is no way to indicate a preference.
sk_sp<GrColorSpaceXform> xform = GrColorSpaceXform::Make(
- this->colorSpaceInfo().colorSpace(), this->colorSpaceInfo().alphaType(),
- dstColorSpace.get(), kPremul_SkAlphaType);
+ this->colorInfo().colorSpace(), this->colorInfo().alphaType(), dstColorSpace.get(),
+ kPremul_SkAlphaType);
if (xform) {
sk_sp<GrTextureProxy> texProxy = this->asTextureProxyRef();
// TODO: Do something if the input is not a texture already.
@@ -1707,8 +1707,8 @@
}
SkRect srcRectToDraw = SkRect::Make(srcRect);
tempRTC = direct->priv().makeDeferredRenderTargetContext(
- SkBackingFit::kApprox, dstW, dstH, this->colorSpaceInfo().colorType(),
- dstColorSpace, 1, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin);
+ SkBackingFit::kApprox, dstW, dstH, this->colorInfo().colorType(), dstColorSpace,
+ 1, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin);
if (!tempRTC) {
callback(context, nullptr, nullptr);
return;
@@ -2095,7 +2095,7 @@
&viewMatrix,
&shape,
aaType,
- fRenderTargetContext->colorSpaceInfo().isLinearlyBlended()};
+ fRenderTargetContext->colorInfo().isLinearlyBlended()};
pr->drawPath(args);
return true;
}
@@ -2192,7 +2192,7 @@
&viewMatrix,
canDrawArgs.fShape,
aaType,
- this->colorSpaceInfo().isLinearlyBlended()};
+ this->colorInfo().isLinearlyBlended()};
pr->drawPath(args);
}
@@ -2257,7 +2257,7 @@
SkASSERT((!usesStencil && !appliedClip.hasStencilClip()) || (fNumStencilSamples > 0));
- GrClampType clampType = GrColorTypeClampType(this->colorSpaceInfo().colorType());
+ GrClampType clampType = GrColorTypeClampType(this->colorInfo().colorType());
// MIXED SAMPLES TODO: If we start using mixed samples for clips we will need to check the clip
// here as well.
bool hasMixedSampledCoverage = (usesHWAA && this->numSamples() <= 1);
@@ -2335,7 +2335,7 @@
// MSAA consideration: When there is support for reading MSAA samples in the shader we could
// have per-sample dst values by making the copy multisampled.
GrCaps::DstCopyRestrictions restrictions = this->caps()->getDstCopyRestrictions(
- fRenderTargetProxy.get(), this->colorSpaceInfo().colorType());
+ fRenderTargetProxy.get(), this->colorInfo().colorType());
if (!restrictions.fMustCopyWholeSrc) {
copyRect = clippedRect;
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 872a42b..eb198cb 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -36,7 +36,7 @@
GrColorType colorType,
SkAlphaType alphaType,
sk_sp<SkColorSpace> colorSpace)
- : fContext(context), fColorSpaceInfo(colorType, alphaType, std::move(colorSpace)) {}
+ : fContext(context), fColorInfo(colorType, alphaType, std::move(colorSpace)) {}
const GrCaps* GrSurfaceContext::caps() const { return fContext->priv().caps(); }
@@ -100,13 +100,13 @@
// Our tight row bytes may have been changed by clipping.
tightRowBytes = dstInfo.minRowBytes();
- bool premul = this->colorSpaceInfo().alphaType() == kUnpremul_SkAlphaType &&
+ bool premul = this->colorInfo().alphaType() == kUnpremul_SkAlphaType &&
dstInfo.alphaType() == kPremul_SkAlphaType;
- bool unpremul = this->colorSpaceInfo().alphaType() == kPremul_SkAlphaType &&
+ bool unpremul = this->colorInfo().alphaType() == kPremul_SkAlphaType &&
dstInfo.alphaType() == kUnpremul_SkAlphaType;
- bool needColorConversion = SkColorSpaceXformSteps::Required(this->colorSpaceInfo().colorSpace(),
- dstInfo.colorSpace());
+ bool needColorConversion =
+ SkColorSpaceXformSteps::Required(this->colorInfo().colorSpace(), dstInfo.colorSpace());
const GrCaps* caps = direct->priv().caps();
// This is the getImageData equivalent to the canvas2D putImageData fast path. We probably don't
@@ -131,10 +131,9 @@
}
if (readFlag == GrCaps::SurfaceReadPixelsSupport::kCopyToTexture2D || canvas2DFastPath) {
- GrColorType colorType = canvas2DFastPath ? GrColorType::kRGBA_8888
- : this->colorSpaceInfo().colorType();
- sk_sp<SkColorSpace> cs = canvas2DFastPath ? nullptr
- : this->colorSpaceInfo().refColorSpace();
+ GrColorType colorType =
+ canvas2DFastPath ? GrColorType::kRGBA_8888 : this->colorInfo().colorType();
+ sk_sp<SkColorSpace> cs = canvas2DFastPath ? nullptr : this->colorInfo().refColorSpace();
auto tempCtx = direct->priv().makeDeferredRenderTargetContext(
SkBackingFit::kApprox, dstInfo.width(), dstInfo.height(), colorType, std::move(cs),
@@ -177,7 +176,7 @@
bool flip = srcProxy->origin() == kBottomLeft_GrSurfaceOrigin;
auto supportedRead = caps->supportedReadPixelsColorType(
- this->colorSpaceInfo().colorType(), srcProxy->backendFormat(), dstInfo.colorType());
+ this->colorInfo().colorType(), srcProxy->backendFormat(), dstInfo.colorType());
bool makeTight = !caps->readPixelsRowBytesSupport() && tightRowBytes != rowBytes;
@@ -189,8 +188,8 @@
void* readDst = dst;
size_t readRB = rowBytes;
if (convert) {
- tmpInfo = {supportedRead.fColorType, this->colorSpaceInfo().alphaType(),
- this->colorSpaceInfo().refColorSpace(), dstInfo.width(), dstInfo.height()};
+ tmpInfo = {supportedRead.fColorType, this->colorInfo().alphaType(),
+ this->colorInfo().refColorSpace(), dstInfo.width(), dstInfo.height()};
size_t tmpRB = tmpInfo.minRowBytes();
size_t size = tmpRB * tmpInfo.height();
// Chrome MSAN bots require the data to be initialized (hence the ()).
@@ -204,7 +203,7 @@
direct->priv().flushSurface(srcProxy);
if (!direct->priv().getGpu()->readPixels(srcSurface, pt.fX, pt.fY, dstInfo.width(),
- dstInfo.height(), this->colorSpaceInfo().colorType(),
+ dstInfo.height(), this->colorInfo().colorType(),
supportedRead.fColorType, readDst, readRB)) {
return false;
}
@@ -259,13 +258,13 @@
// Our tight row bytes may have been changed by clipping.
tightRowBytes = srcInfo.minRowBytes();
- bool premul = this->colorSpaceInfo().alphaType() == kPremul_SkAlphaType &&
- srcInfo.alphaType() == kUnpremul_SkAlphaType;
- bool unpremul = this->colorSpaceInfo().alphaType() == kUnpremul_SkAlphaType &&
- srcInfo.alphaType() == kPremul_SkAlphaType;
+ bool premul = this->colorInfo().alphaType() == kPremul_SkAlphaType &&
+ srcInfo.alphaType() == kUnpremul_SkAlphaType;
+ bool unpremul = this->colorInfo().alphaType() == kUnpremul_SkAlphaType &&
+ srcInfo.alphaType() == kPremul_SkAlphaType;
- bool needColorConversion = SkColorSpaceXformSteps::Required(
- srcInfo.colorSpace(), this->colorSpaceInfo().colorSpace());
+ bool needColorConversion =
+ SkColorSpaceXformSteps::Required(srcInfo.colorSpace(), this->colorInfo().colorSpace());
const GrCaps* caps = direct->priv().caps();
@@ -298,12 +297,12 @@
alphaType = kUnpremul_SkAlphaType;
} else {
desc.fConfig = dstProxy->config();
- colorType = this->colorSpaceInfo().colorType();
+ colorType = this->colorInfo().colorType();
format = dstProxy->backendFormat().makeTexture2D();
if (!format.isValid()) {
return false;
}
- alphaType = this->colorSpaceInfo().alphaType();
+ alphaType = this->colorInfo().alphaType();
}
// It is more efficient for us to write pixels into a top left origin so we prefer that.
@@ -321,7 +320,7 @@
return false;
}
auto tempCtx = direct->priv().drawingManager()->makeTextureContext(
- tempProxy, colorType, alphaType, this->colorSpaceInfo().refColorSpace());
+ tempProxy, colorType, alphaType, this->colorInfo().refColorSpace());
if (!tempCtx) {
return false;
}
@@ -370,7 +369,7 @@
}
GrColorType allowedColorType =
- caps->supportedWritePixelsColorType(this->colorSpaceInfo().colorType(),
+ caps->supportedWritePixelsColorType(this->colorInfo().colorType(),
dstProxy->backendFormat(),
srcInfo.colorType()).fColorType;
bool flip = dstProxy->origin() == kBottomLeft_GrSurfaceOrigin;
@@ -381,9 +380,8 @@
std::unique_ptr<char[]> tmpPixels;
GrColorType srcColorType = srcInfo.colorType();
if (convert) {
- GrImageInfo tmpInfo(allowedColorType, this->colorSpaceInfo().alphaType(),
- this->colorSpaceInfo().refColorSpace(), srcInfo.width(),
- srcInfo.height());
+ GrImageInfo tmpInfo(allowedColorType, this->colorInfo().alphaType(),
+ this->colorInfo().refColorSpace(), srcInfo.width(), srcInfo.height());
auto tmpRB = tmpInfo.minRowBytes();
tmpPixels.reset(new char[tmpRB * tmpInfo.height()]);
@@ -402,9 +400,9 @@
// TODO: should this policy decision just be moved into the drawing manager?
direct->priv().flushSurface(caps->preferVRAMUseOverFlushes() ? dstProxy : nullptr);
- return direct->priv().getGpu()->writePixels(
- dstSurface, pt.fX, pt.fY, srcInfo.width(), srcInfo.height(),
- this->colorSpaceInfo().colorType(), srcColorType, src, rowBytes);
+ return direct->priv().getGpu()->writePixels(dstSurface, pt.fX, pt.fY, srcInfo.width(),
+ srcInfo.height(), this->colorInfo().colorType(),
+ srcColorType, src, rowBytes);
}
bool GrSurfaceContext::copy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint) {
@@ -486,11 +484,11 @@
// Assume we should ignore the rescale linear request if the surface has no color space since
// it's unclear how we'd linearize from an unknown color space.
- if (rescaleGamma == SkSurface::kLinear && this->colorSpaceInfo().colorSpace() &&
- !this->colorSpaceInfo().colorSpace()->gammaIsLinear()) {
- auto cs = this->colorSpaceInfo().colorSpace()->makeLinearGamma();
- auto xform = GrColorSpaceXform::Make(this->colorSpaceInfo().colorSpace(),
- this->colorSpaceInfo().alphaType(), cs.get(),
+ if (rescaleGamma == SkSurface::kLinear && this->colorInfo().colorSpace() &&
+ !this->colorInfo().colorSpace()->gammaIsLinear()) {
+ auto cs = this->colorInfo().colorSpace()->makeLinearGamma();
+ auto xform = GrColorSpaceXform::Make(this->colorInfo().colorSpace(),
+ this->colorInfo().alphaType(), cs.get(),
kPremul_SkAlphaType);
// We'll fall back to kRGBA_8888 if half float not supported.
auto linearRTC = fContext->priv().makeDeferredRenderTargetContextWithFallback(
@@ -531,16 +529,16 @@
--stepsY;
}
auto input = tempA ? tempA.get() : this;
- GrColorType colorType = input->colorSpaceInfo().colorType();
- auto cs = input->colorSpaceInfo().refColorSpace();
+ GrColorType colorType = input->colorInfo().colorType();
+ auto cs = input->colorInfo().refColorSpace();
sk_sp<GrColorSpaceXform> xform;
- auto prevAlphaType = input->colorSpaceInfo().alphaType();
+ auto prevAlphaType = input->colorInfo().alphaType();
if (!stepsX && !stepsY) {
// Might as well fold conversion to final info in the last step.
cs = info.refColorSpace();
colorType = SkColorTypeToGrColorType(info.colorType());
- xform = GrColorSpaceXform::Make(input->colorSpaceInfo().colorSpace(),
- input->colorSpaceInfo().alphaType(), cs.get(),
+ xform = GrColorSpaceXform::Make(input->colorInfo().colorSpace(),
+ input->colorInfo().alphaType(), cs.get(),
info.alphaType());
}
tempB = fContext->priv().makeDeferredRenderTargetContextWithFallback(
@@ -608,13 +606,13 @@
}
auto proxy = this->asSurfaceProxy();
- auto supportedRead = this->caps()->supportedReadPixelsColorType(
- this->colorSpaceInfo().colorType(), proxy->backendFormat(), dstCT);
+ auto supportedRead = this->caps()->supportedReadPixelsColorType(this->colorInfo().colorType(),
+ proxy->backendFormat(), dstCT);
// Fail if read color type does not have all of dstCT's color channels and those missing color
// channels are in the src.
uint32_t dstComponents = GrColorTypeComponentFlags(dstCT);
uint32_t legalReadComponents = GrColorTypeComponentFlags(supportedRead.fColorType);
- uint32_t srcComponents = GrColorTypeComponentFlags(this->colorSpaceInfo().colorType());
+ uint32_t srcComponents = GrColorTypeComponentFlags(this->colorInfo().colorType());
if ((~legalReadComponents & dstComponents) & srcComponents) {
return {};
}
@@ -638,11 +636,11 @@
this->height() - rect.fTop);
}
this->drawingManager()->newTransferFromRenderTask(this->asSurfaceProxyRef(), srcRect,
- this->colorSpaceInfo().colorType(),
+ this->colorInfo().colorType(),
supportedRead.fColorType, buffer, 0);
PixelTransferResult result;
result.fTransferBuffer = std::move(buffer);
- auto at = this->colorSpaceInfo().alphaType();
+ auto at = this->colorInfo().alphaType();
if (supportedRead.fColorType != dstCT || flip) {
result.fPixelConverter = [w = rect.width(), h = rect.height(), dstCT, supportedRead, at](
void* dst, const void* src) {
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index 8aa161b..c9de7d0 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -13,7 +13,7 @@
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkSurface.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrDataUtils.h"
#include "src/gpu/GrSurfaceProxy.h"
@@ -37,7 +37,7 @@
public:
virtual ~GrSurfaceContext() = default;
- const GrColorSpaceInfo& colorSpaceInfo() const { return fColorSpaceInfo; }
+ const GrColorInfo& colorInfo() const { return fColorInfo; }
// TODO: these two calls would be way cooler if this object had a GrSurfaceProxy pointer
int width() const { return this->asSurfaceProxy()->width(); }
@@ -158,7 +158,7 @@
return this->copy(src, SkIRect::MakeWH(src->width(), src->height()), SkIPoint::Make(0, 0));
}
- GrColorSpaceInfo fColorSpaceInfo;
+ GrColorInfo fColorInfo;
typedef SkRefCnt INHERITED;
};
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index c6e95a3..42aba5e 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -13,7 +13,7 @@
#include "include/gpu/GrContext.h"
#include "src/core/SkMakeUnique.h"
#include "src/core/SkRectPriv.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrProcessorUnitTest.h"
#include "src/gpu/GrStyle.h"
#include "src/utils/SkDashPathPriv.h"
@@ -338,10 +338,10 @@
TestAsFPArgs::TestAsFPArgs(GrProcessorTestData* d)
: fViewMatrixStorage(TestMatrix(d->fRandom))
- , fColorSpaceInfoStorage(skstd::make_unique<GrColorSpaceInfo>(
+ , fColorInfoStorage(skstd::make_unique<GrColorInfo>(
GrColorType::kRGBA_8888, kPremul_SkAlphaType, TestColorSpace(d->fRandom)))
- , fArgs(d->context(), &fViewMatrixStorage, kNone_SkFilterQuality,
- fColorSpaceInfoStorage.get()) {}
+ , fArgs(d->context(), &fViewMatrixStorage, kNone_SkFilterQuality, fColorInfoStorage.get()) {
+}
TestAsFPArgs::~TestAsFPArgs() {}
diff --git a/src/gpu/GrTestUtils.h b/src/gpu/GrTestUtils.h
index 220757e..b3e71a2 100644
--- a/src/gpu/GrTestUtils.h
+++ b/src/gpu/GrTestUtils.h
@@ -22,7 +22,7 @@
#include "src/gpu/GrSamplerState.h"
#include "src/shaders/SkShaderBase.h"
-class GrColorSpaceInfo;
+class GrColorInfo;
class GrColorSpaceXform;
struct GrProcessorTestData;
class GrStyle;
@@ -60,7 +60,7 @@
private:
SkMatrix fViewMatrixStorage;
- std::unique_ptr<GrColorSpaceInfo> fColorSpaceInfoStorage;
+ std::unique_ptr<GrColorInfo> fColorInfoStorage;
GrFPArgs fArgs;
};
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index 18d72a3..209d1f4 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -21,7 +21,7 @@
SkColorSpace* cs,
bool useDecal)
: INHERITED(context, original->width(), original->height(),
- GrColorSpaceInfo(colorType, alphaType, sk_ref_sp(cs)), useDecal)
+ GrColorInfo(colorType, alphaType, sk_ref_sp(cs)), useDecal)
, fOriginal(std::move(original))
, fUniqueID(uniqueID) {}
diff --git a/src/gpu/GrTextureMaker.h b/src/gpu/GrTextureMaker.h
index 6144c81..5d558d1 100644
--- a/src/gpu/GrTextureMaker.h
+++ b/src/gpu/GrTextureMaker.h
@@ -26,7 +26,7 @@
const GrSamplerState::Filter* filterOrNullForBicubic) override;
protected:
- GrTextureMaker(GrRecordingContext* context, int width, int height, const GrColorSpaceInfo& info,
+ GrTextureMaker(GrRecordingContext* context, int width, int height, const GrColorInfo& info,
bool domainNeedsLocal)
: INHERITED(context, width, height, info, domainNeedsLocal) {}
diff --git a/src/gpu/GrTextureProducer.h b/src/gpu/GrTextureProducer.h
index eef872a..ced7fd2 100644
--- a/src/gpu/GrTextureProducer.h
+++ b/src/gpu/GrTextureProducer.h
@@ -11,7 +11,7 @@
#include "include/core/SkImageInfo.h"
#include "include/private/GrResourceKey.h"
#include "include/private/SkNoncopyable.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrSamplerState.h"
class GrFragmentProcessor;
@@ -104,10 +104,10 @@
int width() const { return fWidth; }
int height() const { return fHeight; }
- GrColorType colorType() const { return fColorSpaceInfo.colorType(); }
- SkAlphaType alphaType() const { return fColorSpaceInfo.alphaType(); }
- SkColorSpace* colorSpace() const { return fColorSpaceInfo.colorSpace(); }
- bool isAlphaOnly() const { return GrColorTypeIsAlphaOnly(fColorSpaceInfo.colorType()); }
+ GrColorType colorType() const { return fColorInfo.colorType(); }
+ SkAlphaType alphaType() const { return fColorInfo.alphaType(); }
+ SkColorSpace* colorSpace() const { return fColorInfo.colorSpace(); }
+ bool isAlphaOnly() const { return GrColorTypeIsAlphaOnly(fColorInfo.colorType()); }
bool domainNeedsDecal() const { return fDomainNeedsDecal; }
// If the "texture" samples multiple images that have different resolutions (e.g. YUV420)
virtual bool hasMixedResolutions() const { return false; }
@@ -116,11 +116,11 @@
friend class GrTextureProducer_TestAccess;
GrTextureProducer(GrRecordingContext* context, int width, int height,
- const GrColorSpaceInfo& csInfo, bool domainNeedsDecal)
+ const GrColorInfo& colorInfo, bool domainNeedsDecal)
: fContext(context)
, fWidth(width)
, fHeight(height)
- , fColorSpaceInfo(csInfo)
+ , fColorInfo(colorInfo)
, fDomainNeedsDecal(domainNeedsDecal) {}
/** Helper for creating a key for a copy from an original key. */
@@ -191,7 +191,7 @@
GrRecordingContext* fContext;
const int fWidth;
const int fHeight;
- const GrColorSpaceInfo fColorSpaceInfo;
+ const GrColorInfo fColorInfo;
// If true, any domain effect uses kDecal instead of kClamp, and sampler filter uses
// kClampToBorder instead of kClamp.
const bool fDomainNeedsDecal;
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index bdf6f73..406355c 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -87,7 +87,7 @@
return nullptr;
}
- SkColorType ct = GrColorTypeToSkColorType(renderTargetContext->colorSpaceInfo().colorType());
+ SkColorType ct = GrColorTypeToSkColorType(renderTargetContext->colorInfo().colorType());
unsigned flags;
if (!context->colorTypeSupportedAsSurface(ct) ||
@@ -117,10 +117,10 @@
}
static SkImageInfo make_info(GrRenderTargetContext* context, bool opaque) {
- SkColorType colorType = GrColorTypeToSkColorType(context->colorSpaceInfo().colorType());
+ SkColorType colorType = GrColorTypeToSkColorType(context->colorInfo().colorType());
return SkImageInfo::Make(context->width(), context->height(), colorType,
opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType,
- context->colorSpaceInfo().refColorSpace());
+ context->colorInfo().refColorSpace());
}
SkGpuDevice::SkGpuDevice(GrContext* context,
@@ -166,13 +166,12 @@
matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top));
const SkIRect clipBounds = this->devClipBounds().makeOffset(-left, -top);
sk_sp<SkImageFilterCache> cache(this->getImageFilterCache());
- SkColorType colorType =
- GrColorTypeToSkColorType(fRenderTargetContext->colorSpaceInfo().colorType());
+ SkColorType colorType = GrColorTypeToSkColorType(fRenderTargetContext->colorInfo().colorType());
if (colorType == kUnknown_SkColorType) {
colorType = kRGBA_8888_SkColorType;
}
SkImageFilter_Base::Context ctx(matrix, clipBounds, cache.get(), colorType,
- fRenderTargetContext->colorSpaceInfo().colorSpace(), srcImg);
+ fRenderTargetContext->colorInfo().colorSpace(), srcImg);
return as_IFB(filter)->filterImage(ctx).imageAndOffset(offset);
}
@@ -265,8 +264,8 @@
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPaint", fContext.get());
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
- this->ctm(), &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint, this->ctm(),
+ &grPaint)) {
return;
}
@@ -297,7 +296,7 @@
if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mode) {
GrStyle style(paint, SkPaint::kStroke_Style);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint,
this->ctm(), &grPaint)) {
return;
}
@@ -342,8 +341,8 @@
#endif
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
- *viewMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint, *viewMatrix,
+ &grPaint)) {
return;
}
@@ -373,8 +372,8 @@
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
- this->ctm(), &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint, this->ctm(),
+ &grPaint)) {
return;
}
@@ -388,8 +387,7 @@
ASSERT_SINGLE_OWNER
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawEdgeAAQuad", fContext.get());
- SkPMColor4f dstColor =
- SkColor4fPrepForDst(color, fRenderTargetContext->colorSpaceInfo()).premul();
+ SkPMColor4f dstColor = SkColor4fPrepForDst(color, fRenderTargetContext->colorInfo()).premul();
GrPaint grPaint;
grPaint.setColor4f(dstColor);
@@ -437,8 +435,8 @@
SkASSERT(!style.pathEffect());
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
- this->ctm(), &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint, this->ctm(),
+ &grPaint)) {
return;
}
@@ -462,7 +460,7 @@
if (stroke.isFillStyle() && !paint.getMaskFilter() && !paint.getPathEffect()) {
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint,
this->ctm(), &grPaint)) {
return;
}
@@ -498,8 +496,8 @@
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
- this->ctm(), &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint, this->ctm(),
+ &grPaint)) {
return;
}
@@ -518,8 +516,8 @@
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
- this->ctm(), &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint, this->ctm(),
+ &grPaint)) {
return;
}
@@ -536,8 +534,8 @@
return;
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
- this->ctm(), &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint, this->ctm(),
+ &grPaint)) {
return;
}
@@ -592,7 +590,7 @@
m.postConcat(this->ctm());
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), newPaint, m,
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), newPaint, m,
&grPaint)) {
return;
}
@@ -622,7 +620,7 @@
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPath", fContext.get());
if (!paint.getMaskFilter()) {
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), paint,
this->ctm(), &grPaint)) {
return;
}
@@ -969,9 +967,9 @@
}
fp = GrColorSpaceXformEffect::Make(std::move(fp), bitmap.colorSpace(), bitmap.alphaType(),
- fRenderTargetContext->colorSpaceInfo().colorSpace());
+ fRenderTargetContext->colorInfo().colorSpace());
GrPaint grPaint;
- if (!SkPaintToGrPaintWithTexture(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
+ if (!SkPaintToGrPaintWithTexture(this->context(), fRenderTargetContext->colorInfo(), paint,
viewMatrix, std::move(fp),
kAlpha_8_SkColorType == bitmap.colorType(), &grPaint)) {
return;
@@ -1040,7 +1038,7 @@
auto fp = GrSimpleTextureEffect::Make(std::move(proxy), SkMatrix::I());
fp = GrColorSpaceXformEffect::Make(std::move(fp), result->getColorSpace(), result->alphaType(),
- fRenderTargetContext->colorSpaceInfo().colorSpace());
+ fRenderTargetContext->colorInfo().colorSpace());
if (GrPixelConfigIsAlphaOnly(config)) {
fp = GrFragmentProcessor::MakeInputPremulAndMulByOutput(std::move(fp));
} else {
@@ -1052,7 +1050,7 @@
}
GrPaint grPaint;
- if (!SkPaintToGrPaintReplaceShader(this->context(), fRenderTargetContext->colorSpaceInfo(),
+ if (!SkPaintToGrPaintReplaceShader(this->context(), fRenderTargetContext->colorInfo(),
tmpUnfiltered, std::move(fp), &grPaint)) {
return;
}
@@ -1351,12 +1349,12 @@
paint.writable()->setColor(SkColorSetARGB(origPaint.getAlpha(), 0xFF, 0xFF, 0xFF));
}
GrPaint grPaint;
- if (!SkPaintToGrPaintWithPrimitiveColor(this->context(), fRenderTargetContext->colorSpaceInfo(),
+ if (!SkPaintToGrPaintWithPrimitiveColor(this->context(), fRenderTargetContext->colorInfo(),
*paint, &grPaint)) {
return;
}
- auto dstColorSpace = fRenderTargetContext->colorSpaceInfo().colorSpace();
+ auto dstColorSpace = fRenderTargetContext->colorInfo().colorSpace();
const GrSamplerState::Filter filter = compute_lattice_filter_mode(*paint);
auto proxy = producer->refTextureProxyForParams(&filter, nullptr);
if (!proxy) {
@@ -1403,26 +1401,26 @@
this->drawProducerLattice(&maker, std::move(iter), dst, paint);
}
-static bool init_vertices_paint(GrContext* context, const GrColorSpaceInfo& colorSpaceInfo,
+static bool init_vertices_paint(GrContext* context, const GrColorInfo& colorInfo,
const SkPaint& skPaint, const SkMatrix& matrix, SkBlendMode bmode,
bool hasTexs, bool hasColors, GrPaint* grPaint) {
if (hasTexs && skPaint.getShader()) {
if (hasColors) {
// When there are texs and colors the shader and colors are combined using bmode.
- return SkPaintToGrPaintWithXfermode(context, colorSpaceInfo, skPaint, matrix, bmode,
+ return SkPaintToGrPaintWithXfermode(context, colorInfo, skPaint, matrix, bmode,
grPaint);
} else {
// We have a shader, but no colors to blend it against.
- return SkPaintToGrPaint(context, colorSpaceInfo, skPaint, matrix, grPaint);
+ return SkPaintToGrPaint(context, colorInfo, skPaint, matrix, grPaint);
}
} else {
if (hasColors) {
// We have colors, but either have no shader or no texture coords (which implies that
// we should ignore the shader).
- return SkPaintToGrPaintWithPrimitiveColor(context, colorSpaceInfo, skPaint, grPaint);
+ return SkPaintToGrPaintWithPrimitiveColor(context, colorInfo, skPaint, grPaint);
} else {
// No colors and no shaders. Just draw with the paint color.
- return SkPaintToGrPaintNoShader(context, colorSpaceInfo, skPaint, grPaint);
+ return SkPaintToGrPaintNoShader(context, colorInfo, skPaint, grPaint);
}
}
}
@@ -1442,7 +1440,7 @@
GrPaint grPaint;
// we ignore the shader since we have no texture coordinates.
- if (!SkPaintToGrPaintNoShader(this->context(), fRenderTargetContext->colorSpaceInfo(), copy,
+ if (!SkPaintToGrPaintNoShader(this->context(), fRenderTargetContext->colorInfo(), copy,
&grPaint)) {
return;
}
@@ -1509,8 +1507,8 @@
paint);
return;
}
- if (!init_vertices_paint(fContext.get(), fRenderTargetContext->colorSpaceInfo(), paint,
- this->ctm(), mode, hasTexs, hasColors, &grPaint)) {
+ if (!init_vertices_paint(fContext.get(), fRenderTargetContext->colorInfo(), paint, this->ctm(),
+ mode, hasTexs, hasColors, &grPaint)) {
return;
}
fRenderTargetContext->drawVertices(this->clip(), std::move(grPaint), this->ctm(),
@@ -1544,13 +1542,13 @@
GrPaint grPaint;
if (colors) {
- if (!SkPaintToGrPaintWithXfermode(this->context(), fRenderTargetContext->colorSpaceInfo(),
- p, this->ctm(), (SkBlendMode)mode, &grPaint)) {
+ if (!SkPaintToGrPaintWithXfermode(this->context(), fRenderTargetContext->colorInfo(), p,
+ this->ctm(), (SkBlendMode)mode, &grPaint)) {
return;
}
} else {
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), p,
- this->ctm(), &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorInfo(), p, this->ctm(),
+ &grPaint)) {
return;
}
}
@@ -1631,7 +1629,7 @@
cinfo.fInfo.width(),
cinfo.fInfo.height(),
SkColorTypeToGrColorType(cinfo.fInfo.colorType()),
- fRenderTargetContext->colorSpaceInfo().refColorSpace(),
+ fRenderTargetContext->colorInfo().refColorSpace(),
fRenderTargetContext->numSamples(),
GrMipMapped::kNo,
kBottomLeft_GrSurfaceOrigin,
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 5ee6a42..6d6208f 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -176,7 +176,7 @@
const SkPoint dstClip[4], GrAA aa, GrQuadAAFlags aaFlags,
SkCanvas::SrcRectConstraint constraint, sk_sp<GrTextureProxy> proxy,
SkAlphaType alphaType, SkColorSpace* colorSpace) {
- const GrColorSpaceInfo& dstInfo(rtc->colorSpaceInfo());
+ const GrColorInfo& dstInfo(rtc->colorInfo());
auto textureXform =
GrColorSpaceXform::Make(colorSpace , alphaType,
dstInfo.colorSpace(), kPremul_SkAlphaType);
@@ -304,14 +304,14 @@
auto fp = producer->createFragmentProcessor(textureMatrix, src, constraintMode,
coordsAllInsideSrcRect, filterMode);
fp = GrColorSpaceXformEffect::Make(std::move(fp), producer->colorSpace(), producer->alphaType(),
- rtc->colorSpaceInfo().colorSpace());
+ rtc->colorInfo().colorSpace());
if (!fp) {
return;
}
GrPaint grPaint;
- if (!SkPaintToGrPaintWithTexture(context, rtc->colorSpaceInfo(), paint, ctm,
- std::move(fp), producer->isAlphaOnly(), &grPaint)) {
+ if (!SkPaintToGrPaintWithTexture(context, rtc->colorInfo(), paint, ctm, std::move(fp),
+ producer->isAlphaOnly(), &grPaint)) {
return;
}
@@ -496,7 +496,7 @@
if (n > 0) {
auto textureXform = GrColorSpaceXform::Make(
set[base].fImage->colorSpace(), set[base].fImage->alphaType(),
- fRenderTargetContext->colorSpaceInfo().colorSpace(), kPremul_SkAlphaType);
+ fRenderTargetContext->colorInfo().colorSpace(), kPremul_SkAlphaType);
fRenderTargetContext->drawTextureSet(this->clip(), textures.get() + base, n,
filter, mode, GrAA::kYes, constraint, this->ctm(),
std::move(textureXform));
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 8ef3838..52adfac 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -213,16 +213,16 @@
///////////////////////////////////////////////////////////////////////////////
-SkPMColor4f SkColorToPMColor4f(SkColor c, const GrColorSpaceInfo& colorSpaceInfo) {
+SkPMColor4f SkColorToPMColor4f(SkColor c, const GrColorInfo& colorInfo) {
SkColor4f color = SkColor4f::FromColor(c);
- if (auto* xform = colorSpaceInfo.colorSpaceXformFromSRGB()) {
+ if (auto* xform = colorInfo.colorSpaceXformFromSRGB()) {
color = xform->apply(color);
}
return color.premul();
}
-SkColor4f SkColor4fPrepForDst(SkColor4f color, const GrColorSpaceInfo& colorSpaceInfo) {
- if (auto* xform = colorSpaceInfo.colorSpaceXformFromSRGB()) {
+SkColor4f SkColor4fPrepForDst(SkColor4f color, const GrColorInfo& colorInfo) {
+ if (auto* xform = colorInfo.colorSpaceXformFromSRGB()) {
color = xform->apply(color);
}
return color;
@@ -330,16 +330,16 @@
#endif
static inline bool skpaint_to_grpaint_impl(GrRecordingContext* context,
- const GrColorSpaceInfo& colorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
const SkMatrix& viewM,
std::unique_ptr<GrFragmentProcessor>* shaderProcessor,
SkBlendMode* primColorMode,
GrPaint* grPaint) {
// Convert SkPaint color to 4f format in the destination color space
- SkColor4f origColor = SkColor4fPrepForDst(skPaint.getColor4f(), colorSpaceInfo);
+ SkColor4f origColor = SkColor4fPrepForDst(skPaint.getColor4f(), dstColorInfo);
- GrFPArgs fpArgs(context, &viewM, skPaint.getFilterQuality(), &colorSpaceInfo);
+ GrFPArgs fpArgs(context, &viewM, skPaint.getFilterQuality(), &dstColorInfo);
// Setup the initial color considering the shader, the SkPaint color, and the presence or not
// of per-vertex colors.
@@ -428,10 +428,10 @@
SkColorFilter* colorFilter = skPaint.getColorFilter();
if (colorFilter) {
if (applyColorFilterToPaintColor) {
- SkColorSpace* dstCS = colorSpaceInfo.colorSpace();
+ SkColorSpace* dstCS = dstColorInfo.colorSpace();
grPaint->setColor4f(colorFilter->filterColor4f(origColor, dstCS, dstCS).premul());
} else {
- auto cfFP = colorFilter->asFragmentProcessor(context, colorSpaceInfo);
+ auto cfFP = colorFilter->asFragmentProcessor(context, dstColorInfo);
if (cfFP) {
grPaint->addColorFragmentProcessor(std::move(cfFP));
} else {
@@ -458,7 +458,7 @@
#ifndef SK_IGNORE_GPU_DITHER
// Conservative default, in case GrPixelConfigToColorType() fails.
- GrColorType ct = colorSpaceInfo.colorType();
+ GrColorType ct = dstColorInfo.colorType();
if (SkPaintPriv::ShouldDither(skPaint, GrColorTypeToSkColorType(ct)) &&
grPaint->numColorFragmentProcessors() > 0) {
int32_t ditherRange = dither_range_type_for_config(ct);
@@ -472,7 +472,7 @@
}
}
#endif
- if (GrColorTypeClampType(colorSpaceInfo.colorType()) == GrClampType::kManual) {
+ if (GrColorTypeClampType(dstColorInfo.colorType()) == GrClampType::kManual) {
if (grPaint->numColorFragmentProcessors()) {
grPaint->addColorFragmentProcessor(GrSaturateProcessor::Make());
} else {
@@ -486,50 +486,50 @@
return true;
}
-bool SkPaintToGrPaint(GrRecordingContext* context, const GrColorSpaceInfo& colorSpaceInfo,
+bool SkPaintToGrPaint(GrRecordingContext* context, const GrColorInfo& dstColorInfo,
const SkPaint& skPaint, const SkMatrix& viewM, GrPaint* grPaint) {
- return skpaint_to_grpaint_impl(context, colorSpaceInfo, skPaint, viewM, nullptr, nullptr,
+ return skpaint_to_grpaint_impl(context, dstColorInfo, skPaint, viewM, nullptr, nullptr,
grPaint);
}
/** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProcessor. */
bool SkPaintToGrPaintReplaceShader(GrRecordingContext* context,
- const GrColorSpaceInfo& colorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
std::unique_ptr<GrFragmentProcessor> shaderFP,
GrPaint* grPaint) {
if (!shaderFP) {
return false;
}
- return skpaint_to_grpaint_impl(context, colorSpaceInfo, skPaint, SkMatrix::I(), &shaderFP,
+ return skpaint_to_grpaint_impl(context, dstColorInfo, skPaint, SkMatrix::I(), &shaderFP,
nullptr, grPaint);
}
/** Ignores the SkShader (if any) on skPaint. */
bool SkPaintToGrPaintNoShader(GrRecordingContext* context,
- const GrColorSpaceInfo& colorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
GrPaint* grPaint) {
// Use a ptr to a nullptr to to indicate that the SkShader is ignored and not replaced.
std::unique_ptr<GrFragmentProcessor> nullShaderFP(nullptr);
- return skpaint_to_grpaint_impl(context, colorSpaceInfo, skPaint, SkMatrix::I(), &nullShaderFP,
+ return skpaint_to_grpaint_impl(context, dstColorInfo, skPaint, SkMatrix::I(), &nullShaderFP,
nullptr, grPaint);
}
/** Blends the SkPaint's shader (or color if no shader) with a per-primitive color which must
be setup as a vertex attribute using the specified SkBlendMode. */
bool SkPaintToGrPaintWithXfermode(GrRecordingContext* context,
- const GrColorSpaceInfo& colorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
const SkMatrix& viewM,
SkBlendMode primColorMode,
GrPaint* grPaint) {
- return skpaint_to_grpaint_impl(context, colorSpaceInfo, skPaint, viewM, nullptr, &primColorMode,
+ return skpaint_to_grpaint_impl(context, dstColorInfo, skPaint, viewM, nullptr, &primColorMode,
grPaint);
}
bool SkPaintToGrPaintWithTexture(GrRecordingContext* context,
- const GrColorSpaceInfo& colorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& paint,
const SkMatrix& viewM,
std::unique_ptr<GrFragmentProcessor> fp,
@@ -538,8 +538,8 @@
std::unique_ptr<GrFragmentProcessor> shaderFP;
if (textureIsAlphaOnly) {
if (const auto* shader = as_SB(paint.getShader())) {
- shaderFP = shader->asFragmentProcessor(GrFPArgs(
- context, &viewM, paint.getFilterQuality(), &colorSpaceInfo));
+ shaderFP = shader->asFragmentProcessor(
+ GrFPArgs(context, &viewM, paint.getFilterQuality(), &dstColorInfo));
if (!shaderFP) {
return false;
}
@@ -556,11 +556,10 @@
}
}
- return SkPaintToGrPaintReplaceShader(context, colorSpaceInfo, paint, std::move(shaderFP),
+ return SkPaintToGrPaintReplaceShader(context, dstColorInfo, paint, std::move(shaderFP),
grPaint);
}
-
////////////////////////////////////////////////////////////////////////////////////////////////
GrSamplerState::Filter GrSkFilterQualityToGrFilterMode(int imageWidth, int imageHeight,
diff --git a/src/gpu/SkGr.h b/src/gpu/SkGr.h
index 7182d71..9550bc0 100644
--- a/src/gpu/SkGr.h
+++ b/src/gpu/SkGr.h
@@ -23,7 +23,7 @@
#include "src/gpu/GrSamplerState.h"
class GrCaps;
-class GrColorSpaceInfo;
+class GrColorInfo;
class GrColorSpaceXform;
class GrContext;
class GrFragmentProcessor;
@@ -60,10 +60,10 @@
}
/** Similar, but using SkPMColor4f. */
-SkPMColor4f SkColorToPMColor4f(SkColor, const GrColorSpaceInfo&);
+SkPMColor4f SkColorToPMColor4f(SkColor, const GrColorInfo&);
/** Converts an SkColor4f to the destination color space. */
-SkColor4f SkColor4fPrepForDst(SkColor4f, const GrColorSpaceInfo&);
+SkColor4f SkColor4fPrepForDst(SkColor4f, const GrColorInfo&);
/** Returns true if half-floats are required to store the color in a vertex (and half-floats
are supported). */
@@ -80,14 +80,14 @@
/** Converts an SkPaint to a GrPaint for a given GrRecordingContext. The matrix is required in order
to convert the SkShader (if any) on the SkPaint. The primitive itself has no color. */
bool SkPaintToGrPaint(GrRecordingContext*,
- const GrColorSpaceInfo& dstColorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
const SkMatrix& viewM,
GrPaint* grPaint);
/** Same as above but ignores the SkShader (if any) on skPaint. */
bool SkPaintToGrPaintNoShader(GrRecordingContext*,
- const GrColorSpaceInfo& dstColorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
GrPaint* grPaint);
@@ -95,7 +95,7 @@
should expect an unpremul input color and produce a premultiplied output color. There is
no primitive color. */
bool SkPaintToGrPaintReplaceShader(GrRecordingContext*,
- const GrColorSpaceInfo& dstColorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
std::unique_ptr<GrFragmentProcessor> shaderFP,
GrPaint* grPaint);
@@ -103,7 +103,7 @@
/** Blends the SkPaint's shader (or color if no shader) with the color which specified via a
GrOp's GrPrimitiveProcesssor. */
bool SkPaintToGrPaintWithXfermode(GrRecordingContext*,
- const GrColorSpaceInfo& dstColorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
const SkMatrix& viewM,
SkBlendMode primColorMode,
@@ -114,17 +114,17 @@
unpremultiplied so that interpolation is done in unpremul space. The paint's alpha will be
applied to the primitive color after interpolation. */
inline bool SkPaintToGrPaintWithPrimitiveColor(GrRecordingContext* context,
- const GrColorSpaceInfo& dstColorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
GrPaint* grPaint) {
- return SkPaintToGrPaintWithXfermode(context, dstColorSpaceInfo, skPaint, SkMatrix::I(),
+ return SkPaintToGrPaintWithXfermode(context, dstColorInfo, skPaint, SkMatrix::I(),
SkBlendMode::kDst, grPaint);
}
/** This is used when there may or may not be a shader, and the caller wants to plugin a texture
lookup. If there is a shader, then its output will only be used if the texture is alpha8. */
bool SkPaintToGrPaintWithTexture(GrRecordingContext*,
- const GrColorSpaceInfo& dstColorSpaceInfo,
+ const GrColorInfo& dstColorInfo,
const SkPaint& skPaint,
const SkMatrix& viewM,
std::unique_ptr<GrFragmentProcessor> fp,
diff --git a/src/gpu/effects/GrRRectBlurEffect.fp b/src/gpu/effects/GrRRectBlurEffect.fp
index e7045b8..b0b770e 100644
--- a/src/gpu/effects/GrRRectBlurEffect.fp
+++ b/src/gpu/effects/GrRRectBlurEffect.fp
@@ -77,8 +77,8 @@
auto rtc2 =
SkGpuBlurUtils::GaussianBlur(context,
std::move(srcProxy),
- rtc->colorSpaceInfo().colorType(),
- rtc->colorSpaceInfo().alphaType(),
+ rtc->colorInfo().colorType(),
+ rtc->colorInfo().alphaType(),
SkIPoint::Make(0, 0),
nullptr,
SkIRect::MakeWH(size.fWidth, size.fHeight),
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.h b/src/gpu/effects/generated/GrRRectBlurEffect.h
index f6b0a55..436f604 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.h
@@ -77,8 +77,8 @@
}
auto rtc2 = SkGpuBlurUtils::GaussianBlur(context,
std::move(srcProxy),
- rtc->colorSpaceInfo().colorType(),
- rtc->colorSpaceInfo().alphaType(),
+ rtc->colorInfo().colorType(),
+ rtc->colorInfo().alphaType(),
SkIPoint::Make(0, 0),
nullptr,
SkIRect::MakeWH(size.fWidth, size.fHeight),
diff --git a/src/gpu/gradients/GrGradientShader.cpp b/src/gpu/gradients/GrGradientShader.cpp
index 241c6e9..a794652 100644
--- a/src/gpu/gradients/GrGradientShader.cpp
+++ b/src/gpu/gradients/GrGradientShader.cpp
@@ -24,7 +24,7 @@
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrColor.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/SkGr.h"
@@ -45,7 +45,7 @@
// Use 8888 or F16, depending on the destination config.
// TODO: Use 1010102 for opaque gradients, at least if destination is 1010102?
SkColorType colorType = kRGBA_8888_SkColorType;
- if (GrColorTypeIsWiderThan(args.fDstColorSpaceInfo->colorType(), 8)) {
+ if (GrColorTypeIsWiderThan(args.fDstColorInfo->colorType(), 8)) {
auto f16Format = args.fContext->priv().caps()->getDefaultBackendFormat(
GrColorType::kRGBA_F16, GrRenderable::kNo);
if (f16Format.isValid()) {
@@ -167,7 +167,7 @@
bool allOpaque = true;
SkAutoSTMalloc<4, SkPMColor4f> colors(shader.fColorCount);
SkColor4fXformer xformedColors(shader.fOrigColors4f, shader.fColorCount,
- shader.fColorSpace.get(), args.fDstColorSpaceInfo->colorSpace());
+ shader.fColorSpace.get(), args.fDstColorInfo->colorSpace());
for (int i = 0; i < shader.fColorCount; i++) {
const SkColor4f& upmColor = xformedColors.fColors[i];
colors[i] = inputPremul ? upmColor.premul()
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 6705be8..095c6fa 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -176,8 +176,7 @@
// TODO: Can we be even smarter based on the dest transfer function?
op = GrAtlasTextOp::MakeDistanceField(
target->getContext(), std::move(grPaint), glyphCount, distanceAdjustTable,
- target->colorSpaceInfo().isLinearlyBlended(),
- SkPaintPriv::ComputeLuminanceColor(paint),
+ target->colorInfo().isLinearlyBlended(), SkPaintPriv::ComputeLuminanceColor(paint),
props, info.isAntiAliased(), info.hasUseLCDText());
} else {
op = GrAtlasTextOp::MakeBitmap(target->getContext(), std::move(grPaint), format, glyphCount,
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 6b55aa7..6d8151c 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -70,12 +70,11 @@
return canonicalColor;
}
-SkScalerContextFlags GrTextContext::ComputeScalerContextFlags(
- const GrColorSpaceInfo& colorSpaceInfo) {
+SkScalerContextFlags GrTextContext::ComputeScalerContextFlags(const GrColorInfo& colorInfo) {
// If we're doing linear blending, then we can disable the gamma hacks.
// Otherwise, leave them on. In either case, we still want the contrast boost:
// TODO: Can we be even smarter about mask gamma based on the dest transfer function?
- if (colorSpaceInfo.isLinearlyBlended()) {
+ if (colorInfo.isLinearlyBlended()) {
return SkScalerContextFlags::kBoostContrast;
} else {
return SkScalerContextFlags::kFakeGammaAndBoostContrast;
diff --git a/src/gpu/text/GrTextContext.h b/src/gpu/text/GrTextContext.h
index cc582db..1cb9734 100644
--- a/src/gpu/text/GrTextContext.h
+++ b/src/gpu/text/GrTextContext.h
@@ -80,7 +80,7 @@
// sets up the descriptor on the blob and returns a detached cache. Client must attach
static SkColor ComputeCanonicalColor(const SkPaint&, bool lcd);
// Determines if we need to use fake gamma (and contrast boost):
- static SkScalerContextFlags ComputeScalerContextFlags(const GrColorSpaceInfo&);
+ static SkScalerContextFlags ComputeScalerContextFlags(const GrColorInfo&);
const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAdjustTable.get(); }
diff --git a/src/gpu/text/GrTextTarget.h b/src/gpu/text/GrTextTarget.h
index 87ea5ac..8498d71 100644
--- a/src/gpu/text/GrTextTarget.h
+++ b/src/gpu/text/GrTextTarget.h
@@ -9,7 +9,7 @@
#define GrTextTarget_DEFINED
#include "include/core/SkPaint.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
class GrAtlasTextOp;
class GrClip;
@@ -28,7 +28,7 @@
int height() const { return fHeight; }
- const GrColorSpaceInfo& colorSpaceInfo() const { return fColorSpaceInfo; }
+ const GrColorInfo& colorInfo() const { return fColorInfo; }
virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
@@ -43,14 +43,14 @@
virtual SkGlyphRunListPainter* glyphPainter() = 0;
protected:
- GrTextTarget(int width, int height, const GrColorSpaceInfo& colorSpaceInfo)
- : fWidth(width), fHeight(height), fColorSpaceInfo(colorSpaceInfo) {
- SkASSERT(kPremul_SkAlphaType == colorSpaceInfo.alphaType());
+ GrTextTarget(int width, int height, const GrColorInfo& colorInfo)
+ : fWidth(width), fHeight(height), fColorInfo(colorInfo) {
+ SkASSERT(kPremul_SkAlphaType == colorInfo.alphaType());
}
private:
int fWidth;
int fHeight;
- const GrColorSpaceInfo& fColorSpaceInfo;
+ const GrColorInfo& fColorInfo;
};
#endif // GrTextTarget_DEFINED
diff --git a/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp b/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp
index 971f71d..8f71f3e 100644
--- a/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp
+++ b/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp
@@ -83,13 +83,13 @@
// We current don't support textured GrVkSecondaryCBDrawContexts.
SkASSERT(!rtc->asTextureProxy());
- SkColorType ct = GrColorTypeToSkColorType(rtc->colorSpaceInfo().colorType());
+ SkColorType ct = GrColorTypeToSkColorType(rtc->colorInfo().colorType());
if (ct == kUnknown_SkColorType) {
return false;
}
SkImageInfo ii = SkImageInfo::Make(rtc->width(), rtc->height(), ct, kPremul_SkAlphaType,
- rtc->colorSpaceInfo().refColorSpace());
+ rtc->colorInfo().refColorSpace());
GrBackendFormat format = rtc->asRenderTargetProxy()->backendFormat();
@@ -132,7 +132,7 @@
return false;
}
- SkColorType rtColorType = GrColorTypeToSkColorType(rtc->colorSpaceInfo().colorType());
+ SkColorType rtColorType = GrColorTypeToSkColorType(rtc->colorInfo().colorType());
if (rtColorType == kUnknown_SkColorType) {
return false;
}
@@ -148,8 +148,7 @@
characterization.height() == rtc->height() &&
characterization.colorType() == rtColorType &&
characterization.sampleCount() == rtc->numSamples() &&
- SkColorSpace::Equals(characterization.colorSpace(),
- rtc->colorSpaceInfo().colorSpace()) &&
+ SkColorSpace::Equals(characterization.colorSpace(), rtc->colorInfo().colorSpace()) &&
characterization.isProtected() == isProtected &&
characterization.surfaceProps() == rtc->surfaceProps();
}
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index b979f32..50af596 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -228,7 +228,7 @@
// MDB: this call is okay bc we know 'renderTargetContext' was exact
return sk_make_sp<SkImage_Gpu>(sk_ref_sp(ctx), kNeedNewImageUniqueID, at,
renderTargetContext->asTextureProxyRef(),
- renderTargetContext->colorSpaceInfo().refColorSpace());
+ renderTargetContext->colorInfo().refColorSpace());
}
sk_sp<SkImage> SkImage::MakeFromYUVATexturesCopy(GrContext* ctx,
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 8968f0a..56ce90a 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -193,7 +193,7 @@
bool mipmapped = rtc->asTextureProxy() ? GrMipMapped::kYes == rtc->asTextureProxy()->mipMapped()
: false;
- SkColorType ct = GrColorTypeToSkColorType(rtc->colorSpaceInfo().colorType());
+ SkColorType ct = GrColorTypeToSkColorType(rtc->colorInfo().colorType());
if (ct == kUnknown_SkColorType) {
return false;
}
@@ -204,7 +204,7 @@
SkASSERT(!usesGLFBO0 || !SkToBool(rtc->asTextureProxy()));
SkImageInfo ii = SkImageInfo::Make(rtc->width(), rtc->height(), ct, kPremul_SkAlphaType,
- rtc->colorSpaceInfo().refColorSpace());
+ rtc->colorInfo().refColorSpace());
GrBackendFormat format = rtc->asSurfaceProxy()->backendFormat();
@@ -292,7 +292,7 @@
return false;
}
- SkColorType rtcColorType = GrColorTypeToSkColorType(rtc->colorSpaceInfo().colorType());
+ SkColorType rtcColorType = GrColorTypeToSkColorType(rtc->colorInfo().colorType());
if (rtcColorType == kUnknown_SkColorType) {
return false;
}
@@ -303,12 +303,10 @@
characterization.cacheMaxResourceBytes() <= maxResourceBytes &&
characterization.origin() == rtc->origin() &&
characterization.backendFormat() == rtc->asSurfaceProxy()->backendFormat() &&
- characterization.width() == rtc->width() &&
- characterization.height() == rtc->height() &&
+ characterization.width() == rtc->width() && characterization.height() == rtc->height() &&
characterization.colorType() == rtcColorType &&
characterization.sampleCount() == rtc->numSamples() &&
- SkColorSpace::Equals(characterization.colorSpace(),
- rtc->colorSpaceInfo().colorSpace()) &&
+ SkColorSpace::Equals(characterization.colorSpace(), rtc->colorInfo().colorSpace()) &&
characterization.isProtected() == isProtected &&
characterization.surfaceProps() == rtc->surfaceProps();
}
@@ -563,20 +561,20 @@
SkASSERT(oldTexture->asRenderTarget());
int sampleCnt = oldTexture->asRenderTarget()->numSamples();
GrColorType grColorType = SkColorTypeToGrColorType(this->getCanvas()->imageInfo().colorType());
- auto colorSpace = sk_ref_sp(oldRTC->colorSpaceInfo().colorSpace());
+ auto colorSpace = sk_ref_sp(oldRTC->colorInfo().colorSpace());
if (!validate_backend_texture(context->priv().caps(), backendTexture,
sampleCnt, grColorType, true)) {
return false;
}
- auto rtc = context->priv().makeBackendTextureRenderTargetContext(
- backendTexture,
- origin,
- sampleCnt,
- oldRTC->colorSpaceInfo().colorType(),
- std::move(colorSpace),
- &this->props(),
- releaseProc,
- releaseContext);
+ auto rtc =
+ context->priv().makeBackendTextureRenderTargetContext(backendTexture,
+ origin,
+ sampleCnt,
+ oldRTC->colorInfo().colorType(),
+ std::move(colorSpace),
+ &this->props(),
+ releaseProc,
+ releaseContext);
if (!rtc) {
return false;
}
diff --git a/src/shaders/SkColorFilterShader.cpp b/src/shaders/SkColorFilterShader.cpp
index 64eff11..50bb423 100644
--- a/src/shaders/SkColorFilterShader.cpp
+++ b/src/shaders/SkColorFilterShader.cpp
@@ -58,7 +58,7 @@
return nullptr;
}
- auto fp2 = fFilter->asFragmentProcessor(args.fContext, *args.fDstColorSpaceInfo);
+ auto fp2 = fFilter->asFragmentProcessor(args.fContext, *args.fDstColorInfo);
if (!fp2) {
return fp1;
}
diff --git a/src/shaders/SkColorShader.cpp b/src/shaders/SkColorShader.cpp
index 2820e26..5d40c7b 100644
--- a/src/shaders/SkColorShader.cpp
+++ b/src/shaders/SkColorShader.cpp
@@ -92,21 +92,21 @@
#if SK_SUPPORT_GPU
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/generated/GrConstColorProcessor.h"
std::unique_ptr<GrFragmentProcessor> SkColorShader::asFragmentProcessor(
const GrFPArgs& args) const {
- SkPMColor4f color = SkColorToPMColor4f(fColor, *args.fDstColorSpaceInfo);
+ SkPMColor4f color = SkColorToPMColor4f(fColor, *args.fDstColorInfo);
return GrConstColorProcessor::Make(color, GrConstColorProcessor::InputMode::kModulateA);
}
std::unique_ptr<GrFragmentProcessor> SkColor4Shader::asFragmentProcessor(
const GrFPArgs& args) const {
- SkColorSpaceXformSteps steps{ fColorSpace.get(), kUnpremul_SkAlphaType,
- args.fDstColorSpaceInfo->colorSpace(), kUnpremul_SkAlphaType };
+ SkColorSpaceXformSteps steps{ fColorSpace.get(), kUnpremul_SkAlphaType,
+ args.fDstColorInfo->colorSpace(), kUnpremul_SkAlphaType };
SkColor4f color = fColor;
steps.apply(color.vec());
return GrConstColorProcessor::Make(color.premul(),
diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp
index f263a2d..ae00be4 100644
--- a/src/shaders/SkImageShader.cpp
+++ b/src/shaders/SkImageShader.cpp
@@ -165,7 +165,7 @@
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrBicubicEffect.h"
@@ -251,8 +251,7 @@
}
}
inner = GrColorSpaceXformEffect::Make(std::move(inner), fImage->colorSpace(),
- fImage->alphaType(),
- args.fDstColorSpaceInfo->colorSpace());
+ fImage->alphaType(), args.fDstColorInfo->colorSpace());
if (isAlphaOnly) {
return inner;
} else if (args.fInputColorIsOpaque) {
diff --git a/src/shaders/SkPictureShader.cpp b/src/shaders/SkPictureShader.cpp
index 568c5ff..fc99118 100644
--- a/src/shaders/SkPictureShader.cpp
+++ b/src/shaders/SkPictureShader.cpp
@@ -22,7 +22,7 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/SkGr.h"
@@ -345,19 +345,19 @@
}
auto lm = this->totalLocalMatrix(args.fPreLocalMatrix, args.fPostLocalMatrix);
- SkColorType dstColorType = GrColorTypeToSkColorType(args.fDstColorSpaceInfo->colorType());
+ SkColorType dstColorType = GrColorTypeToSkColorType(args.fDstColorInfo->colorType());
if (dstColorType == kUnknown_SkColorType) {
dstColorType = kRGBA_8888_SkColorType;
}
sk_sp<SkShader> bitmapShader(this->refBitmapShader(*args.fViewMatrix, &lm, dstColorType,
- args.fDstColorSpaceInfo->colorSpace(),
+ args.fDstColorInfo->colorSpace(),
maxTextureSize));
if (!bitmapShader) {
return nullptr;
}
// We want to *reset* args.fPreLocalMatrix, not compose it.
- GrFPArgs newArgs(args.fContext, args.fViewMatrix, args.fFilterQuality, args.fDstColorSpaceInfo);
+ GrFPArgs newArgs(args.fContext, args.fViewMatrix, args.fFilterQuality, args.fDstColorInfo);
newArgs.fPreLocalMatrix = lm.get();
return as_SB(bitmapShader)->asFragmentProcessor(newArgs);
diff --git a/src/shaders/SkRTShader.cpp b/src/shaders/SkRTShader.cpp
index 34dc5a4..bba86a2 100644
--- a/src/shaders/SkRTShader.cpp
+++ b/src/shaders/SkRTShader.cpp
@@ -18,7 +18,7 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
-#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrColorInfo.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/SkGr.h"
diff --git a/src/utils/SkShadowUtils.cpp b/src/utils/SkShadowUtils.cpp
index d9a0a0d..1b47af5 100644
--- a/src/utils/SkShadowUtils.cpp
+++ b/src/utils/SkShadowUtils.cpp
@@ -42,8 +42,8 @@
}
#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const override;
+ std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
+ const GrColorInfo&) const override;
#endif
protected:
@@ -67,7 +67,7 @@
#if SK_SUPPORT_GPU
std::unique_ptr<GrFragmentProcessor> SkGaussianColorFilter::asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const {
+ GrRecordingContext*, const GrColorInfo&) const {
return GrBlurredEdgeFragmentProcessor::Make(GrBlurredEdgeFragmentProcessor::Mode::kGaussian);
}
#endif
diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp
index 168ea01..f4a252b 100644
--- a/tests/PremulAlphaRoundTripTest.cpp
+++ b/tests/PremulAlphaRoundTripTest.cpp
@@ -54,8 +54,7 @@
}
}
- const SkImageInfo info = SkImageInfo::Make(bmp.width(), bmp.height(),
- colorType, kUnpremul_SkAlphaType);
+ const SkImageInfo info = SkImageInfo::Make(bmp.dimensions(), colorType, kUnpremul_SkAlphaType);
surf->writePixels({info, bmp.getPixels(), bmp.rowBytes()}, 0, 0);
}
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 2f76291..f80748d 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -276,7 +276,7 @@
static void init_bitmap(SkBitmap* bitmap, const SkIRect& rect, BitmapInit init, SkColorType ct,
SkAlphaType at) {
- SkImageInfo info = SkImageInfo::Make(rect.width(), rect.height(), ct, at);
+ SkImageInfo info = SkImageInfo::Make(rect.size(), ct, at);
size_t rowBytes = 0;
switch (init) {
case kTight_BitmapInit:
@@ -706,8 +706,7 @@
SkAutoPixmapStorage result;
Context context;
context.fPixmap = &result;
- info = SkImageInfo::Make(rect.width(), rect.height(), readCT,
- kPremul_SkAlphaType, readCS);
+ info = SkImageInfo::Make(rect.size(), readCT, kPremul_SkAlphaType, readCS);
result.alloc(info);
memset(result.writable_addr(), 0xAB, result.computeByteSize());
// Rescale quality and linearity don't matter since we're doing a non-
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index ce45cd0..0a382c8 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -693,8 +693,8 @@
SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE };
sk_sp<SkShader> shader = SkGradientShader::MakeLinear(
pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkTileMode::kClamp);
- GrColorSpaceInfo colorSpaceInfo(GrColorType::kRGBA_8888, kPremul_SkAlphaType, nullptr);
- GrFPArgs args(ctx, &SkMatrix::I(), SkFilterQuality::kLow_SkFilterQuality, &colorSpaceInfo);
+ GrColorInfo colorInfo(GrColorType::kRGBA_8888, kPremul_SkAlphaType, nullptr);
+ GrFPArgs args(ctx, &SkMatrix::I(), SkFilterQuality::kLow_SkFilterQuality, &colorInfo);
return as_SB(shader)->asFragmentProcessor(args);
}
diff --git a/tools/debugger/DrawCommand.cpp b/tools/debugger/DrawCommand.cpp
index 31f7e63..7571a48 100644
--- a/tools/debugger/DrawCommand.cpp
+++ b/tools/debugger/DrawCommand.cpp
@@ -676,7 +676,7 @@
size_t rowBytes = 4 * image.width();
SkAutoMalloc buffer(rowBytes * image.height());
SkImageInfo dstInfo =
- SkImageInfo::Make(image.width(), image.height(), kN32_SkColorType, kPremul_SkAlphaType);
+ SkImageInfo::Make(image.dimensions(), kN32_SkColorType, kPremul_SkAlphaType);
if (!image.readPixels(dstInfo, buffer.get(), rowBytes, 0, 0)) {
SkDebugf("readPixels failed\n");
return false;
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index f2dbab0..ef1934e 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -139,8 +139,8 @@
auto colorSpace = kRGBA_F16_SkColorType == cap.fColorType
? SkColorSpace::MakeSRGBLinear()
: SkColorSpace::MakeSRGB();
- SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(), cap.fColorType,
- kPremul_SkAlphaType, cap.fSRGB ? colorSpace : nullptr);
+ SkImageInfo info = SkImageInfo::Make(bounds.size(), cap.fColorType, kPremul_SkAlphaType,
+ cap.fSRGB ? colorSpace : nullptr);
return SkSurface::MakeRaster(info).release();
}
@@ -151,8 +151,8 @@
auto colorSpace = kRGBA_F16_SkColorType == cap.fColorType
? SkColorSpace::MakeSRGBLinear()
: SkColorSpace::MakeSRGB();
- SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(), cap.fColorType,
- kPremul_SkAlphaType, cap.fSRGB ? colorSpace: nullptr);
+ SkImageInfo info = SkImageInfo::Make(bounds.size(), cap.fColorType, kPremul_SkAlphaType,
+ cap.fSRGB ? colorSpace : nullptr);
SkSurface* surface = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info).release();
return surface;
}
diff --git a/tools/skqp/src/skqp_model.cpp b/tools/skqp/src/skqp_model.cpp
index c9779fe..230a14f 100644
--- a/tools/skqp/src/skqp_model.cpp
+++ b/tools/skqp/src/skqp_model.cpp
@@ -91,8 +91,7 @@
if (auto codec = SkCodec::MakeFromData(std::move(data))) {
SkISize size = codec->getInfo().dimensions();
SkASSERT(!size.isEmpty());
- SkImageInfo info = SkImageInfo::Make(size.width(), size.height(),
- skqp::kColorType, skqp::kAlphaType);
+ SkImageInfo info = SkImageInfo::Make(size, skqp::kColorType, skqp::kAlphaType);
bitmap.allocPixels(info);
if (SkCodec::kSuccess != codec->getPixels(bitmap.pixmap())) {
bitmap.reset();