| 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" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
| 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" |
| 10 #include "ui/gfx/compositor/layer.h" | 13 #include "ui/gfx/compositor/layer.h" |
| 11 #include "ui/gfx/gl/gl_context.h" | 14 #include "ui/gfx/gl/gl_context.h" |
| 12 #include "ui/gfx/gl/gl_surface.h" | 15 #include "ui/gfx/gl/gl_surface.h" |
| 13 #include "ui/gfx/gl/gl_implementation.h" | 16 #include "ui/gfx/gl/gl_implementation.h" |
| 14 #include "webkit/glue/webthread_impl.h" | 17 #include "webkit/glue/webthread_impl.h" |
| 15 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 18 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
| 16 | 19 |
| 17 namespace { | 20 namespace { |
| 18 webkit_glue::WebThreadImpl* g_compositor_thread = NULL; | 21 webkit_glue::WebThreadImpl* g_compositor_thread = NULL; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 170 |
| 168 void CompositorCC::OnRootLayerChanged() { | 171 void CompositorCC::OnRootLayerChanged() { |
| 169 root_web_layer_.removeAllChildren(); | 172 root_web_layer_.removeAllChildren(); |
| 170 root_web_layer_.addChild(root_layer()->web_layer()); | 173 root_web_layer_.addChild(root_layer()->web_layer()); |
| 171 } | 174 } |
| 172 | 175 |
| 173 void CompositorCC::DrawTree() { | 176 void CompositorCC::DrawTree() { |
| 174 host_.composite(); | 177 host_.composite(); |
| 175 } | 178 } |
| 176 | 179 |
| 177 void CompositorCC::ReadPixels(SkBitmap* bitmap) { | 180 bool CompositorCC::ReadPixels(SkBitmap* bitmap) { |
| 178 NOTIMPLEMENTED(); | 181 bitmap->setConfig(SkBitmap::kARGB_8888_Config, |
| 182 size().width(), size().height()); |
| 183 bitmap->allocPixels(); |
| 184 SkAutoLockPixels lock_image(*bitmap); |
| 185 unsigned char* pixels = static_cast<unsigned char*>(bitmap->getPixels()); |
| 186 if (host_.compositeAndReadback(pixels, gfx::Rect(size()))) { |
| 187 SwizzleRGBAToBGRAAndFlip(pixels, size()); |
| 188 return true; |
| 189 } |
| 190 return false; |
| 179 } | 191 } |
| 180 | 192 |
| 181 void CompositorCC::animateAndLayout(double frameBeginTime) { | 193 void CompositorCC::animateAndLayout(double frameBeginTime) { |
| 182 } | 194 } |
| 183 | 195 |
| 184 void CompositorCC::applyScrollAndScale(const WebKit::WebSize& scrollDelta, | 196 void CompositorCC::applyScrollAndScale(const WebKit::WebSize& scrollDelta, |
| 185 float scaleFactor) { | 197 float scaleFactor) { |
| 186 } | 198 } |
| 187 | 199 |
| 188 void CompositorCC::applyScrollDelta(const WebKit::WebSize&) { | 200 void CompositorCC::applyScrollDelta(const WebKit::WebSize&) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 209 ScheduleDraw(); | 221 ScheduleDraw(); |
| 210 } | 222 } |
| 211 | 223 |
| 212 Compositor* Compositor::Create(CompositorDelegate* owner, | 224 Compositor* Compositor::Create(CompositorDelegate* owner, |
| 213 gfx::AcceleratedWidget widget, | 225 gfx::AcceleratedWidget widget, |
| 214 const gfx::Size& size) { | 226 const gfx::Size& size) { |
| 215 return new CompositorCC(owner, widget, size); | 227 return new CompositorCC(owner, widget, size); |
| 216 } | 228 } |
| 217 | 229 |
| 218 } // namespace ui | 230 } // namespace ui |
| OLD | NEW |