summaryrefslogtreecommitdiffstats
path: root/chromium/cc/resources/caching_bitmap_content_layer_updater.h
blob: 8e9889025c4435ab787163508ebe9be48b7eb99f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2012 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 CC_RESOURCES_CACHING_BITMAP_CONTENT_LAYER_UPDATER_H_
#define CC_RESOURCES_CACHING_BITMAP_CONTENT_LAYER_UPDATER_H_

#include "base/compiler_specific.h"
#include "cc/resources/bitmap_content_layer_updater.h"
#include "third_party/skia/include/core/SkBitmap.h"

namespace cc {

class CachingBitmapContentLayerUpdater : public BitmapContentLayerUpdater {
 public:
  static scoped_refptr<CachingBitmapContentLayerUpdater> Create(
      scoped_ptr<LayerPainter>,
      RenderingStatsInstrumentation* stats_instrumentation,
      int layer_id);

  virtual void PrepareToUpdate(gfx::Rect content_rect,
                               gfx::Size tile_size,
                               float contents_width_scale,
                               float contents_height_scale,
                               gfx::Rect* resulting_opaque_rect) OVERRIDE;

  bool pixels_did_change() const {
    return pixels_did_change_;
  }

 private:
  CachingBitmapContentLayerUpdater(
      scoped_ptr<LayerPainter> painter,
      RenderingStatsInstrumentation* stats_instrumentation,
      int layer_id);
  virtual ~CachingBitmapContentLayerUpdater();

  bool pixels_did_change_;
  SkBitmap cached_bitmap_;

  DISALLOW_COPY_AND_ASSIGN(CachingBitmapContentLayerUpdater);
};

}  // namespace cc

#endif  // CC_RESOURCES_CACHING_BITMAP_CONTENT_LAYER_UPDATER_H_