| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <limits> | 6 #include <limits> |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/base/region.h" | 10 #include "cc/base/region.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const gfx::Rect& canvas_rect, | 197 const gfx::Rect& canvas_rect, |
| 198 float contents_scale, | 198 float contents_scale, |
| 199 bool is_analysis) const { | 199 bool is_analysis) const { |
| 200 DCHECK(contents_scale >= min_contents_scale_); | 200 DCHECK(contents_scale >= min_contents_scale_); |
| 201 | 201 |
| 202 canvas->translate(-canvas_rect.x(), -canvas_rect.y()); | 202 canvas->translate(-canvas_rect.x(), -canvas_rect.y()); |
| 203 gfx::Rect content_tiling_rect = gfx::ToEnclosingRect( | 203 gfx::Rect content_tiling_rect = gfx::ToEnclosingRect( |
| 204 gfx::ScaleRect(gfx::Rect(tiling_.tiling_size()), contents_scale)); | 204 gfx::ScaleRect(gfx::Rect(tiling_.tiling_size()), contents_scale)); |
| 205 content_tiling_rect.Intersect(canvas_rect); | 205 content_tiling_rect.Intersect(canvas_rect); |
| 206 | 206 |
| 207 canvas->clipRect(gfx::RectToSkRect(content_tiling_rect), | 207 canvas->clipRect(gfx::RectToSkRect(content_tiling_rect), kIntersect_SkClipOp); |
| 208 SkRegion::kIntersect_Op); | |
| 209 | 208 |
| 210 PictureRegionMap picture_region_map; | 209 PictureRegionMap picture_region_map; |
| 211 CoalesceRasters( | 210 CoalesceRasters( |
| 212 canvas_rect, content_tiling_rect, contents_scale, &picture_region_map); | 211 canvas_rect, content_tiling_rect, contents_scale, &picture_region_map); |
| 213 | 212 |
| 214 #ifndef NDEBUG | 213 #ifndef NDEBUG |
| 215 Region total_clip; | 214 Region total_clip; |
| 216 #endif // NDEBUG | 215 #endif // NDEBUG |
| 217 | 216 |
| 218 // Iterate the coalesced map and use each picture's region | 217 // Iterate the coalesced map and use each picture's region |
| (...skipping 17 matching lines...) Expand all Loading... |
| 236 for (int j = 0; j < repeat_count; ++j) | 235 for (int j = 0; j < repeat_count; ++j) |
| 237 picture->Raster(canvas, callback, negated_clip_region, contents_scale); | 236 picture->Raster(canvas, callback, negated_clip_region, contents_scale); |
| 238 } | 237 } |
| 239 | 238 |
| 240 #ifndef NDEBUG | 239 #ifndef NDEBUG |
| 241 // Fill the clip with debug color. This allows us to | 240 // Fill the clip with debug color. This allows us to |
| 242 // distinguish between non painted areas and problems with missing | 241 // distinguish between non painted areas and problems with missing |
| 243 // pictures. | 242 // pictures. |
| 244 SkPaint paint; | 243 SkPaint paint; |
| 245 for (Region::Iterator it(total_clip); it.has_rect(); it.next()) | 244 for (Region::Iterator it(total_clip); it.has_rect(); it.next()) |
| 246 canvas->clipRect(gfx::RectToSkRect(it.rect()), SkRegion::kDifference_Op); | 245 canvas->clipRect(gfx::RectToSkRect(it.rect()), kDifference_SkClipOp); |
| 247 paint.setColor(DebugColors::MissingPictureFillColor()); | 246 paint.setColor(DebugColors::MissingPictureFillColor()); |
| 248 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 247 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 249 canvas->drawPaint(paint); | 248 canvas->drawPaint(paint); |
| 250 #endif // NDEBUG | 249 #endif // NDEBUG |
| 251 } | 250 } |
| 252 | 251 |
| 253 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { | 252 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { |
| 254 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); | 253 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); |
| 255 | 254 |
| 256 gfx::Rect tiling_rect(tiling_.tiling_size()); | 255 gfx::Rect tiling_rect(tiling_.tiling_size()); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 ++it) { | 457 ++it) { |
| 459 const Picture* picture = it->second.GetPicture(); | 458 const Picture* picture = it->second.GetPicture(); |
| 460 if (picture && (processed_pictures.count(picture) == 0)) { | 459 if (picture && (processed_pictures.count(picture) == 0)) { |
| 461 picture->EmitTraceSnapshot(); | 460 picture->EmitTraceSnapshot(); |
| 462 processed_pictures.insert(picture); | 461 processed_pictures.insert(picture); |
| 463 } | 462 } |
| 464 } | 463 } |
| 465 } | 464 } |
| 466 | 465 |
| 467 } // namespace cc | 466 } // namespace cc |
| OLD | NEW |