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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImagePattern.cpp

Issue 2220663002: Fixing uninitialized access in blink::ImagePattern::isLocalMatrixChanged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/ImagePattern.h" 5 #include "platform/graphics/ImagePattern.h"
6 6
7 #include "platform/graphics/Image.h" 7 #include "platform/graphics/Image.h"
8 #include "platform/graphics/skia/SkiaUtils.h" 8 #include "platform/graphics/skia/SkiaUtils.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkImage.h" 10 #include "third_party/skia/include/core/SkImage.h"
11 #include "third_party/skia/include/core/SkShader.h" 11 #include "third_party/skia/include/core/SkShader.h"
12 #include "third_party/skia/include/core/SkSurface.h" 12 #include "third_party/skia/include/core/SkSurface.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 PassRefPtr<ImagePattern> ImagePattern::create(PassRefPtr<Image> image, RepeatMod e repeatMode) 16 PassRefPtr<ImagePattern> ImagePattern::create(PassRefPtr<Image> image, RepeatMod e repeatMode)
17 { 17 {
18 return adoptRef(new ImagePattern(image, repeatMode)); 18 return adoptRef(new ImagePattern(image, repeatMode));
19 } 19 }
20 20
21 ImagePattern::ImagePattern(PassRefPtr<Image> image, RepeatMode repeatMode) 21 ImagePattern::ImagePattern(PassRefPtr<Image> image, RepeatMode repeatMode)
22 : Pattern(repeatMode) 22 : Pattern(repeatMode)
23 , m_tileImage(toSkSp(image->imageForCurrentFrame())) 23 , m_tileImage(toSkSp(image->imageForCurrentFrame()))
24 { 24 {
25 m_previousLocalMatrix.setIdentity();
25 if (m_tileImage) { 26 if (m_tileImage) {
26 // TODO(fmalita): mechanism to extract the actual SkImageInfo from an Sk Image? 27 // TODO(fmalita): mechanism to extract the actual SkImageInfo from an Sk Image?
27 const SkImageInfo info = SkImageInfo::MakeN32Premul( 28 const SkImageInfo info = SkImageInfo::MakeN32Premul(
28 m_tileImage->width() + (isRepeatX() ? 0 : 2), 29 m_tileImage->width() + (isRepeatX() ? 0 : 2),
29 m_tileImage->height() + (isRepeatY() ? 0 : 2)); 30 m_tileImage->height() + (isRepeatY() ? 0 : 2));
30 adjustExternalMemoryAllocated(info.getSafeSize(info.minRowBytes())); 31 adjustExternalMemoryAllocated(info.getSafeSize(info.minRowBytes()));
31 } 32 }
32 } 33 }
33 34
34 bool ImagePattern::isLocalMatrixChanged(const SkMatrix& localMatrix) const 35 bool ImagePattern::isLocalMatrixChanged(const SkMatrix& localMatrix) const
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 return surface->makeImageSnapshot()->makeShader(tileModeX, tileModeY, &adjus tedMatrix); 80 return surface->makeImageSnapshot()->makeShader(tileModeX, tileModeY, &adjus tedMatrix);
80 } 81 }
81 82
82 bool ImagePattern::isTextureBacked() const 83 bool ImagePattern::isTextureBacked() const
83 { 84 {
84 return m_tileImage && m_tileImage->isTextureBacked(); 85 return m_tileImage && m_tileImage->isTextureBacked();
85 } 86 }
86 87
87 } // namespace blink 88 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698