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 "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 } | 849 } |
850 | 850 |
851 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 851 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
852 | 852 |
853 DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?"); | 853 DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?"); |
854 | 854 |
855 GPUSink::GPUSink(GrContextFactory::GLContextType ct, | 855 GPUSink::GPUSink(GrContextFactory::GLContextType ct, |
856 GrContextFactory::GLContextOptions options, | 856 GrContextFactory::GLContextOptions options, |
857 int samples, | 857 int samples, |
858 bool diText, | 858 bool diText, |
| 859 SkColorType colorType, |
| 860 SkColorProfileType profileType, |
859 bool threaded) | 861 bool threaded) |
860 : fContextType(ct) | 862 : fContextType(ct) |
861 , fContextOptions(options) | 863 , fContextOptions(options) |
862 , fSampleCount(samples) | 864 , fSampleCount(samples) |
863 , fUseDIText(diText) | 865 , fUseDIText(diText) |
| 866 , fColorType(colorType) |
| 867 , fProfileType(profileType) |
864 , fThreaded(threaded) {} | 868 , fThreaded(threaded) {} |
865 | 869 |
866 void PreAbandonGpuContextErrorHandler(SkError, void*) {} | 870 void PreAbandonGpuContextErrorHandler(SkError, void*) {} |
867 | 871 |
868 DEFINE_bool(imm, false, "Run gpu configs in immediate mode."); | 872 DEFINE_bool(imm, false, "Run gpu configs in immediate mode."); |
869 DEFINE_bool(batchClip, false, "Clip each GrBatch to its device bounds for testin
g."); | 873 DEFINE_bool(batchClip, false, "Clip each GrBatch to its device bounds for testin
g."); |
870 DEFINE_bool(batchBounds, false, "Draw a wireframe bounds of each GrBatch."); | 874 DEFINE_bool(batchBounds, false, "Draw a wireframe bounds of each GrBatch."); |
871 DEFINE_int32(batchLookback, -1, "Maximum GrBatch lookback for combining, negativ
e means default."); | 875 DEFINE_int32(batchLookback, -1, "Maximum GrBatch lookback for combining, negativ
e means default."); |
872 | 876 |
873 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
nst { | 877 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
nst { |
874 GrContextOptions grOptions; | 878 GrContextOptions grOptions; |
875 grOptions.fImmediateMode = FLAGS_imm; | 879 grOptions.fImmediateMode = FLAGS_imm; |
876 grOptions.fClipBatchToBounds = FLAGS_batchClip; | 880 grOptions.fClipBatchToBounds = FLAGS_batchClip; |
877 grOptions.fDrawBatchBounds = FLAGS_batchBounds; | 881 grOptions.fDrawBatchBounds = FLAGS_batchBounds; |
878 grOptions.fMaxBatchLookback = FLAGS_batchLookback; | 882 grOptions.fMaxBatchLookback = FLAGS_batchLookback; |
879 | 883 |
880 src.modifyGrContextOptions(&grOptions); | 884 src.modifyGrContextOptions(&grOptions); |
881 | 885 |
882 GrContextFactory factory(grOptions); | 886 GrContextFactory factory(grOptions); |
883 const SkISize size = src.size(); | 887 const SkISize size = src.size(); |
884 const SkImageInfo info = | 888 const SkImageInfo info = |
885 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul
_SkAlphaType); | 889 SkImageInfo::Make(size.width(), size.height(), fColorType, |
| 890 kPremul_SkAlphaType, fProfileType); |
886 #if SK_SUPPORT_GPU | 891 #if SK_SUPPORT_GPU |
887 const int maxDimension = factory.getContextInfo(fContextType, fContextOption
s). | 892 const int maxDimension = factory.getContextInfo(fContextType, fContextOption
s). |
888 fGrContext->caps()->maxTextureSize(); | 893 fGrContext->caps()->maxTextureSize(); |
889 if (maxDimension < SkTMax(size.width(), size.height())) { | 894 if (maxDimension < SkTMax(size.width(), size.height())) { |
890 return Error::Nonfatal("Src too large to create a texture.\n"); | 895 return Error::Nonfatal("Src too large to create a texture.\n"); |
891 } | 896 } |
892 #endif | 897 #endif |
893 | 898 |
894 SkAutoTUnref<SkSurface> surface( | 899 SkAutoTUnref<SkSurface> surface( |
895 NewGpuSurface(&factory, fContextType, fContextOptions, info, fSample
Count, fUseDIText)); | 900 NewGpuSurface(&factory, fContextType, fContextOptions, info, fSample
Count, fUseDIText)); |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 skr.visit<void>(i, drawsAsSingletonPictures); | 1427 skr.visit<void>(i, drawsAsSingletonPictures); |
1423 } | 1428 } |
1424 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1429 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
1425 | 1430 |
1426 canvas->drawPicture(macroPic); | 1431 canvas->drawPicture(macroPic); |
1427 return check_against_reference(bitmap, src, fSink); | 1432 return check_against_reference(bitmap, src, fSink); |
1428 }); | 1433 }); |
1429 } | 1434 } |
1430 | 1435 |
1431 } // namespace DM | 1436 } // namespace DM |
OLD | NEW |