Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: tests/SkBlend_optsTest.cpp

Issue 2130183003: Remove bloat from SkBlend_opts. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/opts/SkBlend_opts.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkBlend_optsTest.cpp
diff --git a/tests/SkBlend_optsTest.cpp b/tests/SkBlend_optsTest.cpp
index 9142f9d7a1b96c1a0c44e9675cc960ded43b2449..caabc6044535f696d38eadcce44fdbab57840b1c 100644
--- a/tests/SkBlend_optsTest.cpp
+++ b/tests/SkBlend_optsTest.cpp
@@ -13,24 +13,25 @@
#include "SkImage.h"
#include "SkImage_Base.h"
#include "SkOpts.h"
+#include "SkPM4fPriv.h"
#include "SkNx.h"
#include "Test.h"
-#include "../include/core/SkImageInfo.h"
typedef void (*Blender)(uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
-namespace sk_default {
-extern void brute_force_srcover_srgb_srgb(
- uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
+static void brute_force_srcover_srgb_srgb(
+ uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) {
+ while (ndst > 0) {
+ int n = SkTMin(ndst, nsrc);
+
+ for (int i = 0; i < n; i++) {
+ srcover_blend_srgb8888_srgb_1(dst++, srgb_to_linear(to_4f(src[i])));
+ }
+ ndst -= n;
+ }
}
namespace sk_default {
-extern void trivial_srcover_srgb_srgb(
- uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
-
-extern void best_non_simd_srcover_srgb_srgb(
- uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
-
extern void srcover_srgb_srgb(
uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
}
@@ -84,9 +85,9 @@ static void test_blender(
SkAutoTArray<uint32_t> testDst(width);
for (int y = 0; y < pixmap.height(); y++) {
- memset(correctDst.get(), 0, width * sizeof(uint32_t));
- memset(testDst.get(), 0, width * sizeof(uint32_t));
- sk_default::brute_force_srcover_srgb_srgb(correctDst.get(), src, width, width);
+ sk_bzero(correctDst.get(), width * sizeof(uint32_t));
+ sk_bzero(testDst.get(), width * sizeof(uint32_t));
+ brute_force_srcover_srgb_srgb(correctDst.get(), src, width, width);
blender(testDst.get(), src, width, width);
for (int x = 0; x < width; x++) {
REPORTER_ASSERT_MESSAGE(
@@ -100,8 +101,6 @@ static void test_blender(
DEF_TEST(SkBlend_optsCheck, reporter) {
std::vector<Spec> specs = {
- Spec{sk_default::trivial_srcover_srgb_srgb, "trivial"},
- Spec{sk_default::best_non_simd_srcover_srgb_srgb, "best_non_simd"},
Spec{sk_default::srcover_srgb_srgb, "default"},
};
#if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS)
@@ -121,8 +120,6 @@ DEF_TEST(SkBlend_optsCheck, reporter) {
}
}
-
-
DEF_TEST(SkBlend_optsSqrtCheck, reporter) {
for (int c = 0; c < 256; c++) {
Sk4f i{(float)c};
« no previous file with comments | « src/opts/SkBlend_opts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698