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_SKPICTURE_CONTENT_LAYER_UPDATER_H_
      6 #define CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_
      7 
      8 #include "cc/resources/content_layer_updater.h"
      9 #include "third_party/skia/include/core/SkPicture.h"
     10 
     11 class SkCanvas;
     12 
     13 namespace cc {
     14 
     15 class LayerPainter;
     16 
     17 // This class records the content_rect into an SkPicture. Subclasses, provide
     18 // different implementations of tile updating based on this recorded picture.
     19 // The BitmapSkPictureContentLayerUpdater and
     20 // FrameBufferSkPictureContentLayerUpdater are two examples of such
     21 // implementations.
     22 class SkPictureContentLayerUpdater : public ContentLayerUpdater {
     23  protected:
     24   SkPictureContentLayerUpdater(
     25       scoped_ptr<LayerPainter> painter,
     26       RenderingStatsInstrumentation* stats_instrumentation,
     27       int layer_id);
     28   virtual ~SkPictureContentLayerUpdater();
     29 
     30   virtual void PrepareToUpdate(gfx::Rect content_rect,
     31                                gfx::Size tile_size,
     32                                float contents_width_scale,
     33                                float contents_height_scale,
     34                                gfx::Rect* resulting_opaque_rect) OVERRIDE;
     35   void DrawPicture(SkCanvas* canvas);
     36 
     37  private:
     38   // Recording canvas.
     39   SkPicture picture_;
     40 
     41   DISALLOW_COPY_AND_ASSIGN(SkPictureContentLayerUpdater);
     42 };
     43 
     44 }  // namespace cc
     45 
     46 #endif  // CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_
     47