Home | History | Annotate | Download | only in resources
      1 // Copyright 2011 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_CONTENT_LAYER_UPDATER_H_
      6 #define CC_RESOURCES_CONTENT_LAYER_UPDATER_H_
      7 
      8 #include "cc/base/cc_export.h"
      9 #include "cc/resources/layer_updater.h"
     10 #include "ui/gfx/rect.h"
     11 
     12 class SkCanvas;
     13 
     14 namespace cc {
     15 
     16 class LayerPainter;
     17 class RenderingStatsInstrumentation;
     18 
     19 // Base class for BitmapContentLayerUpdater and
     20 // SkPictureContentLayerUpdater that reduces code duplication between
     21 // their respective PaintContents implementations.
     22 class CC_EXPORT ContentLayerUpdater : public LayerUpdater {
     23  public:
     24   void set_rendering_stats_instrumentation(RenderingStatsInstrumentation* rsi);
     25 
     26  protected:
     27   ContentLayerUpdater(scoped_ptr<LayerPainter> painter,
     28                       RenderingStatsInstrumentation* stats_instrumentation,
     29                       int layer_id);
     30   virtual ~ContentLayerUpdater();
     31 
     32   void PaintContents(SkCanvas* canvas,
     33                      gfx::Rect content_rect,
     34                      float contents_width_scale,
     35                      float contents_height_scale,
     36                      gfx::Rect* resulting_opaque_rect);
     37   gfx::Rect content_rect() const { return content_rect_; }
     38 
     39   RenderingStatsInstrumentation* rendering_stats_instrumentation_;
     40   int layer_id_;
     41 
     42  private:
     43   gfx::Rect content_rect_;
     44   scoped_ptr<LayerPainter> painter_;
     45 
     46   DISALLOW_COPY_AND_ASSIGN(ContentLayerUpdater);
     47 };
     48 
     49 }  // namespace cc
     50 
     51 #endif  // CC_RESOURCES_CONTENT_LAYER_UPDATER_H_
     52