Revert of More removal of SkColorProfileType... (patchset #2 id:20001 of https://codereview.chromium.org/2071393002/ )
Reason for revert: This was still used in chrome Original issue's description: > More removal of SkColorProfileType... > > Scrub GMs. Remove the gDefaultProfile thing (it's unused now), along with > the command line flag that was setting it in DM and nanobench. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2071393002 > > Committed: https://skia.googlesource.com/skia/+/944876f2745a62a839e49275daf93a0329372e67 TBR=msarett@google.com,reed@google.com,bsalomon@google.com,brianosman@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2074103004
This commit is contained in:
parent
992a22d2e9
commit
802acec187
@ -1025,6 +1025,8 @@ static void start_keepalive() {
|
|||||||
intentionallyLeaked->start();
|
intentionallyLeaked->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bool gDefaultProfileIsSRGB;
|
||||||
|
|
||||||
int nanobench_main();
|
int nanobench_main();
|
||||||
int nanobench_main() {
|
int nanobench_main() {
|
||||||
SetupCrashHandler();
|
SetupCrashHandler();
|
||||||
@ -1036,6 +1038,10 @@ int nanobench_main() {
|
|||||||
gGrFactory.reset(new GrContextFactory(grContextOpts));
|
gGrFactory.reset(new GrContextFactory(grContextOpts));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (FLAGS_forceSRGB) {
|
||||||
|
gDefaultProfileIsSRGB = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (FLAGS_veryVerbose) {
|
if (FLAGS_veryVerbose) {
|
||||||
FLAGS_verbose = true;
|
FLAGS_verbose = true;
|
||||||
}
|
}
|
||||||
|
@ -1248,6 +1248,8 @@ static sk_sp<SkTypeface> create_from_name(const char familyName[], SkFontStyle s
|
|||||||
|
|
||||||
extern sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char [], SkFontStyle );
|
extern sk_sp<SkTypeface> (*gCreateTypefaceDelegate)(const char [], SkFontStyle );
|
||||||
|
|
||||||
|
extern bool gDefaultProfileIsSRGB;
|
||||||
|
|
||||||
int dm_main();
|
int dm_main();
|
||||||
int dm_main() {
|
int dm_main() {
|
||||||
setbuf(stdout, nullptr);
|
setbuf(stdout, nullptr);
|
||||||
@ -1260,6 +1262,10 @@ int dm_main() {
|
|||||||
gVLog = freopen(SkOSPath::Join(FLAGS_writePath[0], "verbose.log").c_str(), "w", stderr);
|
gVLog = freopen(SkOSPath::Join(FLAGS_writePath[0], "verbose.log").c_str(), "w", stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FLAGS_forceSRGB) {
|
||||||
|
gDefaultProfileIsSRGB = true;
|
||||||
|
}
|
||||||
|
|
||||||
JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
|
JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
|
||||||
SkAutoGraphics ag;
|
SkAutoGraphics ag;
|
||||||
SkTaskGroup::Enabler enabled(FLAGS_threads);
|
SkTaskGroup::Enabler enabled(FLAGS_threads);
|
||||||
|
@ -55,7 +55,7 @@ static void draw_rect_orig(SkCanvas* canvas, const SkRect& r, SkColor c, const S
|
|||||||
SkPixmap pmdst;
|
SkPixmap pmdst;
|
||||||
bmdst.peekPixels(&pmdst);
|
bmdst.peekPixels(&pmdst);
|
||||||
|
|
||||||
SkImageInfo info = SkImageInfo::MakeN32Premul(ir.width(), ir.height());
|
SkImageInfo info = SkImageInfo::MakeN32Premul(ir.width(), ir.height(), kLinear_SkColorProfileType);
|
||||||
|
|
||||||
sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pmsrc.addr32(), pmsrc.rowBytes())));
|
sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pmsrc.addr32(), pmsrc.rowBytes())));
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
@ -113,6 +113,9 @@ static void draw_rect_fp(SkCanvas* canvas, const SkRect& r, SkColor c, const SkM
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
|
//if (kSRGB_SkColorProfileType == profile) {
|
||||||
|
//flags |= SkXfermode::kDstIsSRGB_PM4fFlag;
|
||||||
|
//}
|
||||||
auto procN = SkXfermode::GetD32Proc(nullptr, flags);
|
auto procN = SkXfermode::GetD32Proc(nullptr, flags);
|
||||||
|
|
||||||
SkLinearBitmapPipeline pipeline{
|
SkLinearBitmapPipeline pipeline{
|
||||||
|
@ -246,13 +246,13 @@ static uint32_t make_pixel(int x, int y, SkAlphaType alphaType) {
|
|||||||
static void make_color_test_bitmap_variant(
|
static void make_color_test_bitmap_variant(
|
||||||
SkColorType colorType,
|
SkColorType colorType,
|
||||||
SkAlphaType alphaType,
|
SkAlphaType alphaType,
|
||||||
sk_sp<SkColorSpace> colorSpace,
|
SkColorProfileType profile,
|
||||||
SkBitmap* bm)
|
SkBitmap* bm)
|
||||||
{
|
{
|
||||||
SkASSERT(colorType == kRGBA_8888_SkColorType || colorType == kBGRA_8888_SkColorType);
|
SkASSERT(colorType == kRGBA_8888_SkColorType || colorType == kBGRA_8888_SkColorType);
|
||||||
SkASSERT(alphaType == kPremul_SkAlphaType || alphaType == kUnpremul_SkAlphaType);
|
SkASSERT(alphaType == kPremul_SkAlphaType || alphaType == kUnpremul_SkAlphaType);
|
||||||
bm->allocPixels(
|
bm->allocPixels(
|
||||||
SkImageInfo::Make(SCALE, SCALE, colorType, alphaType, colorSpace));
|
SkImageInfo::Make(SCALE, SCALE, colorType, alphaType, profile));
|
||||||
SkPixmap pm;
|
SkPixmap pm;
|
||||||
bm->peekPixels(&pm);
|
bm->peekPixels(&pm);
|
||||||
for (int y = 0; y < bm->height(); y++) {
|
for (int y = 0; y < bm->height(); y++) {
|
||||||
@ -265,17 +265,13 @@ static void make_color_test_bitmap_variant(
|
|||||||
DEF_SIMPLE_GM(all_variants_8888, canvas, 4 * SCALE + 30, 2 * SCALE + 10) {
|
DEF_SIMPLE_GM(all_variants_8888, canvas, 4 * SCALE + 30, 2 * SCALE + 10) {
|
||||||
sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
|
sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
|
||||||
|
|
||||||
sk_sp<SkColorSpace> colorSpaces[] {
|
for (auto profile : {kSRGB_SkColorProfileType, kLinear_SkColorProfileType}) {
|
||||||
nullptr,
|
|
||||||
SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named)
|
|
||||||
};
|
|
||||||
for (auto colorSpace : colorSpaces) {
|
|
||||||
canvas->save();
|
canvas->save();
|
||||||
for (auto alphaType : {kPremul_SkAlphaType, kUnpremul_SkAlphaType}) {
|
for (auto alphaType : {kPremul_SkAlphaType, kUnpremul_SkAlphaType}) {
|
||||||
canvas->save();
|
canvas->save();
|
||||||
for (auto colorType : {kRGBA_8888_SkColorType, kBGRA_8888_SkColorType}) {
|
for (auto colorType : {kRGBA_8888_SkColorType, kBGRA_8888_SkColorType}) {
|
||||||
SkBitmap bm;
|
SkBitmap bm;
|
||||||
make_color_test_bitmap_variant(colorType, alphaType, colorSpace, &bm);
|
make_color_test_bitmap_variant(colorType, alphaType, profile, &bm);
|
||||||
canvas->drawBitmap(bm, 0.0f, 0.0f);
|
canvas->drawBitmap(bm, 0.0f, 0.0f);
|
||||||
canvas->translate(SCALE + 10, 0.0f);
|
canvas->translate(SCALE + 10, 0.0f);
|
||||||
}
|
}
|
||||||
|
@ -73,13 +73,10 @@ DEF_SIMPLE_GM(color4f, canvas, 1024, 260) {
|
|||||||
// even if it holds sRGB values.
|
// even if it holds sRGB values.
|
||||||
bg.setColor(0xFFFFFFFF);
|
bg.setColor(0xFFFFFFFF);
|
||||||
|
|
||||||
sk_sp<SkColorSpace> colorSpaces[]{
|
SkColorProfileType const profiles[] { kLinear_SkColorProfileType, kSRGB_SkColorProfileType };
|
||||||
nullptr,
|
for (auto profile : profiles) {
|
||||||
SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named)
|
|
||||||
};
|
|
||||||
for (auto colorSpace : colorSpaces) {
|
|
||||||
const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType, kPremul_SkAlphaType,
|
const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType, kPremul_SkAlphaType,
|
||||||
colorSpace);
|
profile);
|
||||||
auto surface(SkSurface::MakeRaster(info));
|
auto surface(SkSurface::MakeRaster(info));
|
||||||
surface->getCanvas()->drawPaint(bg);
|
surface->getCanvas()->drawPaint(bg);
|
||||||
draw_into_canvas(surface->getCanvas());
|
draw_into_canvas(surface->getCanvas());
|
||||||
|
@ -48,9 +48,8 @@ protected:
|
|||||||
// set up offscreen rendering with distance field text
|
// set up offscreen rendering with distance field text
|
||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
GrContext* ctx = inputCanvas->getGrContext();
|
GrContext* ctx = inputCanvas->getGrContext();
|
||||||
SkISize size = onISize();
|
SkImageInfo info = SkImageInfo::MakeN32Premul(onISize(),
|
||||||
SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType,
|
inputCanvas->imageInfo().profileType());
|
||||||
sk_ref_sp(inputCanvas->imageInfo().colorSpace()));
|
|
||||||
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
uint32_t gammaCorrect = inputCanvas->getProps(&canvasProps)
|
uint32_t gammaCorrect = inputCanvas->getProps(&canvasProps)
|
||||||
? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0;
|
? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0;
|
||||||
|
@ -18,7 +18,6 @@ DEF_SIMPLE_GM(gamma, canvas, 560, 200) {
|
|||||||
const SkScalar tx = sz + 5.0f;
|
const SkScalar tx = sz + 5.0f;
|
||||||
const SkRect r = SkRect::MakeXYWH(0, 0, sz, sz);
|
const SkRect r = SkRect::MakeXYWH(0, 0, sz, sz);
|
||||||
SkShader::TileMode rpt = SkShader::kRepeat_TileMode;
|
SkShader::TileMode rpt = SkShader::kRepeat_TileMode;
|
||||||
auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
|
|
||||||
|
|
||||||
SkBitmap ditherBmp;
|
SkBitmap ditherBmp;
|
||||||
ditherBmp.allocN32Pixels(2, 2);
|
ditherBmp.allocN32Pixels(2, 2);
|
||||||
@ -27,20 +26,21 @@ DEF_SIMPLE_GM(gamma, canvas, 560, 200) {
|
|||||||
pixels[1] = pixels[2] = SkPackARGB32(0xFF, 0, 0, 0);
|
pixels[1] = pixels[2] = SkPackARGB32(0xFF, 0, 0, 0);
|
||||||
|
|
||||||
SkBitmap linearGreyBmp;
|
SkBitmap linearGreyBmp;
|
||||||
SkImageInfo linearGreyInfo = SkImageInfo::MakeN32(szInt, szInt, kOpaque_SkAlphaType, nullptr);
|
SkImageInfo linearGreyInfo = SkImageInfo::MakeN32(szInt, szInt, kOpaque_SkAlphaType,
|
||||||
|
kLinear_SkColorProfileType);
|
||||||
linearGreyBmp.allocPixels(linearGreyInfo);
|
linearGreyBmp.allocPixels(linearGreyInfo);
|
||||||
linearGreyBmp.eraseARGB(0xFF, 0x7F, 0x7F, 0x7F);
|
linearGreyBmp.eraseARGB(0xFF, 0x7F, 0x7F, 0x7F);
|
||||||
|
|
||||||
SkBitmap srgbGreyBmp;
|
SkBitmap srgbGreyBmp;
|
||||||
SkImageInfo srgbGreyInfo = SkImageInfo::MakeN32(szInt, szInt, kOpaque_SkAlphaType,
|
SkImageInfo srgbGreyInfo = SkImageInfo::MakeN32(szInt, szInt, kOpaque_SkAlphaType,
|
||||||
srgbColorSpace);
|
kSRGB_SkColorProfileType);
|
||||||
srgbGreyBmp.allocPixels(srgbGreyInfo);
|
srgbGreyBmp.allocPixels(srgbGreyInfo);
|
||||||
// 0xBC = 255 * linear_to_srgb(0.5f)
|
// 0xBC = 255 * linear_to_srgb(0.5f)
|
||||||
srgbGreyBmp.eraseARGB(0xFF, 0xBC, 0xBC, 0xBC);
|
srgbGreyBmp.eraseARGB(0xFF, 0xBC, 0xBC, 0xBC);
|
||||||
|
|
||||||
SkBitmap mipmapBmp;
|
SkBitmap mipmapBmp;
|
||||||
SkImageInfo mipmapInfo = SkImageInfo::Make(2, 2, kN32_SkColorType, kOpaque_SkAlphaType,
|
SkImageInfo mipmapInfo = SkImageInfo::Make(2, 2, kN32_SkColorType, kOpaque_SkAlphaType,
|
||||||
srgbColorSpace);
|
SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named));
|
||||||
mipmapBmp.allocPixels(mipmapInfo);
|
mipmapBmp.allocPixels(mipmapInfo);
|
||||||
SkPMColor* mipmapPixels = reinterpret_cast<SkPMColor*>(mipmapBmp.getPixels());
|
SkPMColor* mipmapPixels = reinterpret_cast<SkPMColor*>(mipmapBmp.getPixels());
|
||||||
unsigned s25 = 0x89; // 255 * linear_to_srgb(0.25f)
|
unsigned s25 = 0x89; // 255 * linear_to_srgb(0.25f)
|
||||||
|
@ -78,7 +78,7 @@ protected:
|
|||||||
|
|
||||||
// must be opaque to have a hope of testing LCD text
|
// must be opaque to have a hope of testing LCD text
|
||||||
const SkImageInfo info = SkImageInfo::MakeN32(W, H, kOpaque_SkAlphaType,
|
const SkImageInfo info = SkImageInfo::MakeN32(W, H, kOpaque_SkAlphaType,
|
||||||
sk_ref_sp(canvas->imageInfo().colorSpace()));
|
canvas->imageInfo().profileType());
|
||||||
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
bool gammaCorrect = canvas->getProps(&canvasProps) && canvasProps.isGammaCorrect();
|
bool gammaCorrect = canvas->getProps(&canvasProps) && canvasProps.isGammaCorrect();
|
||||||
|
|
||||||
|
@ -42,8 +42,7 @@ protected:
|
|||||||
|
|
||||||
SkAutoTUnref<const SkTextBlob> blob(builder.build());
|
SkAutoTUnref<const SkTextBlob> blob(builder.build());
|
||||||
|
|
||||||
SkImageInfo info = SkImageInfo::MakeN32(200, 200, kPremul_SkAlphaType,
|
SkImageInfo info = SkImageInfo::MakeN32Premul(200, 200, canvas->imageInfo().profileType());
|
||||||
sk_ref_sp(canvas->imageInfo().colorSpace()));
|
|
||||||
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
uint32_t gammaCorrect = canvas->getProps(&canvasProps)
|
uint32_t gammaCorrect = canvas->getProps(&canvasProps)
|
||||||
? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0;
|
? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0;
|
||||||
|
@ -102,10 +102,8 @@ protected:
|
|||||||
#if SK_SUPPORT_GPU
|
#if SK_SUPPORT_GPU
|
||||||
// Create a new Canvas to enable DFT
|
// Create a new Canvas to enable DFT
|
||||||
GrContext* ctx = inputCanvas->getGrContext();
|
GrContext* ctx = inputCanvas->getGrContext();
|
||||||
SkISize size = onISize();
|
SkImageInfo info = SkImageInfo::MakeN32Premul(onISize(),
|
||||||
sk_sp<SkColorSpace> colorSpace = sk_ref_sp(inputCanvas->imageInfo().colorSpace());
|
inputCanvas->imageInfo().profileType());
|
||||||
SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(),
|
|
||||||
kPremul_SkAlphaType, colorSpace);
|
|
||||||
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
uint32_t gammaCorrect = inputCanvas->getProps(&canvasProps)
|
uint32_t gammaCorrect = inputCanvas->getProps(&canvasProps)
|
||||||
? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0;
|
? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0;
|
||||||
|
@ -97,8 +97,8 @@ protected:
|
|||||||
|
|
||||||
canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE));
|
canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE));
|
||||||
|
|
||||||
SkImageInfo info = SkImageInfo::MakeN32(kWidth, kHeight, kPremul_SkAlphaType,
|
SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight,
|
||||||
sk_ref_sp(canvas->imageInfo().colorSpace()));
|
canvas->imageInfo().profileType());
|
||||||
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
uint32_t gammaCorrect = canvas->getProps(&canvasProps)
|
uint32_t gammaCorrect = canvas->getProps(&canvasProps)
|
||||||
? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0;
|
? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0;
|
||||||
|
@ -126,7 +126,7 @@ private:
|
|||||||
GrContext* context = baseCanvas->getGrContext();
|
GrContext* context = baseCanvas->getGrContext();
|
||||||
SkImageInfo baseInfo = baseCanvas->imageInfo();
|
SkImageInfo baseInfo = baseCanvas->imageInfo();
|
||||||
SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInfo.alphaType(),
|
SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInfo.alphaType(),
|
||||||
sk_ref_sp(baseInfo.colorSpace()));
|
baseInfo.profileType());
|
||||||
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
baseCanvas->getProps(&canvasProps);
|
baseCanvas->getProps(&canvasProps);
|
||||||
return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, &canvasProps);
|
return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, &canvasProps);
|
||||||
|
@ -421,6 +421,7 @@
|
|||||||
'<(skia_include_path)/private/SkFloatBits.h',
|
'<(skia_include_path)/private/SkFloatBits.h',
|
||||||
'<(skia_include_path)/private/SkFloatingPoint.h',
|
'<(skia_include_path)/private/SkFloatingPoint.h',
|
||||||
'<(skia_include_path)/private/SkGpuFenceSync.h',
|
'<(skia_include_path)/private/SkGpuFenceSync.h',
|
||||||
|
'<(skia_include_path)/private/SkImageInfoPriv.h',
|
||||||
'<(skia_include_path)/private/SkMiniRecorder.h',
|
'<(skia_include_path)/private/SkMiniRecorder.h',
|
||||||
'<(skia_include_path)/private/SkMutex.h',
|
'<(skia_include_path)/private/SkMutex.h',
|
||||||
'<(skia_include_path)/private/SkOnce.h',
|
'<(skia_include_path)/private/SkOnce.h',
|
||||||
|
@ -86,6 +86,9 @@ public:
|
|||||||
SkColorType colorType() const { return fInfo.colorType(); }
|
SkColorType colorType() const { return fInfo.colorType(); }
|
||||||
SkAlphaType alphaType() const { return fInfo.alphaType(); }
|
SkAlphaType alphaType() const { return fInfo.alphaType(); }
|
||||||
SkColorSpace* colorSpace() const { return fInfo.colorSpace(); }
|
SkColorSpace* colorSpace() const { return fInfo.colorSpace(); }
|
||||||
|
#ifdef SK_SUPPORT_LEGACY_COLORPROFILETYPE
|
||||||
|
SkColorProfileType profileType() const { return fInfo.profileType(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of bytes per pixel based on the colortype. If the colortype is
|
* Return the number of bytes per pixel based on the colortype. If the colortype is
|
||||||
|
14
include/private/SkImageInfoPriv.h
Normal file
14
include/private/SkImageInfoPriv.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Google Inc.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license that can be
|
||||||
|
* found in the LICENSE file.
|
||||||
|
*/
|
||||||
|
#ifndef SkImageInfoPriv_DEFINED
|
||||||
|
#define SkImageInfoPriv_DEFINED
|
||||||
|
|
||||||
|
#include "SkImageInfo.h"
|
||||||
|
|
||||||
|
SK_API SkColorProfileType SkDefaultColorProfile();
|
||||||
|
|
||||||
|
#endif // SkImageInfoPriv_DEFINED
|
@ -1177,7 +1177,6 @@ static SkImageInfo make_layer_info(const SkImageInfo& prev, int w, int h, bool i
|
|||||||
const SkPaint* paint) {
|
const SkPaint* paint) {
|
||||||
// need to force L32 for now if we have an image filter. Once filters support other colortypes
|
// need to force L32 for now if we have an image filter. Once filters support other colortypes
|
||||||
// e.g. sRGB or F16, we can remove this check
|
// e.g. sRGB or F16, we can remove this check
|
||||||
// SRGBTODO: Can we remove this check now?
|
|
||||||
const bool hasImageFilter = paint && paint->getImageFilter();
|
const bool hasImageFilter = paint && paint->getImageFilter();
|
||||||
|
|
||||||
SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
|
SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
|
||||||
@ -1186,7 +1185,7 @@ static SkImageInfo make_layer_info(const SkImageInfo& prev, int w, int h, bool i
|
|||||||
return SkImageInfo::MakeN32(w, h, alphaType);
|
return SkImageInfo::MakeN32(w, h, alphaType);
|
||||||
} else {
|
} else {
|
||||||
// keep the same characteristics as the prev
|
// keep the same characteristics as the prev
|
||||||
return SkImageInfo::Make(w, h, prev.colorType(), alphaType, sk_ref_sp(prev.colorSpace()));
|
return SkImageInfo::Make(w, h, prev.colorType(), alphaType, prev.profileType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SkImageInfo.h"
|
#include "SkImageInfo.h"
|
||||||
|
#include "SkImageInfoPriv.h"
|
||||||
#include "SkReadBuffer.h"
|
#include "SkReadBuffer.h"
|
||||||
#include "SkWriteBuffer.h"
|
#include "SkWriteBuffer.h"
|
||||||
|
|
||||||
@ -60,6 +61,14 @@ SkColorProfileType SkImageInfo::profileType() const {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Indicate how images and gradients should interpret colors by default.
|
||||||
|
bool gDefaultProfileIsSRGB;
|
||||||
|
|
||||||
|
SkColorProfileType SkDefaultColorProfile() {
|
||||||
|
return gDefaultProfileIsSRGB ? kSRGB_SkColorProfileType
|
||||||
|
: kLinear_SkColorProfileType;
|
||||||
|
}
|
||||||
|
|
||||||
static bool alpha_type_is_valid(SkAlphaType alphaType) {
|
static bool alpha_type_is_valid(SkAlphaType alphaType) {
|
||||||
return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType);
|
return (alphaType >= 0) && (alphaType <= kLastEnum_SkAlphaType);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ void GrContext::flush(int flagsBitfield) {
|
|||||||
bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t inRowBytes,
|
bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t inRowBytes,
|
||||||
const void* inPixels, size_t outRowBytes, void* outPixels) {
|
const void* inPixels, size_t outRowBytes, void* outPixels) {
|
||||||
SkSrcPixelInfo srcPI;
|
SkSrcPixelInfo srcPI;
|
||||||
if (!GrPixelConfigToColorAndColorSpace(srcConfig, &srcPI.fColorType, nullptr)) {
|
if (!GrPixelConfig2ColorAndProfileType(srcConfig, &srcPI.fColorType, nullptr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
srcPI.fAlphaType = kUnpremul_SkAlphaType;
|
srcPI.fAlphaType = kUnpremul_SkAlphaType;
|
||||||
@ -511,7 +511,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
|
|||||||
// Perform umpremul conversion if we weren't able to perform it as a draw.
|
// Perform umpremul conversion if we weren't able to perform it as a draw.
|
||||||
if (unpremul) {
|
if (unpremul) {
|
||||||
SkDstPixelInfo dstPI;
|
SkDstPixelInfo dstPI;
|
||||||
if (!GrPixelConfigToColorAndColorSpace(dstConfig, &dstPI.fColorType, nullptr)) {
|
if (!GrPixelConfig2ColorAndProfileType(dstConfig, &dstPI.fColorType, nullptr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
dstPI.fAlphaType = kUnpremul_SkAlphaType;
|
dstPI.fAlphaType = kUnpremul_SkAlphaType;
|
||||||
|
@ -118,11 +118,12 @@ bool GrSurface::readPixels(int left, int top, int width, int height,
|
|||||||
|
|
||||||
SkImageInfo GrSurface::info(SkAlphaType alphaType) const {
|
SkImageInfo GrSurface::info(SkAlphaType alphaType) const {
|
||||||
SkColorType colorType;
|
SkColorType colorType;
|
||||||
sk_sp<SkColorSpace> colorSpace;
|
SkColorProfileType profileType;
|
||||||
if (!GrPixelConfigToColorAndColorSpace(this->config(), &colorType, &colorSpace)) {
|
if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileType)) {
|
||||||
sk_throw();
|
sk_throw();
|
||||||
}
|
}
|
||||||
return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType, colorSpace);
|
return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType,
|
||||||
|
profileType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This should probably be a non-member helper function. It might only be needed in
|
// TODO: This should probably be a non-member helper function. It might only be needed in
|
||||||
|
@ -453,10 +453,10 @@ GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, const SkCol
|
|||||||
return kUnknown_GrPixelConfig;
|
return kUnknown_GrPixelConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GrPixelConfigToColorAndColorSpace(GrPixelConfig config, SkColorType* ctOut,
|
bool GrPixelConfig2ColorAndProfileType(GrPixelConfig config, SkColorType* ctOut,
|
||||||
sk_sp<SkColorSpace>* csOut) {
|
SkColorProfileType* ptOut) {
|
||||||
SkColorType ct;
|
SkColorType ct;
|
||||||
sk_sp<SkColorSpace> cs = nullptr;
|
SkColorProfileType pt = kLinear_SkColorProfileType;
|
||||||
switch (config) {
|
switch (config) {
|
||||||
case kAlpha_8_GrPixelConfig:
|
case kAlpha_8_GrPixelConfig:
|
||||||
ct = kAlpha_8_SkColorType;
|
ct = kAlpha_8_SkColorType;
|
||||||
@ -478,11 +478,11 @@ bool GrPixelConfigToColorAndColorSpace(GrPixelConfig config, SkColorType* ctOut,
|
|||||||
break;
|
break;
|
||||||
case kSRGBA_8888_GrPixelConfig:
|
case kSRGBA_8888_GrPixelConfig:
|
||||||
ct = kRGBA_8888_SkColorType;
|
ct = kRGBA_8888_SkColorType;
|
||||||
cs = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
|
pt = kSRGB_SkColorProfileType;
|
||||||
break;
|
break;
|
||||||
case kSBGRA_8888_GrPixelConfig:
|
case kSBGRA_8888_GrPixelConfig:
|
||||||
ct = kBGRA_8888_SkColorType;
|
ct = kBGRA_8888_SkColorType;
|
||||||
cs = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
|
pt = kSRGB_SkColorProfileType;
|
||||||
break;
|
break;
|
||||||
case kRGBA_half_GrPixelConfig:
|
case kRGBA_half_GrPixelConfig:
|
||||||
ct = kRGBA_F16_SkColorType;
|
ct = kRGBA_F16_SkColorType;
|
||||||
@ -493,8 +493,8 @@ bool GrPixelConfigToColorAndColorSpace(GrPixelConfig config, SkColorType* ctOut,
|
|||||||
if (ctOut) {
|
if (ctOut) {
|
||||||
*ctOut = ct;
|
*ctOut = ct;
|
||||||
}
|
}
|
||||||
if (csOut) {
|
if (ptOut) {
|
||||||
*csOut = cs;
|
*ptOut = pt;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -724,9 +724,9 @@ SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) {
|
|||||||
SkASSERT(h <= desc.fHeight);
|
SkASSERT(h <= desc.fHeight);
|
||||||
#endif
|
#endif
|
||||||
const GrPixelConfig config = tex->config();
|
const GrPixelConfig config = tex->config();
|
||||||
SkColorType ct = kUnknown_SkColorType;
|
SkColorType ct;
|
||||||
SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
|
SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
|
||||||
if (!GrPixelConfigToColorAndColorSpace(config, &ct, nullptr)) {
|
if (!GrPixelConfig2ColorAndProfileType(config, &ct, nullptr)) {
|
||||||
ct = kUnknown_SkColorType;
|
ct = kUnknown_SkColorType;
|
||||||
}
|
}
|
||||||
return SkImageInfo::Make(w, h, ct, at);
|
return SkImageInfo::Make(w, h, ct, at);
|
||||||
|
@ -102,7 +102,7 @@ bool SkPaintToGrPaintWithTexture(GrContext* context,
|
|||||||
|
|
||||||
GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&);
|
GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&);
|
||||||
|
|
||||||
bool GrPixelConfigToColorAndColorSpace(GrPixelConfig, SkColorType*, sk_sp<SkColorSpace>*);
|
bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfileType*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the compressed data in the SkData is supported (as a texture format, this returns
|
* If the compressed data in the SkData is supported (as a texture format, this returns
|
||||||
|
@ -13,6 +13,8 @@ DEFINE_bool(cpu, true, "master switch for running CPU-bound work.");
|
|||||||
DEFINE_bool(dryRun, false,
|
DEFINE_bool(dryRun, false,
|
||||||
"just print the tests that would be run, without actually running them.");
|
"just print the tests that would be run, without actually running them.");
|
||||||
|
|
||||||
|
DEFINE_bool(forceSRGB, false, "Force SRGB for imageinfos");
|
||||||
|
|
||||||
DEFINE_bool(gpu, true, "master switch for running GPU-bound work.");
|
DEFINE_bool(gpu, true, "master switch for running GPU-bound work.");
|
||||||
|
|
||||||
DEFINE_string(images, "", "List of images and/or directories to decode. A directory with no images"
|
DEFINE_string(images, "", "List of images and/or directories to decode. A directory with no images"
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
DECLARE_bool(cpu);
|
DECLARE_bool(cpu);
|
||||||
DECLARE_bool(dryRun);
|
DECLARE_bool(dryRun);
|
||||||
|
DECLARE_bool(forceSRGB);
|
||||||
DECLARE_bool(gpu);
|
DECLARE_bool(gpu);
|
||||||
DECLARE_string(images);
|
DECLARE_string(images);
|
||||||
DECLARE_string(colorImages);
|
DECLARE_string(colorImages);
|
||||||
|
Loading…
Reference in New Issue
Block a user