| 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" |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 SkAutoTDelete<SkCanvas> canvas(SkCreateNullCanvas()); | 783 SkAutoTDelete<SkCanvas> canvas(SkCreateNullCanvas()); |
| 784 return src.draw(canvas); | 784 return src.draw(canvas); |
| 785 } | 785 } |
| 786 | 786 |
| 787 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 787 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 788 | 788 |
| 789 DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?"); | 789 DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?"); |
| 790 | 790 |
| 791 GPUSink::GPUSink(GrContextFactory::GLContextType ct, | 791 GPUSink::GPUSink(GrContextFactory::GLContextType ct, |
| 792 GrContextFactory::GLContextOptions options, | 792 GrContextFactory::GLContextOptions options, |
| 793 GrGLStandard gpuAPI, |
| 793 int samples, | 794 int samples, |
| 794 bool diText, | 795 bool diText, |
| 795 bool threaded) | 796 bool threaded) |
| 796 : fContextType(ct) | 797 : fContextType(ct) |
| 797 , fContextOptions(options) | 798 , fContextOptions(options) |
| 799 , fGpuAPI(gpuAPI) |
| 798 , fSampleCount(samples) | 800 , fSampleCount(samples) |
| 799 , fUseDIText(diText) | 801 , fUseDIText(diText) |
| 800 , fThreaded(threaded) {} | 802 , fThreaded(threaded) {} |
| 801 | 803 |
| 802 int GPUSink::enclave() const { | 804 int GPUSink::enclave() const { |
| 803 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; | 805 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; |
| 804 } | 806 } |
| 805 | 807 |
| 806 void PreAbandonGpuContextErrorHandler(SkError, void*) {} | 808 void PreAbandonGpuContextErrorHandler(SkError, void*) {} |
| 807 | 809 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 821 if (FLAGS_batchBounds) { | 823 if (FLAGS_batchBounds) { |
| 822 grOptions.fDrawBatchBounds = true; | 824 grOptions.fDrawBatchBounds = true; |
| 823 } | 825 } |
| 824 src.modifyGrContextOptions(&grOptions); | 826 src.modifyGrContextOptions(&grOptions); |
| 825 | 827 |
| 826 GrContextFactory factory(grOptions); | 828 GrContextFactory factory(grOptions); |
| 827 const SkISize size = src.size(); | 829 const SkISize size = src.size(); |
| 828 const SkImageInfo info = | 830 const SkImageInfo info = |
| 829 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul
_SkAlphaType); | 831 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul
_SkAlphaType); |
| 830 SkAutoTUnref<SkSurface> surface( | 832 SkAutoTUnref<SkSurface> surface( |
| 831 NewGpuSurface(&factory, fContextType, fContextOptions, info, fSample
Count, fUseDIText)); | 833 NewGpuSurface(&factory, fContextType, fContextOptions, fGpuAPI, info
, fSampleCount, |
| 834 fUseDIText)); |
| 832 if (!surface) { | 835 if (!surface) { |
| 833 return "Could not create a surface."; | 836 return "Could not create a surface."; |
| 834 } | 837 } |
| 835 if (FLAGS_preAbandonGpuContext) { | 838 if (FLAGS_preAbandonGpuContext) { |
| 836 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr); | 839 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr); |
| 837 factory.abandonContexts(); | 840 factory.abandonContexts(); |
| 838 } | 841 } |
| 839 SkCanvas* canvas = surface->getCanvas(); | 842 SkCanvas* canvas = surface->getCanvas(); |
| 840 Error err = src.draw(canvas); | 843 Error err = src.draw(canvas); |
| 841 if (!err.isEmpty()) { | 844 if (!err.isEmpty()) { |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 skr.visit<void>(i, drawsAsSingletonPictures); | 1268 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1266 } | 1269 } |
| 1267 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1270 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1268 | 1271 |
| 1269 canvas->drawPicture(macroPic); | 1272 canvas->drawPicture(macroPic); |
| 1270 return ""; | 1273 return ""; |
| 1271 }); | 1274 }); |
| 1272 } | 1275 } |
| 1273 | 1276 |
| 1274 } // namespace DM | 1277 } // namespace DM |
| OLD | NEW |