| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/paint/discardable_image_store.h" | 5 #include "cc/paint/discardable_image_store.h" |
| 6 | 6 |
| 7 #include "base/containers/adapters.h" | 7 #include "base/containers/adapters.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "cc/paint/display_item_list.h" | 9 #include "cc/paint/display_item_list.h" |
| 10 #include "third_party/skia/include/utils/SkNoDrawCanvas.h" | 10 #include "third_party/skia/include/utils/SkNoDrawCanvas.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 canvas_->restore(); | 171 canvas_->restore(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 // Currently this function only handles extracting images from SkImageShaders | 174 // Currently this function only handles extracting images from SkImageShaders |
| 175 // embedded in SkPaints. Other embedded image cases, such as SkPictures, | 175 // embedded in SkPaints. Other embedded image cases, such as SkPictures, |
| 176 // are not yet handled. | 176 // are not yet handled. |
| 177 void DiscardableImageStore::AddImageFromFlags(const SkRect& rect, | 177 void DiscardableImageStore::AddImageFromFlags(const SkRect& rect, |
| 178 const PaintFlags& flags) { | 178 const PaintFlags& flags) { |
| 179 SkShader* shader = flags.getShader(); | 179 SkShader* shader = flags.getSkShader(); |
| 180 if (shader) { | 180 if (shader) { |
| 181 SkMatrix matrix; | 181 SkMatrix matrix; |
| 182 SkShader::TileMode xy[2]; | 182 SkShader::TileMode xy[2]; |
| 183 SkImage* image = shader->isAImage(&matrix, xy); | 183 SkImage* image = shader->isAImage(&matrix, xy); |
| 184 if (image) { | 184 if (image) { |
| 185 // We currently use the wrong id for images that come from shaders. We | 185 // We currently use the wrong id for images that come from shaders. We |
| 186 // don't know what the stable id is, but since the completion and | 186 // don't know what the stable id is, but since the completion and |
| 187 // animation states are both unknown, this value doesn't matter as it | 187 // animation states are both unknown, this value doesn't matter as it |
| 188 // won't be used in checker imaging anyway. Keep this value the same to | 188 // won't be used in checker imaging anyway. Keep this value the same to |
| 189 // avoid id churn. | 189 // avoid id churn. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 matrix.postConcat(*local_matrix); | 250 matrix.postConcat(*local_matrix); |
| 251 | 251 |
| 252 (*image_id_to_rect_)[paint_image.stable_id()].Union(image_rect); | 252 (*image_id_to_rect_)[paint_image.stable_id()].Union(image_rect); |
| 253 image_set_->push_back( | 253 image_set_->push_back( |
| 254 std::make_pair(DrawImage(std::move(paint_image), src_irect, | 254 std::make_pair(DrawImage(std::move(paint_image), src_irect, |
| 255 filter_quality, matrix, target_color_space), | 255 filter_quality, matrix, target_color_space), |
| 256 image_rect)); | 256 image_rect)); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace cc | 259 } // namespace cc |
| OLD | NEW |