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 #include "DMSrcSink.h" | 8 #include "DMSrcSink.h" |
9 #include "SamplePipeControllers.h" | 9 #include "SamplePipeControllers.h" |
10 #include "SkAndroidCodec.h" | 10 #include "SkAndroidCodec.h" |
11 #include "SkBitmapRegionDecoderPriv.h" | |
12 #include "SkCodec.h" | 11 #include "SkCodec.h" |
13 #include "SkCommonFlags.h" | 12 #include "SkCommonFlags.h" |
14 #include "SkData.h" | 13 #include "SkData.h" |
15 #include "SkDocument.h" | 14 #include "SkDocument.h" |
16 #include "SkError.h" | 15 #include "SkError.h" |
17 #include "SkImageGenerator.h" | 16 #include "SkImageGenerator.h" |
18 #include "SkMultiPictureDraw.h" | 17 #include "SkMultiPictureDraw.h" |
19 #include "SkNullCanvas.h" | 18 #include "SkNullCanvas.h" |
20 #include "SkOSFile.h" | 19 #include "SkOSFile.h" |
21 #include "SkPictureData.h" | 20 #include "SkPictureData.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 static SkString get_scaled_name(const Path& path, float scale) { | 220 static SkString get_scaled_name(const Path& path, float scale) { |
222 return SkStringPrintf("%s_%.3f", SkOSPath::Basename(path.c_str()).c_str(), s
cale); | 221 return SkStringPrintf("%s_%.3f", SkOSPath::Basename(path.c_str()).c_str(), s
cale); |
223 } | 222 } |
224 | 223 |
225 Name BRDSrc::name() const { | 224 Name BRDSrc::name() const { |
226 // We will replicate the names used by CodecSrc so that images can | 225 // We will replicate the names used by CodecSrc so that images can |
227 // be compared in Gold. | 226 // be compared in Gold. |
228 if (1 == fSampleSize) { | 227 if (1 == fSampleSize) { |
229 return SkOSPath::Basename(fPath.c_str()); | 228 return SkOSPath::Basename(fPath.c_str()); |
230 } | 229 } |
231 return get_scaled_name(fPath, get_scale_from_sample_size(fSampleSize)); | 230 return get_scaled_name(fPath, 1.0f / (float) fSampleSize); |
232 } | 231 } |
233 | 232 |
234 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 233 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
235 | 234 |
236 CodecSrc::CodecSrc(Path path, Mode mode, DstColorType dstColorType, float scale) | 235 CodecSrc::CodecSrc(Path path, Mode mode, DstColorType dstColorType, float scale) |
237 : fPath(path) | 236 : fPath(path) |
238 , fMode(mode) | 237 , fMode(mode) |
239 , fDstColorType(dstColorType) | 238 , fDstColorType(dstColorType) |
240 , fScale(scale) | 239 , fScale(scale) |
241 {} | 240 {} |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 } | 753 } |
755 return codec->getSampledDimensions(fSampleSize); | 754 return codec->getSampledDimensions(fSampleSize); |
756 } | 755 } |
757 | 756 |
758 Name AndroidCodecSrc::name() const { | 757 Name AndroidCodecSrc::name() const { |
759 // We will replicate the names used by CodecSrc so that images can | 758 // We will replicate the names used by CodecSrc so that images can |
760 // be compared in Gold. | 759 // be compared in Gold. |
761 if (1 == fSampleSize) { | 760 if (1 == fSampleSize) { |
762 return SkOSPath::Basename(fPath.c_str()); | 761 return SkOSPath::Basename(fPath.c_str()); |
763 } | 762 } |
764 return get_scaled_name(fPath, get_scale_from_sample_size(fSampleSize)); | 763 return get_scaled_name(fPath, 1.0f / (float) fSampleSize); |
765 } | 764 } |
766 | 765 |
767 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 766 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
768 | 767 |
769 ImageSrc::ImageSrc(Path path) : fPath(path) {} | 768 ImageSrc::ImageSrc(Path path) : fPath(path) {} |
770 | 769 |
771 bool ImageSrc::veto(SinkFlags flags) const { | 770 bool ImageSrc::veto(SinkFlags flags) const { |
772 // No need to test decoding to non-raster or indirect backend. | 771 // No need to test decoding to non-raster or indirect backend. |
773 // TODO: Instead, use lazy decoding to allow the GPU to handle cases like YU
V. | 772 // TODO: Instead, use lazy decoding to allow the GPU to handle cases like YU
V. |
774 return flags.type != SinkFlags::kRaster | 773 return flags.type != SinkFlags::kRaster |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 skr.visit<void>(i, drawsAsSingletonPictures); | 1332 skr.visit<void>(i, drawsAsSingletonPictures); |
1334 } | 1333 } |
1335 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1334 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
1336 | 1335 |
1337 canvas->drawPicture(macroPic); | 1336 canvas->drawPicture(macroPic); |
1338 return ""; | 1337 return ""; |
1339 }); | 1338 }); |
1340 } | 1339 } |
1341 | 1340 |
1342 } // namespace DM | 1341 } // namespace DM |
OLD | NEW |