Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "SkCodec.h" | 4 #include "SkCodec.h" |
| 5 #include "SkDocument.h" | 5 #include "SkDocument.h" |
| 6 #include "SkError.h" | 6 #include "SkError.h" |
| 7 #include "SkMultiPictureDraw.h" | 7 #include "SkMultiPictureDraw.h" |
| 8 #include "SkNullCanvas.h" | 8 #include "SkNullCanvas.h" |
| 9 #include "SkOSFile.h" | 9 #include "SkOSFile.h" |
| 10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 Error SKPSrc::draw(SkCanvas* canvas) const { | 194 Error SKPSrc::draw(SkCanvas* canvas) const { |
| 195 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fPath.c_str())); | 195 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fPath.c_str())); |
| 196 if (!stream) { | 196 if (!stream) { |
| 197 return SkStringPrintf("Couldn't read %s.", fPath.c_str()); | 197 return SkStringPrintf("Couldn't read %s.", fPath.c_str()); |
| 198 } | 198 } |
| 199 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream)); | 199 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream)); |
| 200 if (!pic) { | 200 if (!pic) { |
| 201 return SkStringPrintf("Couldn't decode %s as a picture.", fPath.c_str()) ; | 201 return SkStringPrintf("Couldn't decode %s as a picture.", fPath.c_str()) ; |
| 202 } | 202 } |
| 203 stream.reset((SkStream*)NULL); // Might as well drop this when we're done w ith it. | 203 stream.reset((SkStream*)NULL); // Might as well drop this when we're done w ith it. |
| 204 | |
| 204 canvas->clipRect(kSKPViewport); | 205 canvas->clipRect(kSKPViewport); |
| 206 // Testing TextBlob batching requires that we see individual text blobs more than once | |
| 207 //#define DOUBLE_LOOP | |
|
bsalomon
2015/03/24 16:27:53
Let's make this real...
Maybe make dm take a par
joshualitt
2015/03/25 14:13:37
Acknowledged.
| |
| 208 #ifdef DOUBLE_LOOP | |
| 209 { | |
| 210 SkAutoCanvasRestore acr(canvas, true); | |
| 211 #endif | |
| 212 canvas->drawPicture(pic); | |
| 213 #ifdef DOUBLE_LOOP | |
| 214 } | |
| 215 canvas->clear(0); | |
| 205 canvas->drawPicture(pic); | 216 canvas->drawPicture(pic); |
| 217 #endif | |
| 206 return ""; | 218 return ""; |
| 207 } | 219 } |
| 208 | 220 |
| 209 SkISize SKPSrc::size() const { | 221 SkISize SKPSrc::size() const { |
| 210 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fPath.c_str())); | 222 SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(fPath.c_str())); |
| 211 if (!stream) { | 223 if (!stream) { |
| 212 return SkISize::Make(0,0); | 224 return SkISize::Make(0,0); |
| 213 } | 225 } |
| 214 SkPictInfo info; | 226 SkPictInfo info; |
| 215 if (!SkPicture::InternalOnly_StreamIsSKP(stream, &info)) { | 227 if (!SkPicture::InternalOnly_StreamIsSKP(stream, &info)) { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 574 surfaces.unrefAll(); | 586 surfaces.unrefAll(); |
| 575 return ""; | 587 return ""; |
| 576 } | 588 } |
| 577 SkISize size() const SK_OVERRIDE { return fSize; } | 589 SkISize size() const SK_OVERRIDE { return fSize; } |
| 578 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. | 590 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. |
| 579 } proxy(fW, fH, pic, src.size()); | 591 } proxy(fW, fH, pic, src.size()); |
| 580 return fSink->draw(proxy, bitmap, stream, log); | 592 return fSink->draw(proxy, bitmap, stream, log); |
| 581 } | 593 } |
| 582 | 594 |
| 583 } // namespace DM | 595 } // namespace DM |
| OLD | NEW |