Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / cc / resources / picture.h
index 3ab17b5..78833d1 100644 (file)
@@ -20,7 +20,9 @@
 #include "cc/base/cc_export.h"
 #include "cc/base/region.h"
 #include "skia/ext/refptr.h"
-#include "third_party/skia/include/core/SkTileGridPicture.h"
+#include "third_party/skia/include/core/SkBBHFactory.h"
+#include "third_party/skia/include/core/SkPicture.h"
+#include "third_party/skia/include/record/SkRecording.h"
 #include "ui/gfx/rect.h"
 
 class SkPixelRef;
@@ -44,12 +46,21 @@ class CC_EXPORT Picture
   typedef std::vector<SkPixelRef*> PixelRefs;
   typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap;
 
+  enum RecordingMode {
+    RECORD_NORMALLY,
+    RECORD_WITH_SK_NULL_CANVAS,
+    RECORD_WITH_PAINTING_DISABLED,
+    RECORD_WITH_SKRECORD,
+    RECORDING_MODE_COUNT,  // Must be the last entry.
+  };
+
   static scoped_refptr<Picture> Create(
       const gfx::Rect& layer_rect,
       ContentLayerClient* client,
-      const SkTileGridPicture::TileGridInfo& tile_grid_info,
+      const SkTileGridFactory::TileGridInfo& tile_grid_info,
       bool gather_pixels_refs,
-      int num_raster_threads);
+      int num_raster_threads,
+      RecordingMode recording_mode);
   static scoped_refptr<Picture> CreateFromValue(const base::Value* value);
   static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value);
 
@@ -62,8 +73,12 @@ class CC_EXPORT Picture
   // Has Record() been called yet?
   bool HasRecording() const { return picture_.get() != NULL; }
 
-  // Apply this scale and raster the negated region into the canvas. See comment
-  // in PicturePileImpl::RasterCommon for explanation on negated content region.
+  bool IsSuitableForGpuRasterization() const;
+
+  // Apply this scale and raster the negated region into the canvas.
+  // |negated_content_region| specifies the region to be clipped out of the
+  // raster operation, i.e., the parts of the canvas which will not get drawn
+  // to.
   int Raster(SkCanvas* canvas,
              SkDrawPictureCallback* callback,
              const Region& negated_content_region,
@@ -136,14 +151,16 @@ class CC_EXPORT Picture
   // Record a paint operation. To be able to safely use this SkPicture for
   // playback on a different thread this can only be called once.
   void Record(ContentLayerClient* client,
-              const SkTileGridPicture::TileGridInfo& tile_grid_info);
+              const SkTileGridFactory::TileGridInfo& tile_grid_info,
+              RecordingMode recording_mode);
 
   // Gather pixel refs from recording.
-  void GatherPixelRefs(const SkTileGridPicture::TileGridInfo& tile_grid_info);
+  void GatherPixelRefs(const SkTileGridFactory::TileGridInfo& tile_grid_info);
 
   gfx::Rect layer_rect_;
   gfx::Rect opaque_rect_;
   skia::RefPtr<SkPicture> picture_;
+  scoped_ptr<const EXPERIMENTAL::SkPlayback> playback_;
 
   typedef std::vector<scoped_refptr<Picture> > PictureVector;
   PictureVector clones_;