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

Side by Side Diff: bench/nanobench.cpp

Issue 1418093006: Refactor SkBitmapRegionDecoderInterface for Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Better comments 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 | « bench/BitmapRegionDecoderBench.cpp ('k') | dm/DMSrcSink.cpp » ('j') | 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 2014 Google Inc. 2 * Copyright 2014 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 <ctype.h> 8 #include <ctype.h>
9 9
10 #include "nanobench.h" 10 #include "nanobench.h"
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 static bool valid_brd_bench(SkData* encoded, SkBitmapRegionDecoderInterface::Str ategy strategy, 596 static bool valid_brd_bench(SkData* encoded, SkBitmapRegionDecoderInterface::Str ategy strategy,
597 SkColorType colorType, uint32_t sampleSize, uint32_t minOutputSize, int* width, 597 SkColorType colorType, uint32_t sampleSize, uint32_t minOutputSize, int* width,
598 int* height) { 598 int* height) {
599 SkAutoTDelete<SkBitmapRegionDecoderInterface> brd( 599 SkAutoTDelete<SkBitmapRegionDecoderInterface> brd(
600 SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(encoded, s trategy)); 600 SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(encoded, s trategy));
601 if (nullptr == brd.get()) { 601 if (nullptr == brd.get()) {
602 // This is indicates that subset decoding is not supported for a particu lar image format. 602 // This is indicates that subset decoding is not supported for a particu lar image format.
603 return false; 603 return false;
604 } 604 }
605 605
606 SkAutoTDelete<SkBitmap> bitmap(brd->decodeRegion(0, 0, brd->width(), brd->he ight(), 1, 606 SkBitmap bitmap;
607 colorType)); 607 if (!brd->decodeRegion(&bitmap, nullptr, SkIRect::MakeXYWH(0, 0, brd->width( ), brd->height()),
608 if (nullptr == bitmap.get() || colorType != bitmap->colorType()) { 608 1, colorType, false)) {
609 return false;
610 }
611 if (colorType != bitmap.colorType()) {
609 // This indicates that conversion to the requested color type is not sup ported for the 612 // This indicates that conversion to the requested color type is not sup ported for the
610 // particular image. 613 // particular image.
611 return false; 614 return false;
612 } 615 }
613 616
614 if (sampleSize * minOutputSize > (uint32_t) brd->width() || sampleSize * min OutputSize > 617 if (sampleSize * minOutputSize > (uint32_t) brd->width() || sampleSize * min OutputSize >
615 (uint32_t) brd->height()) { 618 (uint32_t) brd->height()) {
616 // This indicates that the image is not large enough to decode a 619 // This indicates that the image is not large enough to decode a
617 // minOutputSize x minOutputSize subset at the given sampleSize. 620 // minOutputSize x minOutputSize subset at the given sampleSize.
618 return false; 621 return false;
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 1367
1365 return 0; 1368 return 0;
1366 } 1369 }
1367 1370
1368 #if !defined SK_BUILD_FOR_IOS 1371 #if !defined SK_BUILD_FOR_IOS
1369 int main(int argc, char** argv) { 1372 int main(int argc, char** argv) {
1370 SkCommandLineFlags::Parse(argc, argv); 1373 SkCommandLineFlags::Parse(argc, argv);
1371 return nanobench_main(); 1374 return nanobench_main();
1372 } 1375 }
1373 #endif 1376 #endif
OLDNEW
« no previous file with comments | « bench/BitmapRegionDecoderBench.cpp ('k') | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698