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 #ifndef DMSrcSink_DEFINED | 8 #ifndef DMSrcSink_DEFINED |
9 #define DMSrcSink_DEFINED | 9 #define DMSrcSink_DEFINED |
10 | 10 |
11 #include "DMGpuSupport.h" | 11 #include "DMGpuSupport.h" |
12 #include "SkBBHFactory.h" | 12 #include "SkBBHFactory.h" |
13 #include "SkBBoxHierarchy.h" | 13 #include "SkBBoxHierarchy.h" |
14 #include "SkBitmap.h" | 14 #include "SkBitmap.h" |
| 15 #include "SkBitmapRegionDecoder.h" |
15 #include "SkCanvas.h" | 16 #include "SkCanvas.h" |
16 #include "SkData.h" | 17 #include "SkData.h" |
17 #include "SkGPipe.h" | 18 #include "SkGPipe.h" |
18 #include "SkPicture.h" | 19 #include "SkPicture.h" |
19 #include "gm.h" | 20 #include "gm.h" |
20 | 21 |
21 namespace DM { | 22 namespace DM { |
22 | 23 |
23 // This is just convenience. It lets you use either return "foo" or return SkSt
ringPrintf(...). | 24 // This is just convenience. It lets you use either return "foo" or return SkSt
ringPrintf(...). |
24 struct ImplicitString : public SkString { | 25 struct ImplicitString : public SkString { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 94 |
94 Error draw(SkCanvas*) const override; | 95 Error draw(SkCanvas*) const override; |
95 SkISize size() const override; | 96 SkISize size() const override; |
96 Name name() const override; | 97 Name name() const override; |
97 void modifyGrContextOptions(GrContextOptions* options) const override; | 98 void modifyGrContextOptions(GrContextOptions* options) const override; |
98 | 99 |
99 private: | 100 private: |
100 skiagm::GMRegistry::Factory fFactory; | 101 skiagm::GMRegistry::Factory fFactory; |
101 }; | 102 }; |
102 | 103 |
| 104 // Allows for testing of various implementations of Android's BitmapRegionDecode
r |
| 105 class BRDSrc : public Src { |
| 106 public: |
| 107 enum Mode { |
| 108 // Decode the entire image as one region. |
| 109 kFullImage_Mode, |
| 110 // Splits the image into multiple regions using a divisor and decodes th
e regions |
| 111 // separately. Also, this test adds a border of a few pixels to each of
the regions |
| 112 // that it is decoding. This tests the behavior when a client asks for
a region that |
| 113 // does not fully fit in the image. |
| 114 kDivisor_Mode, |
| 115 }; |
| 116 |
| 117 BRDSrc(Path, SkBitmapRegionDecoder::Strategy, Mode, SkColorType, uint32_t); |
| 118 |
| 119 static float GetScale(uint32_t sampleSize) { return 1.0f / (float) sampleSiz
e; } |
| 120 |
| 121 Error draw(SkCanvas*) const override; |
| 122 SkISize size() const override; |
| 123 Name name() const override; |
| 124 bool veto(SinkFlags) const override; |
| 125 private: |
| 126 Path fPath; |
| 127 SkBitmapRegionDecoder::Strategy fStrategy; |
| 128 Mode fMode; |
| 129 SkColorType fColorType; |
| 130 uint32_t fSampleSize; |
| 131 }; |
| 132 |
103 class CodecSrc : public Src { | 133 class CodecSrc : public Src { |
104 public: | 134 public: |
105 enum Mode { | 135 enum Mode { |
106 kScaledCodec_Mode, | 136 kScaledCodec_Mode, |
107 kCodec_Mode, | 137 kCodec_Mode, |
108 kScanline_Mode, | 138 kScanline_Mode, |
109 kScanline_Subset_Mode, | 139 kScanline_Subset_Mode, |
110 kStripe_Mode, // Tests the skipping of scanlines | 140 kStripe_Mode, // Tests the skipping of scanlines |
111 kSubset_Mode, // For codecs that support subsets directly. | 141 kSubset_Mode, // For codecs that support subsets directly. |
112 }; | 142 }; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 340 |
311 class ViaTwice : public Via { | 341 class ViaTwice : public Via { |
312 public: | 342 public: |
313 explicit ViaTwice(Sink* sink) : Via(sink) {} | 343 explicit ViaTwice(Sink* sink) : Via(sink) {} |
314 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; | 344 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
315 }; | 345 }; |
316 | 346 |
317 } // namespace DM | 347 } // namespace DM |
318 | 348 |
319 #endif//DMSrcSink_DEFINED | 349 #endif//DMSrcSink_DEFINED |
OLD | NEW |