skia2/bench/nanobenchAndroid.cpp
tomhudson 3c8ceb7350 Simplify linkages to Android framework internals
We've migrated SkHwuiRenderer into the Android Framework as
android::uirenderer::TestWindowContext in response to an internal
bug; we now delete that class and change our build references here.

R=djsollen@google.com

Review URL: https://codereview.chromium.org/1407053009
2015-10-26 07:21:32 -07:00

54 lines
1.2 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 "nanobenchAndroid.h"
/* These functions are only compiled in the Android Framework. */
HWUITarget::HWUITarget(const Config& c, Benchmark* bench) : Target(c) { }
void HWUITarget::setup() {
this->renderer.fence();
}
SkCanvas* HWUITarget::beginTiming(SkCanvas* canvas) {
SkCanvas* targetCanvas = this->renderer.prepareToDraw();
if (targetCanvas) {
this->fc.reset(targetCanvas);
canvas = &this->fc;
// This might minimally distort timing, but canvas isn't valid outside the timer.
canvas->clear(SK_ColorWHITE);
}
return canvas;
}
void HWUITarget::endTiming() {
this->renderer.finishDrawing();
}
void HWUITarget::fence() {
this->renderer.fence();
}
bool HWUITarget::needsFrameTiming(int* frameLag) const {
extern int FLAGS_gpuFrameLag;
*frameLag = FLAGS_gpuFrameLag;
return true;
}
bool HWUITarget::init(SkImageInfo info, Benchmark* bench) {
this->renderer.initialize(bench->getSize().x(), bench->getSize().y());
return true;
}
bool HWUITarget::capturePixels(SkBitmap* bmp) {
return this->renderer.capturePixels(bmp);
}