| 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 "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 #include "SkSVGDevice.h" |
| 9 #include "SkStream.h" | 10 #include "SkStream.h" |
| 10 | 11 |
| 11 namespace DM { | 12 namespace DM { |
| 12 | 13 |
| 13 GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {} | 14 GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {} |
| 14 | 15 |
| 15 Error GMSrc::draw(SkCanvas* canvas) const { | 16 Error GMSrc::draw(SkCanvas* canvas) const { |
| 16 SkAutoTDelete<skiagm::GM> gm(fFactory(NULL)); | 17 SkAutoTDelete<skiagm::GM> gm(fFactory(NULL)); |
| 17 canvas->concat(gm->getInitialTransform()); | 18 canvas->concat(gm->getInitialTransform()); |
| 18 gm->draw(canvas); | 19 gm->draw(canvas); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 if (!err.isEmpty()) { | 220 if (!err.isEmpty()) { |
| 220 return err; | 221 return err; |
| 221 } | 222 } |
| 222 SkAutoTUnref<SkPicture> pic(recorder.endRecording()); | 223 SkAutoTUnref<SkPicture> pic(recorder.endRecording()); |
| 223 pic->serialize(dst); | 224 pic->serialize(dst); |
| 224 return ""; | 225 return ""; |
| 225 } | 226 } |
| 226 | 227 |
| 227 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 228 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 228 | 229 |
| 230 SVGSink::SVGSink() {} |
| 231 |
| 232 Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst) const { |
| 233 SkAutoTUnref<SkBaseDevice> device(SkSVGDevice::Create(src.size(), dst)); |
| 234 SkCanvas canvas(device); |
| 235 return src.draw(&canvas); |
| 236 } |
| 237 |
| 238 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 239 |
| 229 RasterSink::RasterSink(SkColorType colorType) : fColorType(colorType) {} | 240 RasterSink::RasterSink(SkColorType colorType) : fColorType(colorType) {} |
| 230 | 241 |
| 231 Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*) const { | 242 Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*) const { |
| 232 const SkISize size = src.size(); | 243 const SkISize size = src.size(); |
| 233 // If there's an appropriate alpha type for this color type, use it, otherwi
se use premul. | 244 // If there's an appropriate alpha type for this color type, use it, otherwi
se use premul. |
| 234 SkAlphaType alphaType = kPremul_SkAlphaType; | 245 SkAlphaType alphaType = kPremul_SkAlphaType; |
| 235 (void)SkColorTypeValidateAlphaType(fColorType, alphaType, &alphaType); | 246 (void)SkColorTypeValidateAlphaType(fColorType, alphaType, &alphaType); |
| 236 | 247 |
| 237 dst->allocPixels(SkImageInfo::Make(size.width(), size.height(), fColorType,
alphaType)); | 248 dst->allocPixels(SkImageInfo::Make(size.width(), size.height(), fColorType,
alphaType)); |
| 238 dst->eraseColor(SK_ColorTRANSPARENT); | 249 dst->eraseColor(SK_ColorTRANSPARENT); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 surfaces.unrefAll(); | 392 surfaces.unrefAll(); |
| 382 return ""; | 393 return ""; |
| 383 } | 394 } |
| 384 SkISize size() const SK_OVERRIDE { return fSize; } | 395 SkISize size() const SK_OVERRIDE { return fSize; } |
| 385 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. | 396 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. |
| 386 } proxy(fW, fH, pic, src.size()); | 397 } proxy(fW, fH, pic, src.size()); |
| 387 return fSink->draw(proxy, bitmap, stream); | 398 return fSink->draw(proxy, bitmap, stream); |
| 388 } | 399 } |
| 389 | 400 |
| 390 } // namespace DM | 401 } // namespace DM |
| OLD | NEW |