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

Side by Side Diff: dm/DMSrcSink.h

Issue 1322773004: Revert of Provides multiple implementations of Android's SkBitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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') | no next file with comments »
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 "SkBitmapRegionDecoderInterface.h"
16 #include "SkCanvas.h" 15 #include "SkCanvas.h"
17 #include "SkData.h" 16 #include "SkData.h"
18 #include "SkGPipe.h" 17 #include "SkGPipe.h"
19 #include "SkPicture.h" 18 #include "SkPicture.h"
20 #include "gm.h" 19 #include "gm.h"
21 20
22 namespace DM { 21 namespace DM {
23 22
24 // This is just convenience. It lets you use either return "foo" or return SkSt ringPrintf(...). 23 // This is just convenience. It lets you use either return "foo" or return SkSt ringPrintf(...).
25 struct ImplicitString : public SkString { 24 struct ImplicitString : public SkString {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 SkISize size() const override; 121 SkISize size() const override;
123 Name name() const override; 122 Name name() const override;
124 bool veto(SinkFlags) const override; 123 bool veto(SinkFlags) const override;
125 private: 124 private:
126 Path fPath; 125 Path fPath;
127 Mode fMode; 126 Mode fMode;
128 DstColorType fDstColorType; 127 DstColorType fDstColorType;
129 float fScale; 128 float fScale;
130 }; 129 };
131 130
132 // Allows for testing of various implementations of Android's BitmapRegionDecode r
133 class BRDSrc : public Src {
134 public:
135 enum Mode {
136 // Decode the entire image as one region.
137 kFullImage_Mode,
138 // Splits the image into multiple regions using a divisor and decodes th e regions
139 // separately. Also, this test adds a border of a few pixels to each of the regions
140 // that it is decoding. This tests the behavior when a client asks for a region that
141 // does not fully fit in the image.
142 kDivisor_Mode,
143 };
144
145 BRDSrc(Path, SkBitmapRegionDecoderInterface::Strategy, Mode, CodecSrc::DstCo lorType, uint32_t);
146
147 static float GetScale(uint32_t sampleSize) { return 1.0f / (float) sampleSiz e; }
148
149 Error draw(SkCanvas*) const override;
150 SkISize size() const override;
151 Name name() const override;
152 bool veto(SinkFlags) const override;
153 private:
154 Path fPath;
155 SkBitmapRegionDecoderInterface::Strategy fStrategy;
156 Mode fMode;
157 CodecSrc::DstColorType fDstColorType;
158 uint32_t fSampleSize;
159 };
160 131
161 class ImageSrc : public Src { 132 class ImageSrc : public Src {
162 public: 133 public:
163 // divisor == 0 means decode the whole image 134 // divisor == 0 means decode the whole image
164 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr id. 135 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr id.
165 explicit ImageSrc(Path path, int divisor = 0); 136 explicit ImageSrc(Path path, int divisor = 0);
166 137
167 Error draw(SkCanvas*) const override; 138 Error draw(SkCanvas*) const override;
168 SkISize size() const override; 139 SkISize size() const override;
169 Name name() const override; 140 Name name() const override;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 310
340 class ViaTwice : public Via { 311 class ViaTwice : public Via {
341 public: 312 public:
342 explicit ViaTwice(Sink* sink) : Via(sink) {} 313 explicit ViaTwice(Sink* sink) : Via(sink) {}
343 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; 314 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
344 }; 315 };
345 316
346 } // namespace DM 317 } // namespace DM
347 318
348 #endif//DMSrcSink_DEFINED 319 #endif//DMSrcSink_DEFINED
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698