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

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

Issue 2344573002: Correct SourceImageStatus in OffscreenCanvas::getSourceImageForCanvas (Closed)
Patch Set: Created 4 years, 3 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(std::move(image), repeatMode)); 18 return adoptRef(new ImagePattern(std::move(image), repeatMode));
Justin Novosad 2016/09/14 18:07:45 Perhaps add a null check here?
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(image->imageForCurrentFrame()) 23 , m_tileImage(image->imageForCurrentFrame())
24 { 24 {
25 m_previousLocalMatrix.setIdentity(); 25 SkMatrix matrix;
26 matrix.setIdentity();
Justin Novosad 2016/09/14 18:05:08 I don't understand what this is supposed to fix. T
27 m_previousLocalMatrix = matrix;
26 if (m_tileImage) { 28 if (m_tileImage) {
27 // TODO(fmalita): mechanism to extract the actual SkImageInfo from an Sk Image? 29 // TODO(fmalita): mechanism to extract the actual SkImageInfo from an Sk Image?
28 const SkImageInfo info = SkImageInfo::MakeN32Premul( 30 const SkImageInfo info = SkImageInfo::MakeN32Premul(
29 m_tileImage->width() + (isRepeatX() ? 0 : 2), 31 m_tileImage->width() + (isRepeatX() ? 0 : 2),
30 m_tileImage->height() + (isRepeatY() ? 0 : 2)); 32 m_tileImage->height() + (isRepeatY() ? 0 : 2));
31 adjustExternalMemoryAllocated(info.getSafeSize(info.minRowBytes())); 33 adjustExternalMemoryAllocated(info.getSafeSize(info.minRowBytes()));
32 } 34 }
33 } 35 }
34 36
35 bool ImagePattern::isLocalMatrixChanged(const SkMatrix& localMatrix) const 37 bool ImagePattern::isLocalMatrixChanged(const SkMatrix& localMatrix) const
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 81
80 return surface->makeImageSnapshot()->makeShader(tileModeX, tileModeY, &adjus tedMatrix); 82 return surface->makeImageSnapshot()->makeShader(tileModeX, tileModeY, &adjus tedMatrix);
81 } 83 }
82 84
83 bool ImagePattern::isTextureBacked() const 85 bool ImagePattern::isTextureBacked() const
84 { 86 {
85 return m_tileImage && m_tileImage->isTextureBacked(); 87 return m_tileImage && m_tileImage->isTextureBacked();
86 } 88 }
87 89
88 } // namespace blink 90 } // 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