Index: chromecast/ui/gfx/surface.h |
diff --git a/chromecast/ui/gfx/surface.h b/chromecast/ui/gfx/surface.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..88cd5dbb39f1af88ee9626fa3b3c76266e023264 |
--- /dev/null |
+++ b/chromecast/ui/gfx/surface.h |
@@ -0,0 +1,75 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROMECAST_UI_GFX_SURFACE_H_ |
+#define CHROMECAST_UI_GFX_SURFACE_H_ |
+ |
+#include <vector> |
+ |
+#include "ui/gfx/size.h" |
+ |
+// Use double buffering if possible. |
+#define DOUBLE_BUFFER 1 |
+ |
+namespace gfx { |
+ |
+class Point; |
+class Rect; |
+ |
+namespace chromecast { |
+ |
+const int kBytesPerPixelOfARGB = 4; |
+ |
+class GfxPlane; |
+ |
+// Abstract class of GFX surface. |
+class Surface { |
+ public: |
+ Surface(GfxPlane* plane, const Size& size); |
+ virtual ~Surface(); |
+ |
+ // Blits(fast copy) bitmap from a surface. Copies |src_rect| area of surface |
+ // |dst_point| of this surface. |
+ virtual void Blit(Surface* src_surface, const Rect& src_rect, |
+ const Point& dst_point) = 0; |
+ |
+ // Composites ARGB values of |src_surface| on top of this surface. It is NOT |
+ // copy. Used when displaying OSD images on same plane. |
+ virtual void Composite(Surface* src_surface, const Rect& src_rect, |
+ const Point& dst_point) = 0; |
+ |
+ // Copies |damage_rect| area of src bitmap into |dst_point| of this surface. |
+ // It is similar to Blit() except that it accepts arbitrary bitmap pointer |
+ // instead of surface. |
+ virtual void CopyBitmap(char* src_bitmap, const Rect& src_rect, |
+ const Rect& damage_rect, const Point& dst_point) = 0; |
+ |
+ // CopyBitmap() in batch mode. The size of |src_rect_vector| and |
+ // |dst_point_vector| must be same. |
+ virtual void BatchCopyBitmap(char* src_bitmap, const Rect& src_rect, |
+ const std::vector<Rect>& damage_rect_vector, |
+ const std::vector<Point>& dst_point_vector) = 0; |
+ |
+ // Fills |rect| area of surface with |argb| value. |
+ virtual void Fill(const Rect& rect, int argb) = 0; |
+ |
+ // Displays a part of area specified by |rect|. Blits contents into |
+ // |frame_buffer_point| of plane's frame buffer surface. |
+ virtual void Display(const Rect& rect, const Point& frame_buffer_point) = 0; |
+ |
+ GfxPlane* plane() const { return plane_; } |
+ const Size& size() const { return size_; } |
+ |
+ protected: |
+ void set_size(const Size& new_size) { size_ = new_size; } |
+ |
+ private: |
+ GfxPlane* const plane_; |
+ Size size_; |
+}; |
+ |
+} // namespace chromecast |
+} // namespace gfx |
+ |
+#endif // CHROMECAST_UI_GFX_SURFACE_H_ |