Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: dm/DMSrcSink.h

Issue 1288963002: Provides multiple implementations of Android's SkBitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSink.cpp » ('j') | dm/DMSrcSink.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSink.cpp » ('j') | dm/DMSrcSink.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698