| 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 "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkData.h" | 10 #include "third_party/skia/include/core/SkData.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 DCHECK(picture_); | 101 DCHECK(picture_); |
| 102 | 102 |
| 103 canvas->save(); | 103 canvas->save(); |
| 104 canvas->clipRect(gfx::RectToSkRect(content_rect)); | 104 canvas->clipRect(gfx::RectToSkRect(content_rect)); |
| 105 canvas->scale(contents_scale, contents_scale); | 105 canvas->scale(contents_scale, contents_scale); |
| 106 canvas->translate(layer_rect_.x(), layer_rect_.y()); | 106 canvas->translate(layer_rect_.x(), layer_rect_.y()); |
| 107 canvas->drawPicture(*picture_); | 107 canvas->drawPicture(*picture_); |
| 108 canvas->restore(); | 108 canvas->restore(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool Picture::IsCheapInRect(const gfx::Rect& layer_rect) { |
| 112 return false; |
| 113 } |
| 114 |
| 111 void Picture::GatherPixelRefs(const gfx::Rect& layer_rect, | 115 void Picture::GatherPixelRefs(const gfx::Rect& layer_rect, |
| 112 std::list<skia::LazyPixelRef*>& pixel_ref_list) { | 116 std::list<skia::LazyPixelRef*>& pixel_ref_list) { |
| 113 DCHECK(picture_); | 117 DCHECK(picture_); |
| 114 SkData* pixel_refs = SkPictureUtils::GatherPixelRefs( | 118 SkData* pixel_refs = SkPictureUtils::GatherPixelRefs( |
| 115 picture_.get(), SkRect::MakeXYWH(layer_rect.x(), | 119 picture_.get(), SkRect::MakeXYWH(layer_rect.x(), |
| 116 layer_rect.y(), | 120 layer_rect.y(), |
| 117 layer_rect.width(), | 121 layer_rect.width(), |
| 118 layer_rect.height())); | 122 layer_rect.height())); |
| 119 if (!pixel_refs) | 123 if (!pixel_refs) |
| 120 return; | 124 return; |
| 121 | 125 |
| 122 void* data = const_cast<void*>(pixel_refs->data()); | 126 void* data = const_cast<void*>(pixel_refs->data()); |
| 123 if (!data) { | 127 if (!data) { |
| 124 pixel_refs->unref(); | 128 pixel_refs->unref(); |
| 125 return; | 129 return; |
| 126 } | 130 } |
| 127 | 131 |
| 128 SkPixelRef** refs = reinterpret_cast<SkPixelRef**>(data); | 132 SkPixelRef** refs = reinterpret_cast<SkPixelRef**>(data); |
| 129 for (unsigned int i = 0; i < pixel_refs->size() / sizeof(SkPixelRef*); ++i) { | 133 for (unsigned int i = 0; i < pixel_refs->size() / sizeof(SkPixelRef*); ++i) { |
| 130 if (*refs && (*refs)->getURI() && !strncmp( | 134 if (*refs && (*refs)->getURI() && !strncmp( |
| 131 (*refs)->getURI(), labelLazyDecoded, 4)) { | 135 (*refs)->getURI(), labelLazyDecoded, 4)) { |
| 132 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs)); | 136 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs)); |
| 133 } | 137 } |
| 134 refs++; | 138 refs++; |
| 135 } | 139 } |
| 136 pixel_refs->unref(); | 140 pixel_refs->unref(); |
| 137 } | 141 } |
| 138 | 142 |
| 139 } // namespace cc | 143 } // namespace cc |
| OLD | NEW |