| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/compositor/compositor_cc.h" | 5 #include "ui/gfx/compositor/compositor_cc.h" |
| 6 | 6 |
| 7 #include "third_party/skia/include/images/SkImageEncoder.h" | 7 #include "third_party/skia/include/images/SkImageEncoder.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void CompositorCC::OnNotifyEnd() { | 167 void CompositorCC::OnNotifyEnd() { |
| 168 } | 168 } |
| 169 | 169 |
| 170 void CompositorCC::OnWidgetSizeChanged() { | 170 void CompositorCC::OnWidgetSizeChanged() { |
| 171 host_.setViewportSize(size()); | 171 host_.setViewportSize(size()); |
| 172 root_web_layer_.setBounds(size()); | 172 root_web_layer_.setBounds(size()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void CompositorCC::OnRootLayerChanged() { | 175 void CompositorCC::OnRootLayerChanged() { |
| 176 root_web_layer_.removeAllChildren(); | 176 root_web_layer_.removeAllChildren(); |
| 177 root_web_layer_.addChild(root_layer()->web_layer()); | 177 if (root_layer()) |
| 178 root_web_layer_.addChild(root_layer()->web_layer()); |
| 178 } | 179 } |
| 179 | 180 |
| 180 void CompositorCC::DrawTree() { | 181 void CompositorCC::DrawTree() { |
| 181 host_.composite(); | 182 host_.composite(); |
| 182 } | 183 } |
| 183 | 184 |
| 184 bool CompositorCC::ReadPixels(SkBitmap* bitmap) { | 185 bool CompositorCC::ReadPixels(SkBitmap* bitmap) { |
| 185 bitmap->setConfig(SkBitmap::kARGB_8888_Config, | 186 bitmap->setConfig(SkBitmap::kARGB_8888_Config, |
| 186 size().width(), size().height()); | 187 size().width(), size().height()); |
| 187 bitmap->allocPixels(); | 188 bitmap->allocPixels(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 ScheduleDraw(); | 226 ScheduleDraw(); |
| 226 } | 227 } |
| 227 | 228 |
| 228 Compositor* Compositor::Create(CompositorDelegate* owner, | 229 Compositor* Compositor::Create(CompositorDelegate* owner, |
| 229 gfx::AcceleratedWidget widget, | 230 gfx::AcceleratedWidget widget, |
| 230 const gfx::Size& size) { | 231 const gfx::Size& size) { |
| 231 return new CompositorCC(owner, widget, size); | 232 return new CompositorCC(owner, widget, size); |
| 232 } | 233 } |
| 233 | 234 |
| 234 } // namespace ui | 235 } // namespace ui |
| OLD | NEW |