1 /* 2 * Copyright 2016 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 8 #ifndef ColorCodecBench_DEFINED 9 #define ColorCodecBench_DEFINED 10 11 #include "Benchmark.h" 12 #include "SkAutoMalloc.h" 13 #include "SkData.h" 14 #include "SkImageInfo.h" 15 16 class ColorCodecBench : public Benchmark { 17 public: 18 ColorCodecBench(const char* name, sk_sp<SkData> encoded); 19 20 protected: 21 const char* onGetName() override; 22 bool isSuitableFor(Backend backend) override; 23 void onDraw(int n, SkCanvas* canvas) override; 24 void onDelayedSetup() override; 25 26 private: 27 void decodeAndXform(); 28 void xformOnly(); 29 30 SkString fName; 31 sk_sp<SkData> fEncoded; 32 SkImageInfo fSrcInfo; 33 SkImageInfo fDstInfo; 34 SkAutoMalloc fDst; 35 SkAutoMalloc fSrc; 36 sk_sp<SkColorSpace> fDstSpace; 37 sk_sp<SkColorSpace> fSrcSpace; 38 39 typedef Benchmark INHERITED; 40 }; 41 #endif // ColorCodecBench_DEFINED 42