CodecBench.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright 2015 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #ifndef CodecBench_DEFINED
  8. #define CodecBench_DEFINED
  9. #include "bench/Benchmark.h"
  10. #include "include/core/SkData.h"
  11. #include "include/core/SkImageInfo.h"
  12. #include "include/core/SkRefCnt.h"
  13. #include "include/core/SkString.h"
  14. #include "src/core/SkAutoMalloc.h"
  15. /**
  16. * Time SkCodec.
  17. */
  18. class CodecBench : public Benchmark {
  19. public:
  20. // Calls encoded->ref()
  21. CodecBench(SkString basename, SkData* encoded, SkColorType colorType, SkAlphaType alphaType);
  22. protected:
  23. const char* onGetName() override;
  24. bool isSuitableFor(Backend backend) override;
  25. void onDraw(int n, SkCanvas* canvas) override;
  26. void onDelayedSetup() override;
  27. private:
  28. SkString fName;
  29. const SkColorType fColorType;
  30. const SkAlphaType fAlphaType;
  31. sk_sp<SkData> fData;
  32. SkImageInfo fInfo; // Set in onDelayedSetup.
  33. SkAutoMalloc fPixelStorage;
  34. typedef Benchmark INHERITED;
  35. };
  36. #endif // CodecBench_DEFINED