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

Side by Side Diff: cc/playback/image_hijack_canvas.cc

Issue 2572783005: ImageHijackCanvas should skip non-lazy images from SkImageShader (Closed)
Patch Set: Created 4 years 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 | « cc/playback/image_hijack_canvas.h ('k') | cc/playback/image_hijack_canvas_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "cc/playback/image_hijack_canvas.h" 5 #include "cc/playback/image_hijack_canvas.h"
6 6
7 #include "base/optional.h" 7 #include "base/optional.h"
8 #include "cc/playback/discardable_image_map.h" 8 #include "cc/playback/discardable_image_map.h"
9 #include "cc/tiles/image_decode_cache.h" 9 #include "cc/tiles/image_decode_cache.h"
10 #include "third_party/skia/include/core/SkPath.h" 10 #include "third_party/skia/include/core/SkPath.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 ImageDecodeCache* image_decode_cache, 76 ImageDecodeCache* image_decode_cache,
77 const SkMatrix& ctm, 77 const SkMatrix& ctm,
78 const SkPaint& paint) { 78 const SkPaint& paint) {
79 SkShader* shader = paint.getShader(); 79 SkShader* shader = paint.getShader();
80 if (!shader) 80 if (!shader)
81 return base::Optional<ScopedImagePaint>(); 81 return base::Optional<ScopedImagePaint>();
82 82
83 SkMatrix matrix; 83 SkMatrix matrix;
84 SkShader::TileMode xy[2]; 84 SkShader::TileMode xy[2];
85 SkImage* image = shader->isAImage(&matrix, xy); 85 SkImage* image = shader->isAImage(&matrix, xy);
86 if (!image) 86 if (!image || !image->isLazyGenerated())
87 return base::Optional<ScopedImagePaint>(); 87 return base::Optional<ScopedImagePaint>();
88 88
89 SkMatrix total_image_matrix = matrix; 89 SkMatrix total_image_matrix = matrix;
90 total_image_matrix.preConcat(ctm); 90 total_image_matrix.preConcat(ctm);
91 91
92 ScopedDecodedImageLock scoped_lock( 92 ScopedDecodedImageLock scoped_lock(
93 image_decode_cache, sk_ref_sp(image), 93 image_decode_cache, sk_ref_sp(image),
94 SkRect::MakeIWH(image->width(), image->height()), total_image_matrix, 94 SkRect::MakeIWH(image->width(), image->height()), total_image_matrix,
95 &paint); 95 &paint);
96 const DecodedDrawImage& decoded_image = scoped_lock.decoded_image(); 96 const DecodedDrawImage& decoded_image = scoped_lock.decoded_image();
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 void ImageHijackCanvas::onDrawImageNine(const SkImage* image, 265 void ImageHijackCanvas::onDrawImageNine(const SkImage* image,
266 const SkIRect& center, 266 const SkIRect& center,
267 const SkRect& dst, 267 const SkRect& dst,
268 const SkPaint* paint) { 268 const SkPaint* paint) {
269 // No cc embedder issues image nine calls. 269 // No cc embedder issues image nine calls.
270 NOTREACHED(); 270 NOTREACHED();
271 } 271 }
272 272
273 } // namespace cc 273 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/image_hijack_canvas.h ('k') | cc/playback/image_hijack_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698