Home | History | Annotate | Download | only in resources
      1 // Copyright 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 #ifndef CC_RESOURCES_PICTURE_PILE_H_
      6 #define CC_RESOURCES_PICTURE_PILE_H_
      7 
      8 #include "cc/resources/picture_pile_base.h"
      9 #include "ui/gfx/rect.h"
     10 
     11 namespace cc {
     12 class PicturePileImpl;
     13 class Region;
     14 class RenderingStatsInstrumentation;
     15 
     16 class CC_EXPORT PicturePile : public PicturePileBase {
     17  public:
     18   PicturePile();
     19 
     20   // Re-record parts of the picture that are invalid.
     21   // Invalidations are in layer space, and will be expanded to cover everything
     22   // that was either recorded/changed or that has no recording, leaving out only
     23   // pieces that we had a recording for and it was not changed.
     24   // Return true iff the pile was modified.
     25   bool UpdateAndExpandInvalidation(
     26       ContentLayerClient* painter,
     27       Region* invalidation,
     28       SkColor background_color,
     29       bool contents_opaque,
     30       bool contents_fill_bounds_completely,
     31       const gfx::Size& layer_size,
     32       const gfx::Rect& visible_layer_rect,
     33       int frame_number,
     34       Picture::RecordingMode recording_mode,
     35       RenderingStatsInstrumentation* stats_instrumentation);
     36 
     37   void SetEmptyBounds();
     38 
     39   void set_slow_down_raster_scale_factor(int factor) {
     40     slow_down_raster_scale_factor_for_debug_ = factor;
     41   }
     42 
     43   void set_show_debug_picture_borders(bool show) {
     44     show_debug_picture_borders_ = show;
     45   }
     46 
     47   bool is_suitable_for_gpu_rasterization() const {
     48     return is_suitable_for_gpu_rasterization_;
     49   }
     50   void SetUnsuitableForGpuRasterizationForTesting() {
     51     is_suitable_for_gpu_rasterization_ = false;
     52   }
     53 
     54   void SetPixelRecordDistanceForTesting(int d) { pixel_record_distance_ = d; }
     55 
     56  protected:
     57   virtual ~PicturePile();
     58 
     59  private:
     60   friend class PicturePileImpl;
     61 
     62   void DetermineIfSolidColor();
     63 
     64   bool is_suitable_for_gpu_rasterization_;
     65   int pixel_record_distance_;
     66 
     67   DISALLOW_COPY_AND_ASSIGN(PicturePile);
     68 };
     69 
     70 }  // namespace cc
     71 
     72 #endif  // CC_RESOURCES_PICTURE_PILE_H_
     73