| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef SKY_COMPOSITOR_LAYER_H_ | 5 #ifndef SKY_COMPOSITOR_LAYER_H_ |
| 6 #define SKY_COMPOSITOR_LAYER_H_ | 6 #define SKY_COMPOSITOR_LAYER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "mojo/gpu/gl_texture.h" | 9 #include "mojo/gpu/gl_texture.h" |
| 10 #include "skia/ext/refptr.h" |
| 10 #include "sky/compositor/layer_client.h" | 11 #include "sky/compositor/layer_client.h" |
| 12 #include "sky/compositor/rasterizer.h" |
| 13 #include "third_party/skia/include/core/SkPicture.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 12 | 15 |
| 13 namespace sky { | 16 namespace sky { |
| 14 | 17 |
| 15 class DisplayDelegate; | |
| 16 class LayerHost; | 18 class LayerHost; |
| 17 | 19 |
| 18 class Layer : public base::RefCounted<Layer> { | 20 class Layer : public base::RefCounted<Layer> { |
| 19 public: | 21 public: |
| 20 explicit Layer(LayerClient* client); | 22 explicit Layer(LayerClient* client); |
| 21 | 23 |
| 22 void SetSize(const gfx::Size& size); | 24 void SetSize(const gfx::Size& size); |
| 23 void GetPixelsForTesting(std::vector<unsigned char>* pixels); | |
| 24 void Display(); | 25 void Display(); |
| 25 | 26 |
| 26 scoped_ptr<mojo::GLTexture> GetTexture(); | 27 scoped_ptr<mojo::GLTexture> GetTexture(); |
| 27 | 28 |
| 28 const gfx::Size& size() const { return size_; } | 29 const gfx::Size& size() const { return size_; } |
| 29 | 30 |
| 30 void set_host(LayerHost* host) { host_ = host; } | 31 void set_rasterizer(scoped_ptr<Rasterizer> rasterizer) { |
| 32 rasterizer_ = rasterizer.Pass(); |
| 33 } |
| 31 | 34 |
| 32 private: | 35 private: |
| 33 friend class base::RefCounted<Layer>; | 36 friend class base::RefCounted<Layer>; |
| 34 ~Layer(); | 37 ~Layer(); |
| 35 | 38 |
| 39 skia::RefPtr<SkPicture> RecordPicture(); |
| 40 |
| 36 LayerClient* client_; | 41 LayerClient* client_; |
| 37 LayerHost* host_; | |
| 38 gfx::Size size_; | 42 gfx::Size size_; |
| 39 scoped_ptr<mojo::GLTexture> texture_; | 43 scoped_ptr<mojo::GLTexture> texture_; |
| 40 scoped_ptr<DisplayDelegate> delegate_; | 44 scoped_ptr<Rasterizer> rasterizer_; |
| 41 | 45 |
| 42 DISALLOW_COPY_AND_ASSIGN(Layer); | 46 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 43 }; | 47 }; |
| 44 | 48 |
| 45 } // namespace sky | 49 } // namespace sky |
| 46 | 50 |
| 47 #endif // SKY_COMPOSITOR_LAYER_H_ | 51 #endif // SKY_COMPOSITOR_LAYER_H_ |
| OLD | NEW |