c0bd9f9fe5
Current strategy: everything from the top Things to look at first are the manual changes: - added tools/rewrite_includes.py - removed -Idirectives from BUILD.gn - various compile.sh simplifications - tweak tools/embed_resources.py - update gn/find_headers.py to write paths from the top - update gn/gn_to_bp.py SkUserConfig.h layout so that #include "include/config/SkUserConfig.h" always gets the header we want. No-Presubmit: true Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
50 lines
1.5 KiB
C++
50 lines
1.5 KiB
C++
/*
|
|
* Copyright 2015 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "bench/BitmapRegionDecoderBench.h"
|
|
#include "bench/CodecBenchPriv.h"
|
|
#include "include/core/SkBitmap.h"
|
|
#include "src/core/SkOSFile.h"
|
|
|
|
BitmapRegionDecoderBench::BitmapRegionDecoderBench(const char* baseName, SkData* encoded,
|
|
SkColorType colorType, uint32_t sampleSize, const SkIRect& subset)
|
|
: fBRD(nullptr)
|
|
, fData(SkRef(encoded))
|
|
, fColorType(colorType)
|
|
, fSampleSize(sampleSize)
|
|
, fSubset(subset)
|
|
{
|
|
// Choose a useful name for the color type
|
|
const char* colorName = color_type_to_str(colorType);
|
|
|
|
fName.printf("BRD_%s_%s", baseName, colorName);
|
|
if (1 != sampleSize) {
|
|
fName.appendf("_%.3f", 1.0f / (float) sampleSize);
|
|
}
|
|
}
|
|
|
|
const char* BitmapRegionDecoderBench::onGetName() {
|
|
return fName.c_str();
|
|
}
|
|
|
|
bool BitmapRegionDecoderBench::isSuitableFor(Backend backend) {
|
|
return kNonRendering_Backend == backend;
|
|
}
|
|
|
|
void BitmapRegionDecoderBench::onDelayedSetup() {
|
|
fBRD.reset(SkBitmapRegionDecoder::Create(fData, SkBitmapRegionDecoder::kAndroidCodec_Strategy));
|
|
}
|
|
|
|
void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) {
|
|
auto ct = fBRD->computeOutputColorType(fColorType);
|
|
auto cs = fBRD->computeOutputColorSpace(ct, nullptr);
|
|
for (int i = 0; i < n; i++) {
|
|
SkBitmap bm;
|
|
SkAssertResult(fBRD->decodeRegion(&bm, nullptr, fSubset, fSampleSize, ct, false, cs));
|
|
}
|
|
}
|