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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
848 grOptions.fClipBatchToBounds = FLAGS_batchClip; | 848 grOptions.fClipBatchToBounds = FLAGS_batchClip; |
849 grOptions.fDrawBatchBounds = FLAGS_batchBounds; | 849 grOptions.fDrawBatchBounds = FLAGS_batchBounds; |
850 grOptions.fMaxBatchLookback = FLAGS_batchLookback; | 850 grOptions.fMaxBatchLookback = FLAGS_batchLookback; |
851 | 851 |
852 src.modifyGrContextOptions(&grOptions); | 852 src.modifyGrContextOptions(&grOptions); |
853 | 853 |
854 GrContextFactory factory(grOptions); | 854 GrContextFactory factory(grOptions); |
855 const SkISize size = src.size(); | 855 const SkISize size = src.size(); |
856 const SkImageInfo info = | 856 const SkImageInfo info = |
857 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul _SkAlphaType); | 857 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul _SkAlphaType); |
858 const int maxDimension = factory.getContextInfo(fContextType, fContextOption s). | |
859 fGrContext->caps()->maxTextureSize(); | |
860 if (maxDimension < SkTMax(size.width(), size.height())) { | |
scroggo
2016/02/08 16:00:09
I don't know enough about the GPU code to know if
msarett
2016/02/08 16:20:06
I had the same confusion before asking Brian :).
scroggo
2016/02/08 16:23:14
Agree that the variable name helps.
| |
861 return Error::Nonfatal("Src too large to create a texture.\n"); | |
862 } | |
863 | |
858 SkAutoTUnref<SkSurface> surface( | 864 SkAutoTUnref<SkSurface> surface( |
859 NewGpuSurface(&factory, fContextType, fContextOptions, info, fSample Count, fUseDIText)); | 865 NewGpuSurface(&factory, fContextType, fContextOptions, info, fSample Count, fUseDIText)); |
860 if (!surface) { | 866 if (!surface) { |
861 return "Could not create a surface."; | 867 return "Could not create a surface."; |
862 } | 868 } |
863 if (FLAGS_preAbandonGpuContext) { | 869 if (FLAGS_preAbandonGpuContext) { |
864 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr); | 870 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr); |
865 factory.abandonContexts(); | 871 factory.abandonContexts(); |
866 } | 872 } |
867 SkCanvas* canvas = surface->getCanvas(); | 873 SkCanvas* canvas = surface->getCanvas(); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1382 skr.visit<void>(i, drawsAsSingletonPictures); | 1388 skr.visit<void>(i, drawsAsSingletonPictures); |
1383 } | 1389 } |
1384 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1390 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
1385 | 1391 |
1386 canvas->drawPicture(macroPic); | 1392 canvas->drawPicture(macroPic); |
1387 return check_against_reference(bitmap, src, fSink); | 1393 return check_against_reference(bitmap, src, fSink); |
1388 }); | 1394 }); |
1389 } | 1395 } |
1390 | 1396 |
1391 } // namespace DM | 1397 } // namespace DM |
OLD | NEW |