RecordingBench.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2014 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 RecordingBench_DEFINED
  8. #define RecordingBench_DEFINED
  9. #include "bench/Benchmark.h"
  10. #include "include/core/SkPicture.h"
  11. class PictureCentricBench : public Benchmark {
  12. public:
  13. PictureCentricBench(const char* name, const SkPicture*);
  14. protected:
  15. const char* onGetName() override;
  16. bool isSuitableFor(Backend) override;
  17. SkIPoint onGetSize() override;
  18. protected:
  19. sk_sp<const SkPicture> fSrc;
  20. SkString fName;
  21. typedef Benchmark INHERITED;
  22. };
  23. class RecordingBench : public PictureCentricBench {
  24. public:
  25. RecordingBench(const char* name, const SkPicture*, bool useBBH);
  26. protected:
  27. void onDraw(int loops, SkCanvas*) override;
  28. private:
  29. bool fUseBBH;
  30. typedef PictureCentricBench INHERITED;
  31. };
  32. class DeserializePictureBench : public Benchmark {
  33. public:
  34. DeserializePictureBench(const char* name, sk_sp<SkData> encodedPicture);
  35. protected:
  36. const char* onGetName() override;
  37. bool isSuitableFor(Backend) override;
  38. SkIPoint onGetSize() override;
  39. void onDraw(int loops, SkCanvas*) override;
  40. private:
  41. SkString fName;
  42. sk_sp<SkData> fEncodedPicture;
  43. typedef Benchmark INHERITED;
  44. };
  45. #endif//RecordingBench_DEFINED