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

Unified Diff: bench/CodecBench.cpp

Issue 1568913002: Make CodecBench test kPremul and kUnpremul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Silent for opaque images Created 4 years, 11 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 | « bench/CodecBench.h ('k') | bench/CodecBenchPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/CodecBench.cpp
diff --git a/bench/CodecBench.cpp b/bench/CodecBench.cpp
index 1384480f43e96ae6bda1e49a0777e2e1e1825dd4..66831fb24c6bc16b9696c5951a291f92e09f87e6 100644
--- a/bench/CodecBench.cpp
+++ b/bench/CodecBench.cpp
@@ -11,12 +11,15 @@
#include "SkCodec.h"
#include "SkOSFile.h"
-CodecBench::CodecBench(SkString baseName, SkData* encoded, SkColorType colorType)
+CodecBench::CodecBench(SkString baseName, SkData* encoded, SkColorType colorType,
+ SkAlphaType alphaType)
: fColorType(colorType)
+ , fAlphaType(alphaType)
, fData(SkRef(encoded))
{
// Parse filename and the color type to give the benchmark a useful name
- fName.printf("Codec_%s_%s", baseName.c_str(), color_type_to_str(colorType));
+ fName.printf("Codec_%s_%s%s", baseName.c_str(), color_type_to_str(colorType),
scroggo 2016/01/07 20:41:18 So for a premul, the name will be something like
msarett 2016/01/07 21:00:55 Yeah it's actually: N32Premul N32Unpremul Index8Pr
+ alpha_type_to_str(alphaType));
#ifdef SK_DEBUG
// Ensure that we can create an SkCodec from this data.
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData));
@@ -35,15 +38,7 @@ bool CodecBench::isSuitableFor(Backend backend) {
void CodecBench::onDelayedSetup() {
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData));
- fInfo = codec->getInfo().makeColorType(fColorType);
- SkAlphaType alphaType;
- // Caller should not have created this CodecBench if the alpha type was
- // invalid.
- SkAssertResult(SkColorTypeValidateAlphaType(fColorType, fInfo.alphaType(),
- &alphaType));
- if (alphaType != fInfo.alphaType()) {
- fInfo = fInfo.makeAlphaType(alphaType);
- }
+ fInfo = codec->getInfo().makeColorType(fColorType).makeAlphaType(fAlphaType);
fPixelStorage.reset(fInfo.getSafeSize(fInfo.minRowBytes()));
}
« no previous file with comments | « bench/CodecBench.h ('k') | bench/CodecBenchPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698