| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "BitmapRegionDecoderBench.h" | 8 #include "BitmapRegionDecoderBench.h" |
| 9 #include "CodecBenchPriv.h" | 9 #include "CodecBenchPriv.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 bool BitmapRegionDecoderBench::isSuitableFor(Backend backend) { | 52 bool BitmapRegionDecoderBench::isSuitableFor(Backend backend) { |
| 53 return kNonRendering_Backend == backend; | 53 return kNonRendering_Backend == backend; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void BitmapRegionDecoderBench::onDelayedSetup() { | 56 void BitmapRegionDecoderBench::onDelayedSetup() { |
| 57 SkStreamRewindable* stream = new SkMemoryStream(fData); | 57 SkStreamRewindable* stream = new SkMemoryStream(fData); |
| 58 fBRD.reset(SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(stream,
fStrategy)); | 58 fBRD.reset(SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(stream,
fStrategy)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void BitmapRegionDecoderBench::onDraw(const int n, SkCanvas* canvas) { | 61 void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) { |
| 62 SkAutoTDelete<SkBitmap> bitmap; | 62 SkAutoTDelete<SkBitmap> bitmap; |
| 63 for (int i = 0; i < n; i++) { | 63 for (int i = 0; i < n; i++) { |
| 64 bitmap.reset(fBRD->decodeRegion(fSubset.left(), fSubset.top(), fSubset.w
idth(), | 64 bitmap.reset(fBRD->decodeRegion(fSubset.left(), fSubset.top(), fSubset.w
idth(), |
| 65 fSubset.height(), fSampleSize, fColorType)); | 65 fSubset.height(), fSampleSize, fColorType)); |
| 66 SkASSERT(nullptr != bitmap.get()); | 66 SkASSERT(nullptr != bitmap.get()); |
| 67 } | 67 } |
| 68 } | 68 } |
| OLD | NEW |