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

Side by Side Diff: Source/core/platform/graphics/Pattern.cpp

Issue 57643005: [2D Canvas] Fix crash in createPattern method when using invalid canvas as source. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/canvas/canvas-large-pattern-expected.txt ('k') | no next file » | 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, 2007, 2008 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
4 * Copyright (C) 2013 Google, Inc. All rights reserved. 4 * Copyright (C) 2013 Google, Inc. 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 24 matching lines...) Expand all
35 #include "core/platform/graphics/Image.h" 35 #include "core/platform/graphics/Image.h"
36 #include "core/platform/graphics/skia/SkiaUtils.h" 36 #include "core/platform/graphics/skia/SkiaUtils.h"
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 Pattern::Pattern(PassRefPtr<Image> image, bool repeatX, bool repeatY) 40 Pattern::Pattern(PassRefPtr<Image> image, bool repeatX, bool repeatY)
41 : m_repeatX(repeatX) 41 : m_repeatX(repeatX)
42 , m_repeatY(repeatY) 42 , m_repeatY(repeatY)
43 , m_externalMemoryAllocated(0) 43 , m_externalMemoryAllocated(0)
44 { 44 {
45 ASSERT(image); 45 if (image) {
46 m_tileImage = image->nativeImageForCurrentFrame(); 46 m_tileImage = image->nativeImageForCurrentFrame();
47 }
47 } 48 }
48 49
49 Pattern::~Pattern() 50 Pattern::~Pattern()
50 { 51 {
51 if (m_externalMemoryAllocated) 52 if (m_externalMemoryAllocated)
52 v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externalMemoryAllocated ); 53 v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externalMemoryAllocated );
53 } 54 }
54 55
55 SkShader* Pattern::shader() 56 SkShader* Pattern::shader()
56 { 57 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 95 }
95 96
96 void Pattern::setPatternSpaceTransform(const AffineTransform& patternSpaceTransf ormation) 97 void Pattern::setPatternSpaceTransform(const AffineTransform& patternSpaceTransf ormation)
97 { 98 {
98 m_patternSpaceTransformation = patternSpaceTransformation; 99 m_patternSpaceTransformation = patternSpaceTransformation;
99 if (m_pattern) 100 if (m_pattern)
100 m_pattern->setLocalMatrix(affineTransformToSkMatrix(m_patternSpaceTransf ormation)); 101 m_pattern->setLocalMatrix(affineTransformToSkMatrix(m_patternSpaceTransf ormation));
101 } 102 }
102 103
103 } 104 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/canvas/canvas-large-pattern-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698