Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Unified Diff: dm/DMSrcSink.cpp

Issue 1676663002: Test CodecImageGenerator on GPU bots (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Surround size check with SK_SUPPORT_GPU Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/dm_flags.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 9576f69d6708cc7214e87669248dafb1e8a45ca6..a0dcb1cfc5b08ce16c3455f5097b44ba288b233a 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -855,6 +855,14 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
const SkISize size = src.size();
const SkImageInfo info =
SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul_SkAlphaType);
+#if SK_SUPPORT_GPU
+ const int maxDimension = factory.getContextInfo(fContextType, fContextOptions).
+ fGrContext->caps()->maxTextureSize();
+ if (maxDimension < SkTMax(size.width(), size.height())) {
+ return Error::Nonfatal("Src too large to create a texture.\n");
+ }
+#endif
+
SkAutoTUnref<SkSurface> surface(
NewGpuSurface(&factory, fContextType, fContextOptions, info, fSampleCount, fUseDIText));
if (!surface) {
« no previous file with comments | « no previous file | tools/dm_flags.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698