Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: cc/resources/caching_bitmap_content_layer_updater.cc

Issue 127173002: [cc] Cleanup: remove unused class - CachingBitmapContentLayerUpdater (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/resources/caching_bitmap_content_layer_updater.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 #include "cc/resources/caching_bitmap_content_layer_updater.h"
6
7 #include "base/logging.h"
8 #include "cc/resources/layer_painter.h"
9 #include "skia/ext/platform_canvas.h"
10
11 namespace cc {
12
13 scoped_refptr<CachingBitmapContentLayerUpdater>
14 CachingBitmapContentLayerUpdater::Create(
15 scoped_ptr<LayerPainter> painter,
16 RenderingStatsInstrumentation* stats_instrumentation,
17 int layer_id) {
18 return make_scoped_refptr(
19 new CachingBitmapContentLayerUpdater(painter.Pass(),
20 stats_instrumentation,
21 layer_id));
22 }
23
24 CachingBitmapContentLayerUpdater::CachingBitmapContentLayerUpdater(
25 scoped_ptr<LayerPainter> painter,
26 RenderingStatsInstrumentation* stats_instrumentation,
27 int layer_id)
28 : BitmapContentLayerUpdater(painter.Pass(),
29 stats_instrumentation,
30 layer_id),
31 pixels_did_change_(false) {}
32
33 CachingBitmapContentLayerUpdater::~CachingBitmapContentLayerUpdater() {}
34
35 void CachingBitmapContentLayerUpdater::PrepareToUpdate(
36 gfx::Rect content_rect,
37 gfx::Size tile_size,
38 float contents_width_scale,
39 float contents_height_scale,
40 gfx::Rect* resulting_opaque_rect) {
41 BitmapContentLayerUpdater::PrepareToUpdate(content_rect,
42 tile_size,
43 contents_width_scale,
44 contents_height_scale,
45 resulting_opaque_rect);
46
47 const SkBitmap& new_bitmap = canvas_->getDevice()->accessBitmap(false);
48 SkAutoLockPixels lock(new_bitmap);
49 DCHECK_GT(new_bitmap.bytesPerPixel(), 0);
50 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() ||
51 new_bitmap.height() != cached_bitmap_.height() ||
52 new_bitmap.width() != cached_bitmap_.width() ||
53 memcmp(new_bitmap.getPixels(),
54 cached_bitmap_.getPixels(),
55 new_bitmap.getSafeSize());
56
57 if (pixels_did_change_)
58 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config());
59 }
60
61 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/caching_bitmap_content_layer_updater.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698