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

Side by Side Diff: dm/DMSrcSink.h

Issue 1406223002: Create an SkAndroidCodec API separate from SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Win bot fix Created 5 years, 2 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
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 Name name() const override; 97 Name name() const override;
98 void modifyGrContextOptions(GrContextOptions* options) const override; 98 void modifyGrContextOptions(GrContextOptions* options) const override;
99 99
100 private: 100 private:
101 skiagm::GMRegistry::Factory fFactory; 101 skiagm::GMRegistry::Factory fFactory;
102 }; 102 };
103 103
104 class CodecSrc : public Src { 104 class CodecSrc : public Src {
105 public: 105 public:
106 enum Mode { 106 enum Mode {
107 kScaledCodec_Mode,
108 kCodec_Mode, 107 kCodec_Mode,
109 kScanline_Mode, 108 kScanline_Mode,
110 kScanline_Subset_Mode, 109 kScanline_Subset_Mode,
111 kStripe_Mode, // Tests the skipping of scanlines 110 kStripe_Mode, // Tests the skipping of scanlines
112 kSubset_Mode, // For codecs that support subsets directly. 111 kSubset_Mode, // For codecs that support subsets directly.
113 }; 112 };
114 enum DstColorType { 113 enum DstColorType {
115 kGetFromCanvas_DstColorType, 114 kGetFromCanvas_DstColorType,
116 kIndex8_Always_DstColorType, 115 kIndex8_Always_DstColorType,
117 kGrayscale_Always_DstColorType, 116 kGrayscale_Always_DstColorType,
118 }; 117 };
119 CodecSrc(Path, Mode, DstColorType, float); 118 CodecSrc(Path, Mode, DstColorType, float);
120 119
121 Error draw(SkCanvas*) const override; 120 Error draw(SkCanvas*) const override;
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
131 class AndroidCodecSrc : public Src {
132 public:
133 enum Mode {
134 kFullImage_Mode,
135 // Splits the image into multiple subsets using a divisor and decodes th e subsets
136 // separately.
137 kDivisor_Mode,
138 };
139
140 AndroidCodecSrc(Path, Mode, CodecSrc::DstColorType, int sampleSize);
141
142 Error draw(SkCanvas*) const override;
143 SkISize size() const override;
144 Name name() const override;
145 bool veto(SinkFlags) const override;
146 private:
147 Path fPath;
148 Mode fMode;
149 CodecSrc::DstColorType fDstColorType;
150 int fSampleSize;
151 };
152
132 // Allows for testing of various implementations of Android's BitmapRegionDecode r 153 // Allows for testing of various implementations of Android's BitmapRegionDecode r
133 class BRDSrc : public Src { 154 class BRDSrc : public Src {
134 public: 155 public:
135 enum Mode { 156 enum Mode {
136 // Decode the entire image as one region. 157 // Decode the entire image as one region.
137 kFullImage_Mode, 158 kFullImage_Mode,
138 // Splits the image into multiple regions using a divisor and decodes th e regions 159 // 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 160 // 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 161 // that it is decoding. This tests the behavior when a client asks for a region that
141 // does not fully fit in the image. 162 // does not fully fit in the image.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 362
342 class ViaTwice : public Via { 363 class ViaTwice : public Via {
343 public: 364 public:
344 explicit ViaTwice(Sink* sink) : Via(sink) {} 365 explicit ViaTwice(Sink* sink) : Via(sink) {}
345 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; 366 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
346 }; 367 };
347 368
348 } // namespace DM 369 } // namespace DM
349 370
350 #endif//DMSrcSink_DEFINED 371 #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