| 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 | 803 |
| 804 int GPUSink::enclave() const { | 804 int GPUSink::enclave() const { |
| 805 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; | 805 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; |
| 806 } | 806 } |
| 807 | 807 |
| 808 void PreAbandonGpuContextErrorHandler(SkError, void*) {} | 808 void PreAbandonGpuContextErrorHandler(SkError, void*) {} |
| 809 | 809 |
| 810 DEFINE_bool(imm, false, "Run gpu configs in immediate mode."); | 810 DEFINE_bool(imm, false, "Run gpu configs in immediate mode."); |
| 811 DEFINE_bool(batchClip, false, "Clip each GrBatch to its device bounds for testin
g."); | 811 DEFINE_bool(batchClip, false, "Clip each GrBatch to its device bounds for testin
g."); |
| 812 DEFINE_bool(batchBounds, false, "Draw a wireframe bounds of each GrBatch."); | 812 DEFINE_bool(batchBounds, false, "Draw a wireframe bounds of each GrBatch."); |
| 813 DEFINE_int32(batchLookback, -1, "Maximum GrBatch lookback for combining, negativ
e means default."); |
| 813 | 814 |
| 814 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
nst { | 815 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
nst { |
| 815 GrContextOptions grOptions; | 816 GrContextOptions grOptions; |
| 816 if (FLAGS_imm) { | 817 grOptions.fImmediateMode = FLAGS_imm; |
| 817 grOptions.fImmediateMode = true; | 818 grOptions.fClipBatchToBounds = FLAGS_batchClip; |
| 818 } | 819 grOptions.fDrawBatchBounds = FLAGS_batchBounds; |
| 819 if (FLAGS_batchClip) { | 820 grOptions.fMaxBatchLookback = FLAGS_batchLookback; |
| 820 grOptions.fClipBatchToBounds = true; | |
| 821 } | |
| 822 | 821 |
| 823 if (FLAGS_batchBounds) { | |
| 824 grOptions.fDrawBatchBounds = true; | |
| 825 } | |
| 826 src.modifyGrContextOptions(&grOptions); | 822 src.modifyGrContextOptions(&grOptions); |
| 827 | 823 |
| 828 GrContextFactory factory(grOptions); | 824 GrContextFactory factory(grOptions); |
| 829 const SkISize size = src.size(); | 825 const SkISize size = src.size(); |
| 830 const SkImageInfo info = | 826 const SkImageInfo info = |
| 831 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul
_SkAlphaType); | 827 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul
_SkAlphaType); |
| 832 SkAutoTUnref<SkSurface> surface( | 828 SkAutoTUnref<SkSurface> surface( |
| 833 NewGpuSurface(&factory, fContextType, fContextOptions, fGpuAPI, info
, fSampleCount, | 829 NewGpuSurface(&factory, fContextType, fContextOptions, fGpuAPI, info
, fSampleCount, |
| 834 fUseDIText)); | 830 fUseDIText)); |
| 835 if (!surface) { | 831 if (!surface) { |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 skr.visit<void>(i, drawsAsSingletonPictures); | 1264 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1269 } | 1265 } |
| 1270 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1266 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1271 | 1267 |
| 1272 canvas->drawPicture(macroPic); | 1268 canvas->drawPicture(macroPic); |
| 1273 return ""; | 1269 return ""; |
| 1274 }); | 1270 }); |
| 1275 } | 1271 } |
| 1276 | 1272 |
| 1277 } // namespace DM | 1273 } // namespace DM |
| OLD | NEW |