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

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 2677633004: Handle shader construction failures gracefully (Closed)
Patch Set: comment Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/Image.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 sk_sp<PaintRecord> tilePicture = patternPicture.endRecording(); 313 sk_sp<PaintRecord> tilePicture = patternPicture.endRecording();
314 314
315 SkMatrix patternTransform; 315 SkMatrix patternTransform;
316 patternTransform.setTranslate(phase.x() + spacedTile.x(), 316 patternTransform.setTranslate(phase.x() + spacedTile.x(),
317 phase.y() + spacedTile.y()); 317 phase.y() + spacedTile.y());
318 318
319 PaintFlags paint; 319 PaintFlags paint;
320 paint.setShader(MakePaintShaderRecord(tilePicture, SkShader::kRepeat_TileMode, 320 paint.setShader(MakePaintShaderRecord(tilePicture, SkShader::kRepeat_TileMode,
321 SkShader::kRepeat_TileMode, 321 SkShader::kRepeat_TileMode,
322 &patternTransform, nullptr)); 322 &patternTransform, nullptr));
323 // If the shader could not be instantiated (e.g. non-invertible matrix),
324 // draw transparent.
325 // Note: we can't simply bail, because of arbitrary blend mode.
326 if (!paint.getShader())
327 paint.setColor(SK_ColorTRANSPARENT);
328
323 paint.setBlendMode(compositeOp); 329 paint.setBlendMode(compositeOp);
324 paint.setColorFilter(sk_ref_sp(context.getColorFilter())); 330 paint.setColorFilter(sk_ref_sp(context.getColorFilter()));
325 context.drawRect(dstRect, paint); 331 context.drawRect(dstRect, paint);
326 } 332 }
327 333
328 sk_sp<SkImage> SVGImage::imageForCurrentFrameForContainer( 334 sk_sp<SkImage> SVGImage::imageForCurrentFrameForContainer(
329 const KURL& url, 335 const KURL& url,
330 const IntSize& containerSize) { 336 const IntSize& containerSize) {
331 if (!m_page) 337 if (!m_page)
332 return nullptr; 338 return nullptr;
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 654 }
649 655
650 return m_page ? SizeAvailable : SizeUnavailable; 656 return m_page ? SizeAvailable : SizeUnavailable;
651 } 657 }
652 658
653 String SVGImage::filenameExtension() const { 659 String SVGImage::filenameExtension() const {
654 return "svg"; 660 return "svg";
655 } 661 }
656 662
657 } // namespace blink 663 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/Image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698