| 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 "CodecBenchPriv.h" | 8 #include "CodecBenchPriv.h" |
| 9 #include "SubsetZoomBench.h" | 9 #include "SubsetZoomBench.h" |
| 10 #include "SubsetBenchPriv.h" | 10 #include "SubsetBenchPriv.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 const char* SubsetZoomBench::onGetName() { | 48 const char* SubsetZoomBench::onGetName() { |
| 49 return fName.c_str(); | 49 return fName.c_str(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool SubsetZoomBench::isSuitableFor(Backend backend) { | 52 bool SubsetZoomBench::isSuitableFor(Backend backend) { |
| 53 return kNonRendering_Backend == backend; | 53 return kNonRendering_Backend == backend; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void SubsetZoomBench::onDraw(const int n, SkCanvas* canvas) { | 56 void SubsetZoomBench::onDraw(int n, SkCanvas* canvas) { |
| 57 // When the color type is kIndex8, we will need to store the color table. I
f it is | 57 // When the color type is kIndex8, we will need to store the color table. I
f it is |
| 58 // used, it will be initialized by the codec. | 58 // used, it will be initialized by the codec. |
| 59 int colorCount; | 59 int colorCount; |
| 60 SkPMColor colors[256]; | 60 SkPMColor colors[256]; |
| 61 if (fUseCodec) { | 61 if (fUseCodec) { |
| 62 for (int count = 0; count < n; count++) { | 62 for (int count = 0; count < n; count++) { |
| 63 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(fStream->duplica
te())); | 63 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(fStream->duplica
te())); |
| 64 const SkImageInfo info = codec->getInfo().makeColorType(fColorType); | 64 const SkImageInfo info = codec->getInfo().makeColorType(fColorType); |
| 65 SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]); | 65 SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]); |
| 66 codec->startScanlineDecode(info, nullptr, colors, &colorCount); | 66 codec->startScanlineDecode(info, nullptr, colors, &colorCount); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 SkBitmap bitmap; | 109 SkBitmap bitmap; |
| 110 SkIRect rect = SkIRect::MakeXYWH(subsetStartX, subsetStartY, sub
setWidth, | 110 SkIRect rect = SkIRect::MakeXYWH(subsetStartX, subsetStartY, sub
setWidth, |
| 111 subsetHeight); | 111 subsetHeight); |
| 112 decoder->decodeSubset(&bitmap, rect, fColorType); | 112 decoder->decodeSubset(&bitmap, rect, fColorType); |
| 113 w <<= 1; | 113 w <<= 1; |
| 114 h <<= 1; | 114 h <<= 1; |
| 115 } while (w < 2 * width || h < 2 * height); | 115 } while (w < 2 * width || h < 2 * height); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 } | 118 } |
| OLD | NEW |