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

Unified Diff: tests/UnpremultiplyTest.cpp

Issue 560453002: Back to hashing source content, not .png. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove test Created 6 years, 3 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 | « gyp/tests.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/UnpremultiplyTest.cpp
diff --git a/tests/UnpremultiplyTest.cpp b/tests/UnpremultiplyTest.cpp
deleted file mode 100644
index 7846a1b370ad4ba7c7fef47ad2a5deed5148c76c..0000000000000000000000000000000000000000
--- a/tests/UnpremultiplyTest.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkColorPriv.h"
-#include "SkUnPreMultiply.h"
-#include "Test.h"
-
-DEF_TEST(Unpremultiply, reporter) {
- // Here we test that unpremultiplication is injective:
- // no two distinct premul colors map to the same unpremul color.
-
- // DM exploits this fact to safely hash .pngs instead of the original bitmaps.
-
- // It is sufficient to test red. Green and blue follow the same rules.
- // This means we have at most 256*256 possible colors to deal with.
- int hits[256*256];
- for (size_t i = 0; i < SK_ARRAY_COUNT(hits); i++) {
- hits[i] = 0;
- }
-
- for (int a = 0; a < 256; a++) {
- for (int r = 0; r <= a; r++) {
- SkPMColor pm = SkPackARGB32(a, r, 0, 0);
- SkColor upm = SkUnPreMultiply::PMColorToColor(pm);
-
- // ARGB -> AR
- hits[upm >> 16]++;
- }
- }
-
- for (size_t i = 0; i < SK_ARRAY_COUNT(hits); i++) {
- REPORTER_ASSERT(reporter, hits[i] < 2);
- }
-}
« no previous file with comments | « gyp/tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698