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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 863723002: image subsetting as part of the name instead of a separate source type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "DMSrcSink.h" 1 #include "DMSrcSink.h"
2 #include "SamplePipeControllers.h" 2 #include "SamplePipeControllers.h"
3 #include "SkCommonFlags.h" 3 #include "SkCommonFlags.h"
4 #include "SkDocument.h" 4 #include "SkDocument.h"
5 #include "SkMultiPictureDraw.h" 5 #include "SkMultiPictureDraw.h"
6 #include "SkOSFile.h" 6 #include "SkOSFile.h"
7 #include "SkPictureRecorder.h" 7 #include "SkPictureRecorder.h"
8 #include "SkRandom.h" 8 #include "SkRandom.h"
9 9
10 namespace DM { 10 namespace DM {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (!encoded || !SkImageDecoder::DecodeMemory(encoded->data(), 82 if (!encoded || !SkImageDecoder::DecodeMemory(encoded->data(),
83 encoded->size(), 83 encoded->size(),
84 &bitmap, 84 &bitmap,
85 kUnknown_SkColorType, 85 kUnknown_SkColorType,
86 SkImageDecoder::kDecodeBounds_ Mode)) { 86 SkImageDecoder::kDecodeBounds_ Mode)) {
87 return SkISize::Make(0,0); 87 return SkISize::Make(0,0);
88 } 88 }
89 return bitmap.dimensions(); 89 return bitmap.dimensions();
90 } 90 }
91 91
92 Name ImageSrc::name() const { return SkOSPath::Basename(fPath.c_str()); } 92 Name ImageSrc::name() const {
93 Name name = SkOSPath::Basename(fPath.c_str());
94 if (fSubsets > 0) {
95 name.appendf("-%d-subsets", fSubsets);
96 }
97 return name;
98 }
93 99
94 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 100 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
95 101
96 static const SkRect kSKPViewport = {0,0, 1000,1000}; 102 static const SkRect kSKPViewport = {0,0, 1000,1000};
97 103
98 SKPSrc::SKPSrc(SkString path) : fPath(path) {} 104 SKPSrc::SKPSrc(SkString path) : fPath(path) {}
99 105
100 Error SKPSrc::draw(SkCanvas* canvas) const { 106 Error SKPSrc::draw(SkCanvas* canvas) const {
101 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(fPath.c_str())); 107 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(fPath.c_str()));
102 if (!stream) { 108 if (!stream) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 surfaces.unrefAll(); 347 surfaces.unrefAll();
342 return ""; 348 return "";
343 } 349 }
344 SkISize size() const SK_OVERRIDE { return fSize; } 350 SkISize size() const SK_OVERRIDE { return fSize; }
345 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 351 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this.
346 } proxy(fW, fH, pic, src.size()); 352 } proxy(fW, fH, pic, src.size());
347 return fSink->draw(proxy, bitmap, stream); 353 return fSink->draw(proxy, bitmap, stream);
348 } 354 }
349 355
350 } // namespace DM 356 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698