| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return base::Optional<ScopedImagePaint>(); | 98 return base::Optional<ScopedImagePaint>(); |
| 99 | 99 |
| 100 bool need_scale = !decoded_image.is_scale_adjustment_identity(); | 100 bool need_scale = !decoded_image.is_scale_adjustment_identity(); |
| 101 if (need_scale) { | 101 if (need_scale) { |
| 102 matrix.preScale(1.f / decoded_image.scale_adjustment().width(), | 102 matrix.preScale(1.f / decoded_image.scale_adjustment().width(), |
| 103 1.f / decoded_image.scale_adjustment().height()); | 103 1.f / decoded_image.scale_adjustment().height()); |
| 104 } | 104 } |
| 105 SkPaint scratch_paint = paint; | 105 SkPaint scratch_paint = paint; |
| 106 scratch_paint.setShader( | 106 scratch_paint.setShader( |
| 107 decoded_image.image()->makeShader(xy[0], xy[1], &matrix)); | 107 decoded_image.image()->makeShader(xy[0], xy[1], &matrix)); |
| 108 scratch_paint.setFilterQuality(decoded_image.filter_quality()); |
| 108 return ScopedImagePaint(std::move(scoped_lock), std::move(scratch_paint)); | 109 return ScopedImagePaint(std::move(scoped_lock), std::move(scratch_paint)); |
| 109 } | 110 } |
| 110 | 111 |
| 111 const SkPaint& paint() { return paint_; } | 112 const SkPaint& paint() { return paint_; } |
| 112 | 113 |
| 113 private: | 114 private: |
| 114 ScopedImagePaint(ScopedDecodedImageLock lock, SkPaint paint) | 115 ScopedImagePaint(ScopedDecodedImageLock lock, SkPaint paint) |
| 115 : lock_(std::move(lock)), paint_(std::move(paint)) {} | 116 : lock_(std::move(lock)), paint_(std::move(paint)) {} |
| 116 | 117 |
| 117 ScopedDecodedImageLock lock_; | 118 ScopedDecodedImageLock lock_; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 265 |
| 265 void ImageHijackCanvas::onDrawImageNine(const SkImage* image, | 266 void ImageHijackCanvas::onDrawImageNine(const SkImage* image, |
| 266 const SkIRect& center, | 267 const SkIRect& center, |
| 267 const SkRect& dst, | 268 const SkRect& dst, |
| 268 const SkPaint* paint) { | 269 const SkPaint* paint) { |
| 269 // No cc embedder issues image nine calls. | 270 // No cc embedder issues image nine calls. |
| 270 NOTREACHED(); | 271 NOTREACHED(); |
| 271 } | 272 } |
| 272 | 273 |
| 273 } // namespace cc | 274 } // namespace cc |
| OLD | NEW |