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

Side by Side Diff: cc/bitmap_canvas_layer_texture_updater.cc

Issue 10982078: Adding hooks for gathering total pixels painted and rasterized stats. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
1 // Copyright 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 #include "config.h" 6 #include "config.h"
7 7
8 #include "BitmapCanvasLayerTextureUpdater.h" 8 #include "BitmapCanvasLayerTextureUpdater.h"
9 9
10 #include "cc/rendering_stats.h"
11
10 #include "CCTextureUpdateQueue.h" 12 #include "CCTextureUpdateQueue.h"
11 #include "LayerPainterChromium.h" 13 #include "LayerPainterChromium.h"
12 #include "PlatformColor.h" 14 #include "PlatformColor.h"
13 #include "skia/ext/platform_canvas.h" 15 #include "skia/ext/platform_canvas.h"
14 16
15 namespace cc { 17 namespace cc {
16 18
17 BitmapCanvasLayerTextureUpdater::Texture::Texture(BitmapCanvasLayerTextureUpdate r* textureUpdater, scoped_ptr<CCPrioritizedTexture> texture) 19 BitmapCanvasLayerTextureUpdater::Texture::Texture(BitmapCanvasLayerTextureUpdate r* textureUpdater, scoped_ptr<CCPrioritizedTexture> texture)
18 : LayerTextureUpdater::Texture(texture.Pass()) 20 : LayerTextureUpdater::Texture(texture.Pass())
19 , m_textureUpdater(textureUpdater) 21 , m_textureUpdater(textureUpdater)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::S ampledTexelFormatBGRA; 58 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::S ampledTexelFormatBGRA;
57 } 59 }
58 60
59 void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect , const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats) 61 void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect , const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats)
60 { 62 {
61 if (m_canvasSize != contentRect.size()) { 63 if (m_canvasSize != contentRect.size()) {
62 m_canvasSize = contentRect.size(); 64 m_canvasSize = contentRect.size();
63 m_canvas = adoptPtr(skia::CreateBitmapCanvas(m_canvasSize.width(), m_can vasSize.height(), m_opaque)); 65 m_canvas = adoptPtr(skia::CreateBitmapCanvas(m_canvasSize.width(), m_can vasSize.height(), m_opaque));
64 } 66 }
65 67
68 stats.totalPixelsRasterized += contentRect.width() * contentRect.height();
69
66 paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeigh tScale, resultingOpaqueRect, stats); 70 paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeigh tScale, resultingOpaqueRect, stats);
67 } 71 }
68 72
69 void BitmapCanvasLayerTextureUpdater::updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOf fset, bool partialUpdate) 73 void BitmapCanvasLayerTextureUpdater::updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOf fset, bool partialUpdate)
70 { 74 {
71 TextureUploader::Parameters upload = { texture, &m_canvas->getDevice()->acce ssBitmap(false), NULL, { contentRect(), sourceRect, destOffset } }; 75 TextureUploader::Parameters upload = { texture, &m_canvas->getDevice()->acce ssBitmap(false), NULL, { contentRect(), sourceRect, destOffset } };
72 if (partialUpdate) 76 if (partialUpdate)
73 queue.appendPartialUpload(upload); 77 queue.appendPartialUpload(upload);
74 else 78 else
75 queue.appendFullUpload(upload); 79 queue.appendFullUpload(upload);
76 } 80 }
77 81
78 void BitmapCanvasLayerTextureUpdater::setOpaque(bool opaque) 82 void BitmapCanvasLayerTextureUpdater::setOpaque(bool opaque)
79 { 83 {
80 if (opaque != m_opaque) { 84 if (opaque != m_opaque) {
81 m_canvas.clear(); 85 m_canvas.clear();
82 m_canvasSize = IntSize(); 86 m_canvasSize = IntSize();
83 } 87 }
84 m_opaque = opaque; 88 m_opaque = opaque;
85 } 89 }
86 90
87 } // namespace cc 91 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/bitmap_skpicture_canvas_layer_texture_updater.cc » ('j') | cc/rendering_stats.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698