| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/discardable_image_map.h" | 5 #include "cc/playback/discardable_image_map.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 void AddPaintImage(const SkRect& rect, const SkPaint& paint) { | 209 void AddPaintImage(const SkRect& rect, const SkPaint& paint) { |
| 210 SkShader* shader = paint.getShader(); | 210 SkShader* shader = paint.getShader(); |
| 211 if (shader) { | 211 if (shader) { |
| 212 SkMatrix matrix; | 212 SkMatrix matrix; |
| 213 SkShader::TileMode xy[2]; | 213 SkShader::TileMode xy[2]; |
| 214 SkImage* image = shader->isAImage(&matrix, xy); | 214 SkImage* image = shader->isAImage(&matrix, xy); |
| 215 if (image) { | 215 if (image) { |
| 216 const SkMatrix& ctm = getTotalMatrix(); | 216 const SkMatrix& ctm = getTotalMatrix(); |
| 217 matrix.postConcat(ctm); | 217 matrix.postConcat(ctm); |
| 218 // TODO(ericrk): Handle cases where we only need a sub-rect from the | 218 // TODO(ericrk): Handle cases where we only need a sub-rect from the |
| 219 // image. | 219 // image. crbug.com/671821 |
| 220 AddImage(sk_ref_sp(image), SkRect::MakeFromIRect(image->bounds()), | 220 AddImage(sk_ref_sp(image), SkRect::MakeFromIRect(image->bounds()), |
| 221 MapRect(ctm, rect), matrix, &paint); | 221 MapRect(ctm, rect), matrix, &paint); |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 std::vector<std::pair<DrawImage, gfx::Rect>>* image_set_; | 226 std::vector<std::pair<DrawImage, gfx::Rect>>* image_set_; |
| 227 const SkRect canvas_bounds_; | 227 const SkRect canvas_bounds_; |
| 228 const gfx::Size canvas_size_; | 228 const gfx::Size canvas_size_; |
| 229 std::vector<SkPaint> saved_paints_; | 229 std::vector<SkPaint> saved_paints_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 DiscardableImageMap* image_map, | 263 DiscardableImageMap* image_map, |
| 264 const gfx::Size& bounds) | 264 const gfx::Size& bounds) |
| 265 : image_map_(image_map), | 265 : image_map_(image_map), |
| 266 metadata_canvas_(image_map->BeginGeneratingMetadata(bounds)) {} | 266 metadata_canvas_(image_map->BeginGeneratingMetadata(bounds)) {} |
| 267 | 267 |
| 268 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() { | 268 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() { |
| 269 image_map_->EndGeneratingMetadata(); | 269 image_map_->EndGeneratingMetadata(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace cc | 272 } // namespace cc |
| OLD | NEW |