OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 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 #ifndef CHROMECAST_UI_GFX_SURFACE_H_ |
| 6 #define CHROMECAST_UI_GFX_SURFACE_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "ui/gfx/size.h" |
| 11 |
| 12 // Use double buffering if possible. |
| 13 #define DOUBLE_BUFFER 1 |
| 14 |
| 15 namespace gfx { |
| 16 |
| 17 class Point; |
| 18 class Rect; |
| 19 |
| 20 namespace chromecast { |
| 21 |
| 22 const int kBytesPerPixelOfARGB = 4; |
| 23 |
| 24 class GfxPlane; |
| 25 |
| 26 // Abstract class of GFX surface. |
| 27 class Surface { |
| 28 public: |
| 29 Surface(GfxPlane* plane, const Size& size); |
| 30 virtual ~Surface(); |
| 31 |
| 32 // Blits(fast copy) bitmap from a surface. Copies |src_rect| area of surface |
| 33 // |dst_point| of this surface. |
| 34 virtual void Blit(Surface* src_surface, const Rect& src_rect, |
| 35 const Point& dst_point) = 0; |
| 36 |
| 37 // Composites ARGB values of |src_surface| on top of this surface. It is NOT |
| 38 // copy. Used when displaying OSD images on same plane. |
| 39 virtual void Composite(Surface* src_surface, const Rect& src_rect, |
| 40 const Point& dst_point) = 0; |
| 41 |
| 42 // Copies |damage_rect| area of src bitmap into |dst_point| of this surface. |
| 43 // It is similar to Blit() except that it accepts arbitrary bitmap pointer |
| 44 // instead of surface. |
| 45 virtual void CopyBitmap(char* src_bitmap, const Rect& src_rect, |
| 46 const Rect& damage_rect, const Point& dst_point) = 0; |
| 47 |
| 48 // CopyBitmap() in batch mode. The size of |src_rect_vector| and |
| 49 // |dst_point_vector| must be same. |
| 50 virtual void BatchCopyBitmap(char* src_bitmap, const Rect& src_rect, |
| 51 const std::vector<Rect>& damage_rect_vector, |
| 52 const std::vector<Point>& dst_point_vector) = 0; |
| 53 |
| 54 // Fills |rect| area of surface with |argb| value. |
| 55 virtual void Fill(const Rect& rect, int argb) = 0; |
| 56 |
| 57 // Displays a part of area specified by |rect|. Blits contents into |
| 58 // |frame_buffer_point| of plane's frame buffer surface. |
| 59 virtual void Display(const Rect& rect, const Point& frame_buffer_point) = 0; |
| 60 |
| 61 GfxPlane* plane() const { return plane_; } |
| 62 const Size& size() const { return size_; } |
| 63 |
| 64 protected: |
| 65 void set_size(const Size& new_size) { size_ = new_size; } |
| 66 |
| 67 private: |
| 68 GfxPlane* const plane_; |
| 69 Size size_; |
| 70 }; |
| 71 |
| 72 } // namespace chromecast |
| 73 } // namespace gfx |
| 74 |
| 75 #endif // CHROMECAST_UI_GFX_SURFACE_H_ |
OLD | NEW |