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

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: Disable png subsets for SkImageDecoder 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"
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 SkISize size() const override; 122 SkISize size() const override;
122 Name name() const override; 123 Name name() const override;
123 bool veto(SinkFlags) const override; 124 bool veto(SinkFlags) const override;
124 private: 125 private:
125 Path fPath; 126 Path fPath;
126 Mode fMode; 127 Mode fMode;
127 DstColorType fDstColorType; 128 DstColorType fDstColorType;
128 float fScale; 129 float fScale;
129 }; 130 };
130 131
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 };
131 160
132 class ImageSrc : public Src { 161 class ImageSrc : public Src {
133 public: 162 public:
134 // divisor == 0 means decode the whole image 163 // divisor == 0 means decode the whole image
135 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr id. 164 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr id.
136 explicit ImageSrc(Path path, int divisor = 0); 165 explicit ImageSrc(Path path, int divisor = 0);
137 166
138 Error draw(SkCanvas*) const override; 167 Error draw(SkCanvas*) const override;
139 SkISize size() const override; 168 SkISize size() const override;
140 Name name() const override; 169 Name name() const override;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 339
311 class ViaTwice : public Via { 340 class ViaTwice : public Via {
312 public: 341 public:
313 explicit ViaTwice(Sink* sink) : Via(sink) {} 342 explicit ViaTwice(Sink* sink) : Via(sink) {}
314 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; 343 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
315 }; 344 };
316 345
317 } // namespace DM 346 } // namespace DM
318 347
319 #endif//DMSrcSink_DEFINED 348 #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