Merge "Remove references to ANDROID_ENABLE_LINEAR_BLENDING"
This commit is contained in:
committed by
Android (Google) Code Review
commit
fb0699062a
@@ -27,10 +27,6 @@ cc_library_shared {
|
||||
"-Wno-error=deprecated-declarations",
|
||||
"-Wunused",
|
||||
"-Wunreachable-code",
|
||||
|
||||
// TODO: Linear blending should be enabled by default, but we are
|
||||
// TODO: making it an opt-in while it's a work in progress
|
||||
//"-DANDROID_ENABLE_LINEAR_BLENDING",
|
||||
],
|
||||
|
||||
cppflags: ["-Wno-conversion-null"],
|
||||
|
||||
@@ -28,10 +28,6 @@ cc_defaults {
|
||||
|
||||
// clang's warning is broken, see: https://llvm.org/bugs/show_bug.cgi?id=21629
|
||||
"-Wno-missing-braces",
|
||||
|
||||
// TODO: Linear blending should be enabled by default, but we are
|
||||
// TODO: making it an opt-in while it's a work in progress
|
||||
//"-DANDROID_ENABLE_LINEAR_BLENDING",
|
||||
],
|
||||
|
||||
include_dirs: [
|
||||
|
||||
@@ -116,7 +116,6 @@ struct FormatInfo {
|
||||
|
||||
static FormatInfo determineFormat(const SkBitmap& skBitmap) {
|
||||
FormatInfo formatInfo;
|
||||
// TODO: add support for linear blending (when ANDROID_ENABLE_LINEAR_BLENDING is defined)
|
||||
switch (skBitmap.info().colorType()) {
|
||||
case kRGBA_8888_SkColorType:
|
||||
formatInfo.isSupported = true;
|
||||
|
||||
@@ -606,12 +606,7 @@ void Tree::updateBitmapCache(Bitmap& bitmap, bool useStagingData) {
|
||||
|
||||
bool Tree::allocateBitmapIfNeeded(Cache& cache, int width, int height) {
|
||||
if (!canReuseBitmap(cache.bitmap.get(), width, height)) {
|
||||
#ifndef ANDROID_ENABLE_LINEAR_BLENDING
|
||||
sk_sp<SkColorSpace> colorSpace = nullptr;
|
||||
#else
|
||||
sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeSRGB();
|
||||
#endif
|
||||
SkImageInfo info = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType, colorSpace);
|
||||
SkImageInfo info = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
|
||||
cache.bitmap = Bitmap::allocateHeapBitmap(info);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -262,12 +262,7 @@ void VectorDrawableAtlas::delayedReleaseEntries() {
|
||||
}
|
||||
|
||||
sk_sp<SkSurface> VectorDrawableAtlas::createSurface(int width, int height, GrContext* context) {
|
||||
#ifndef ANDROID_ENABLE_LINEAR_BLENDING
|
||||
sk_sp<SkColorSpace> colorSpace = nullptr;
|
||||
#else
|
||||
sk_sp<SkColorSpace> colorSpace = SkColorSpace::MakeSRGB();
|
||||
#endif
|
||||
SkImageInfo info = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType, colorSpace);
|
||||
SkImageInfo info = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
|
||||
// This must have a top-left origin so that calls to surface->canvas->writePixels
|
||||
// performs a basic texture upload instead of a more complex drawing operation
|
||||
return SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info, 0, kTopLeft_GrSurfaceOrigin,
|
||||
|
||||
@@ -82,17 +82,6 @@ static constexpr float OECF_sRGB(float linear) {
|
||||
return linear <= 0.0031308f ? linear * 12.92f : (powf(linear, 1.0f / 2.4f) * 1.055f) - 0.055f;
|
||||
}
|
||||
|
||||
// Opto-electronic conversion function for the sRGB color space
|
||||
// Takes a linear sRGB value and converts it to a gamma-encoded sRGB value
|
||||
// This function returns the input unmodified if linear blending is not enabled
|
||||
static constexpr float OECF(float linear) {
|
||||
#ifdef ANDROID_ENABLE_LINEAR_BLENDING
|
||||
return OECF_sRGB(linear);
|
||||
#else
|
||||
return linear;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Electro-optical conversion function for the sRGB color space
|
||||
// Takes a gamma-encoded sRGB value and converts it to a linear sRGB value
|
||||
static constexpr float EOCF_sRGB(float srgb) {
|
||||
@@ -100,17 +89,6 @@ static constexpr float EOCF_sRGB(float srgb) {
|
||||
return srgb <= 0.04045f ? srgb / 12.92f : powf((srgb + 0.055f) / 1.055f, 2.4f);
|
||||
}
|
||||
|
||||
// Electro-optical conversion function for the sRGB color space
|
||||
// Takes a gamma-encoded sRGB value and converts it to a linear sRGB value
|
||||
// This function returns the input unmodified if linear blending is not enabled
|
||||
static constexpr float EOCF(float srgb) {
|
||||
#ifdef ANDROID_ENABLE_LINEAR_BLENDING
|
||||
return EOCF_sRGB(srgb);
|
||||
#else
|
||||
return srgb;
|
||||
#endif
|
||||
}
|
||||
|
||||
android::PixelFormat ColorTypeToPixelFormat(SkColorType colorType);
|
||||
ANDROID_API SkColorType PixelFormatToColorType(android::PixelFormat format);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user