| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |