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 "SkCodec.h" | 10 #include "SkCodec.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 SkISize GMSrc::size() const { | 50 SkISize GMSrc::size() const { |
51 SkAutoTDelete<skiagm::GM> gm(fFactory(NULL)); | 51 SkAutoTDelete<skiagm::GM> gm(fFactory(NULL)); |
52 return gm->getISize(); | 52 return gm->getISize(); |
53 } | 53 } |
54 | 54 |
55 Name GMSrc::name() const { | 55 Name GMSrc::name() const { |
56 SkAutoTDelete<skiagm::GM> gm(fFactory(NULL)); | 56 SkAutoTDelete<skiagm::GM> gm(fFactory(NULL)); |
57 return gm->getName(); | 57 return gm->getName(); |
58 } | 58 } |
59 | 59 |
| 60 void GMSrc::modifyGrContextOptions(GrContextOptions* options) const { |
| 61 SkAutoTDelete<skiagm::GM> gm(fFactory(NULL)); |
| 62 gm->modifyGrContextOptions(options); |
| 63 } |
| 64 |
60 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 65 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
61 | 66 |
62 CodecSrc::CodecSrc(Path path, Mode mode, DstColorType dstColorType) | 67 CodecSrc::CodecSrc(Path path, Mode mode, DstColorType dstColorType) |
63 : fPath(path) | 68 : fPath(path) |
64 , fMode(mode) | 69 , fMode(mode) |
65 , fDstColorType(dstColorType) | 70 , fDstColorType(dstColorType) |
66 {} | 71 {} |
67 | 72 |
68 Error CodecSrc::draw(SkCanvas* canvas) const { | 73 Error CodecSrc::draw(SkCanvas* canvas) const { |
69 SkImageInfo canvasInfo; | 74 SkImageInfo canvasInfo; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 , fUseDFText(dfText) | 338 , fUseDFText(dfText) |
334 , fThreaded(threaded) {} | 339 , fThreaded(threaded) {} |
335 | 340 |
336 int GPUSink::enclave() const { | 341 int GPUSink::enclave() const { |
337 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; | 342 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; |
338 } | 343 } |
339 | 344 |
340 void PreAbandonGpuContextErrorHandler(SkError, void*) {} | 345 void PreAbandonGpuContextErrorHandler(SkError, void*) {} |
341 | 346 |
342 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
nst { | 347 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
nst { |
343 GrContextFactory factory; | 348 GrContextOptions options; |
| 349 src.modifyGrContextOptions(&options); |
| 350 |
| 351 GrContextFactory factory(options); |
344 const SkISize size = src.size(); | 352 const SkISize size = src.size(); |
345 const SkImageInfo info = | 353 const SkImageInfo info = |
346 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul
_SkAlphaType); | 354 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul
_SkAlphaType); |
347 SkAutoTUnref<SkSurface> surface( | 355 SkAutoTUnref<SkSurface> surface( |
348 NewGpuSurface(&factory, fContextType, fGpuAPI, info, fSampleCount, f
UseDFText)); | 356 NewGpuSurface(&factory, fContextType, fGpuAPI, info, fSampleCount, f
UseDFText)); |
349 if (!surface) { | 357 if (!surface) { |
350 return "Could not create a surface."; | 358 return "Could not create a surface."; |
351 } | 359 } |
352 if (FLAGS_preAbandonGpuContext) { | 360 if (FLAGS_preAbandonGpuContext) { |
353 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, NULL); | 361 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, NULL); |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 skr.visit<void>(i, drawsAsSingletonPictures); | 788 skr.visit<void>(i, drawsAsSingletonPictures); |
781 } | 789 } |
782 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 790 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
783 | 791 |
784 canvas->drawPicture(macroPic); | 792 canvas->drawPicture(macroPic); |
785 return ""; | 793 return ""; |
786 }); | 794 }); |
787 } | 795 } |
788 | 796 |
789 } // namespace DM | 797 } // namespace DM |
OLD | NEW |