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

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: Revert use of hash; address texture eviction. 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 "skia/ext/platform_canvas.h"
11
12 namespace cc {
13
14 PassRefPtr<CachingBitmapCanvasLayerTextureUpdater>
15 CachingBitmapCanvasLayerTextureUpdater::Create(
16 PassOwnPtr<LayerPainterChromium> painter) {
17 return adoptRef(new CachingBitmapCanvasLayerTextureUpdater(painter));
18 }
19
20 CachingBitmapCanvasLayerTextureUpdater::CachingBitmapCanvasLayerTextureUpdater(
21 PassOwnPtr<LayerPainterChromium> painter)
22 : BitmapCanvasLayerTextureUpdater(painter),
23 pixels_did_change_(false) {
24 }
25
26 void CachingBitmapCanvasLayerTextureUpdater::prepareToUpdate(
27 const IntRect& content_rect,
28 const IntSize& tile_size,
29 float contents_width_scale,
30 float contents_height_scale,
31 IntRect& resulting_opaque_rect,
32 CCRenderingStats& stats) {
33 BitmapCanvasLayerTextureUpdater::prepareToUpdate(content_rect,
34 tile_size,
35 contents_width_scale,
36 contents_height_scale,
37 resulting_opaque_rect,
38 stats);
39
40 const SkBitmap& new_bitmap = m_canvas->getDevice()->accessBitmap(false);
41 SkAutoLockPixels lock(new_bitmap);
42 ASSERT(new_bitmap.bytesPerPixel() > 0);
43 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() ||
44 new_bitmap.height() != cached_bitmap_.height() ||
45 new_bitmap.width() != cached_bitmap_.width() ||
46 memcmp(new_bitmap.getPixels(),
47 cached_bitmap_.getPixels(),
48 new_bitmap.getSafeSize());
49
50 if (pixels_did_change_)
51 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config());
52 }
53
54 bool CachingBitmapCanvasLayerTextureUpdater::pixelsDidChange() const
55 {
56 return pixels_did_change_;
57 }
58
59 } // namespace cc
enne (OOO) 2012/10/03 19:31:43 } // namespace cc
wjmaclean 2012/10/03 20:14:30 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698