| 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 "base/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
| 6 #include "cc/content_layer_client.h" | 6 #include "cc/content_layer_client.h" |
| 7 #include "cc/picture.h" | 7 #include "cc/picture.h" |
| 8 #include "cc/rendering_stats.h" | 8 #include "cc/rendering_stats.h" |
| 9 #include "skia/ext/analysis_canvas.h" | 9 #include "skia/ext/analysis_canvas.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 DCHECK(picture_); | 107 DCHECK(picture_); |
| 108 | 108 |
| 109 canvas->save(); | 109 canvas->save(); |
| 110 canvas->clipRect(gfx::RectToSkRect(content_rect)); | 110 canvas->clipRect(gfx::RectToSkRect(content_rect)); |
| 111 canvas->scale(contents_scale, contents_scale); | 111 canvas->scale(contents_scale, contents_scale); |
| 112 canvas->translate(layer_rect_.x(), layer_rect_.y()); | 112 canvas->translate(layer_rect_.x(), layer_rect_.y()); |
| 113 canvas->drawPicture(*picture_); | 113 canvas->drawPicture(*picture_); |
| 114 canvas->restore(); | 114 canvas->restore(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool Picture::IsCheapInRect(const gfx::Rect& layer_rect) { | 117 bool Picture::IsCheapInRect(const gfx::Rect& layer_rect) const { |
| 118 TRACE_EVENT0("cc", "Picture::IsCheapInRect"); | 118 TRACE_EVENT0("cc", "Picture::IsCheapInRect"); |
| 119 | 119 |
| 120 SkBitmap emptyBitmap; | 120 SkBitmap emptyBitmap; |
| 121 emptyBitmap.setConfig(SkBitmap::kNo_Config, layer_rect.width(), | 121 emptyBitmap.setConfig(SkBitmap::kNo_Config, layer_rect.width(), |
| 122 layer_rect.height()); | 122 layer_rect.height()); |
| 123 skia::AnalysisDevice device(emptyBitmap); | 123 skia::AnalysisDevice device(emptyBitmap); |
| 124 skia::AnalysisCanvas canvas(&device); | 124 skia::AnalysisCanvas canvas(&device); |
| 125 | 125 |
| 126 canvas.drawPicture(*picture_); | 126 canvas.drawPicture(*picture_); |
| 127 return canvas.isCheap(); | 127 return canvas.isCheap(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 149 if (*refs && (*refs)->getURI() && !strncmp( | 149 if (*refs && (*refs)->getURI() && !strncmp( |
| 150 (*refs)->getURI(), labelLazyDecoded, 4)) { | 150 (*refs)->getURI(), labelLazyDecoded, 4)) { |
| 151 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs)); | 151 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs)); |
| 152 } | 152 } |
| 153 refs++; | 153 refs++; |
| 154 } | 154 } |
| 155 pixel_refs->unref(); | 155 pixel_refs->unref(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace cc | 158 } // namespace cc |
| OLD | NEW |