Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: content/browser/renderer_host/accelerated_surface_container_linux_gl.cc

Issue 9288053: Remove old (pre-webkit) compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/gpu/gpu_pixel_browsertest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/accelerated_surface_container_linux.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "content/browser/renderer_host/image_transport_client.h"
9 #include "ui/gfx/compositor/compositor_gl.h"
10 #include "ui/gfx/rect.h"
11 #include "ui/gfx/transform.h"
12
13 namespace {
14
15 class AcceleratedSurfaceContainerLinuxGL
16 : public AcceleratedSurfaceContainerLinux, public ui::TextureGL {
17 public:
18 explicit AcceleratedSurfaceContainerLinuxGL(const gfx::Size& size)
19 : ui::TextureGL(size) {
20 }
21
22 virtual ~AcceleratedSurfaceContainerLinuxGL() { }
23 virtual void AddRef() { ui::TextureGL::AddRef(); }
24 virtual void Release() { ui::TextureGL::Release(); }
25
26 virtual bool Initialize(uint64* surface_handle) OVERRIDE {
27 ui::SharedResourcesGL* instance = ui::SharedResourcesGL::GetInstance();
28 DCHECK(instance);
29 image_transport_client_.reset(
30 ImageTransportClient::Create(instance, size_));
31 if (!image_transport_client_.get())
32 return false;
33
34 texture_id_ = image_transport_client_->Initialize(surface_handle);
35 if (!texture_id_) {
36 image_transport_client_.reset();
37 return false;
38 }
39 return true;
40 }
41
42 virtual const gfx::Size& GetSize() {
43 return ui::TextureGL::size();
44 }
45
46 // TextureGL implementation
47 virtual void SetCanvas(const SkCanvas& canvas,
48 const gfx::Point& origin,
49 const gfx::Size& overall_size) OVERRIDE {
50 NOTREACHED();
51 }
52
53 virtual void Draw(const ui::TextureDrawParams& params,
54 const gfx::Rect& clip_bounds_in_texture) OVERRIDE {
55 image_transport_client_->Acquire();
56
57 ui::TextureDrawParams modified_params = params;
58 if (image_transport_client_->Flipped())
59 modified_params.vertically_flipped = true;
60
61 ui::SharedResourcesGL* instance = ui::SharedResourcesGL::GetInstance();
62 DrawInternal(*instance->program_no_swizzle(),
63 modified_params,
64 clip_bounds_in_texture);
65
66 image_transport_client_->Release();
67 }
68
69 virtual TransportDIB::Handle Handle() const {
70 return image_transport_client_->Handle();
71 }
72
73 virtual ui::Texture* GetTexture() { return this; }
74
75 private:
76 scoped_ptr<ImageTransportClient> image_transport_client_;
77 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerLinuxGL);
78 };
79
80 } // namespace
81
82 // static
83 AcceleratedSurfaceContainerLinux*
84 AcceleratedSurfaceContainerLinux::Create(const gfx::Size& size) {
85 return new AcceleratedSurfaceContainerLinuxGL(size);
86 }
OLDNEW
« no previous file with comments | « chrome/test/gpu/gpu_pixel_browsertest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698