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 #if SK_SUPPORT_GPU |
| 859 const int maxDimension = factory.getContextInfo(fContextType, fContextOption
s). |
| 860 fGrContext->caps()->maxTextureSize(); |
| 861 if (maxDimension < SkTMax(size.width(), size.height())) { |
| 862 return Error::Nonfatal("Src too large to create a texture.\n"); |
| 863 } |
| 864 #endif |
| 865 |
858 SkAutoTUnref<SkSurface> surface( | 866 SkAutoTUnref<SkSurface> surface( |
859 NewGpuSurface(&factory, fContextType, fContextOptions, info, fSample
Count, fUseDIText)); | 867 NewGpuSurface(&factory, fContextType, fContextOptions, info, fSample
Count, fUseDIText)); |
860 if (!surface) { | 868 if (!surface) { |
861 return "Could not create a surface."; | 869 return "Could not create a surface."; |
862 } | 870 } |
863 if (FLAGS_preAbandonGpuContext) { | 871 if (FLAGS_preAbandonGpuContext) { |
864 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr); | 872 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr); |
865 factory.abandonContexts(); | 873 factory.abandonContexts(); |
866 } | 874 } |
867 SkCanvas* canvas = surface->getCanvas(); | 875 SkCanvas* canvas = surface->getCanvas(); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 skr.visit<void>(i, drawsAsSingletonPictures); | 1390 skr.visit<void>(i, drawsAsSingletonPictures); |
1383 } | 1391 } |
1384 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1392 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
1385 | 1393 |
1386 canvas->drawPicture(macroPic); | 1394 canvas->drawPicture(macroPic); |
1387 return check_against_reference(bitmap, src, fSink); | 1395 return check_against_reference(bitmap, src, fSink); |
1388 }); | 1396 }); |
1389 } | 1397 } |
1390 | 1398 |
1391 } // namespace DM | 1399 } // namespace DM |
OLD | NEW |