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

Side by Side Diff: cc/caching_bitmap_canvas_layer_texture_updater.cc

Issue 11044003: Reduce texture uploads during scrollbar invalidations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use hash instead, don't override updateRect. Created 8 years, 2 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
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 "config.h"
6
7 #include "caching_bitmap_canvas_layer_texture_updater.h"
8
9 #include "LayerPainterChromium.h"
10 #include "base/hash.h"
11 #include "skia/ext/platform_canvas.h"
12
13 namespace cc {
14
15 PassRefPtr<CachingBitmapCanvasLayerTextureUpdater>
16 CachingBitmapCanvasLayerTextureUpdater::Create(
17 PassOwnPtr<LayerPainterChromium> painter) {
18 return adoptRef(new CachingBitmapCanvasLayerTextureUpdater(painter));
19 }
20
21 CachingBitmapCanvasLayerTextureUpdater::CachingBitmapCanvasLayerTextureUpdater(
22 PassOwnPtr<LayerPainterChromium> painter)
23 : BitmapCanvasLayerTextureUpdater(painter),
24 pixels_did_change_(false),
25 pixel_hash_(0) {
26 }
27
28 void CachingBitmapCanvasLayerTextureUpdater::prepareToUpdate(
29 const IntRect& content_rect,
30 const IntSize& tile_size,
31 float contents_width_scale,
32 float contents_height_scale,
33 IntRect& resulting_opaque_rect,
34 CCRenderingStats& stats) {
35 BitmapCanvasLayerTextureUpdater::prepareToUpdate(content_rect,
36 tile_size,
37 contents_width_scale,
38 contents_height_scale,
39 resulting_opaque_rect,
40 stats);
41
42 const SkBitmap& new_bitmap = m_canvas->getDevice()->accessBitmap(false);
43 SkAutoLockPixels lock(new_bitmap);
44 uint32 new_pixel_hash = base::Hash(static_cast<const char*>(new_bitmap.getPixe ls()), new_bitmap.getSafeSize());
45
46 pixels_did_change_ = new_pixel_hash != pixel_hash_;
47 pixel_hash_ = new_pixel_hash;
48 }
49
50 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698