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

Side by Side Diff: tests/PDFPrimitivesTest.cpp

Issue 2151863003: SkPdf: smaller color serialization (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkFixed - 2016-07-15 (Friday) 15:45:32 EDT 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 unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFUtils.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 The Android Open Source Project 2 * Copyright 2010 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Resources.h" 8 #include "Resources.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 float alwaysCheck[] = { 484 float alwaysCheck[] = {
485 0.0f, -0.0f, 1.0f, -1.0f, SK_ScalarPI, 0.1f, FLT_MIN, FLT_MAX, 485 0.0f, -0.0f, 1.0f, -1.0f, SK_ScalarPI, 0.1f, FLT_MIN, FLT_MAX,
486 -FLT_MIN, -FLT_MAX, FLT_MIN / 16.0f, -FLT_MIN / 16.0f, 486 -FLT_MIN, -FLT_MAX, FLT_MIN / 16.0f, -FLT_MIN / 16.0f,
487 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity, 487 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity,
488 -FLT_MIN / 8388608.0 488 -FLT_MIN / 8388608.0
489 }; 489 };
490 for (float inputFloat: alwaysCheck) { 490 for (float inputFloat: alwaysCheck) {
491 check_pdf_scalar_serialization(reporter, inputFloat); 491 check_pdf_scalar_serialization(reporter, inputFloat);
492 } 492 }
493 } 493 }
494
495 // Test SkPDFUtils:: for accuracy.
496 DEF_TEST(PDFPrimitives_Color, reporter) {
497 char buffer[5];
498 for (int i = 0; i < 256; ++i) {
499 size_t len = SkPDFUtils::ColorToDecimal(i, buffer);
500 REPORTER_ASSERT(reporter, len == strlen(buffer));
501 float f;
502 REPORTER_ASSERT(reporter, 1 == sscanf(buffer, "%f", &f));
503 int roundTrip = (int)(0.5 + f * 255);
504 REPORTER_ASSERT(reporter, roundTrip == i);
505 }
506 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFUtils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698