From 124975791084a660c32645260c151e4c3c537e76 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 31 Jan 2019 10:06:12 -0500 Subject: [PATCH] Remove references to ANDROID_ENABLE_LINEAR_BLENDING Test: make There is no longer any intent to turn on linear blending. Change-Id: Ia1016f31833212da6ad4b4c6ebe03d16a509746d --- core/jni/Android.bp | 4 ---- libs/hwui/Android.bp | 4 ---- libs/hwui/HardwareBitmapUploader.cpp | 1 - libs/hwui/VectorDrawable.cpp | 7 +----- .../pipeline/skia/VectorDrawableAtlas.cpp | 7 +----- libs/hwui/utils/Color.h | 22 ------------------- 6 files changed, 2 insertions(+), 43 deletions(-) diff --git a/core/jni/Android.bp b/core/jni/Android.bp index 51a3b48e58ec0..e7a1c49e7a994 100644 --- a/core/jni/Android.bp +++ b/core/jni/Android.bp @@ -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"], diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp index 96798f9784659..0335a7c6bd7d9 100644 --- a/libs/hwui/Android.bp +++ b/libs/hwui/Android.bp @@ -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: [ diff --git a/libs/hwui/HardwareBitmapUploader.cpp b/libs/hwui/HardwareBitmapUploader.cpp index 6b7ec97de4c87..aeeb32c4620a3 100644 --- a/libs/hwui/HardwareBitmapUploader.cpp +++ b/libs/hwui/HardwareBitmapUploader.cpp @@ -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; diff --git a/libs/hwui/VectorDrawable.cpp b/libs/hwui/VectorDrawable.cpp index 72656922b03ef..da905cf9e63a3 100644 --- a/libs/hwui/VectorDrawable.cpp +++ b/libs/hwui/VectorDrawable.cpp @@ -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 colorSpace = nullptr; -#else - sk_sp 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; } diff --git a/libs/hwui/pipeline/skia/VectorDrawableAtlas.cpp b/libs/hwui/pipeline/skia/VectorDrawableAtlas.cpp index 8fb621d24866c..e783f389feb8b 100644 --- a/libs/hwui/pipeline/skia/VectorDrawableAtlas.cpp +++ b/libs/hwui/pipeline/skia/VectorDrawableAtlas.cpp @@ -262,12 +262,7 @@ void VectorDrawableAtlas::delayedReleaseEntries() { } sk_sp VectorDrawableAtlas::createSurface(int width, int height, GrContext* context) { -#ifndef ANDROID_ENABLE_LINEAR_BLENDING - sk_sp colorSpace = nullptr; -#else - sk_sp 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, diff --git a/libs/hwui/utils/Color.h b/libs/hwui/utils/Color.h index b67d10d4249c1..79400de08ee08 100644 --- a/libs/hwui/utils/Color.h +++ b/libs/hwui/utils/Color.h @@ -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);