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

Side by Side Diff: tests/CodexTest.cpp

Issue 1417583009: Combine native sampling with sampling (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Work around missing initializer_list on mac Created 5 years, 1 month 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/codec/SkSampledCodec.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 2015 Google Inc. 2 * Copyright 2015 Google Inc.
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 "SkAndroidCodec.h" 9 #include "SkAndroidCodec.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 SkDebugf("Missing resource '%s'\n", path); 574 SkDebugf("Missing resource '%s'\n", path);
575 return; 575 return;
576 } 576 }
577 SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.det ach())); 577 SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.det ach()));
578 if (!codec) { 578 if (!codec) {
579 ERRORF(r, "Unable to create codec '%s'", path); 579 ERRORF(r, "Unable to create codec '%s'", path);
580 return; 580 return;
581 } 581 }
582 582
583 // Check that the decode is successful for a variety of scales 583 // Check that the decode is successful for a variety of scales
584 for (int sampleSize = 1; sampleSize < 10; sampleSize++) { 584 for (int sampleSize = 1; sampleSize < 32; sampleSize++) {
585 // Scale the output dimensions 585 // Scale the output dimensions
586 SkISize scaledDims = codec->getSampledDimensions(sampleSize); 586 SkISize scaledDims = codec->getSampledDimensions(sampleSize);
587 SkImageInfo scaledInfo = codec->getInfo() 587 SkImageInfo scaledInfo = codec->getInfo()
588 .makeWH(scaledDims.width(), scaledDims.height()) 588 .makeWH(scaledDims.width(), scaledDims.height())
589 .makeColorType(kN32_SkColorType); 589 .makeColorType(kN32_SkColorType);
590 590
591 // Set up for the decode 591 // Set up for the decode
592 size_t rowBytes = scaledDims.width() * sizeof(SkPMColor); 592 size_t rowBytes = scaledDims.width() * sizeof(SkPMColor);
593 size_t totalBytes = scaledInfo.getSafeSize(rowBytes); 593 size_t totalBytes = scaledInfo.getSafeSize(rowBytes);
594 SkAutoTMalloc<SkPMColor> pixels(totalBytes); 594 SkAutoTMalloc<SkPMColor> pixels(totalBytes);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); 678 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result);
679 result = decoder->startScanlineDecode( 679 result = decoder->startScanlineDecode(
680 decoder->getInfo().makeColorType(kIndex_8_SkColorType)); 680 decoder->getInfo().makeColorType(kIndex_8_SkColorType));
681 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result); 681 REPORTER_ASSERT(r, SkCodec::kInvalidParameters == result);
682 } 682 }
683 683
684 DEF_TEST(Codec_Params, r) { 684 DEF_TEST(Codec_Params, r) {
685 test_invalid_parameters(r, "index8.png"); 685 test_invalid_parameters(r, "index8.png");
686 test_invalid_parameters(r, "mandrill.wbmp"); 686 test_invalid_parameters(r, "mandrill.wbmp");
687 } 687 }
OLDNEW
« no previous file with comments | « src/codec/SkSampledCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698