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

Side by Side Diff: cc/BitmapCanvasLayerTextureUpdater.cpp

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
« no previous file with comments | « no previous file | cc/BitmapSkPictureCanvasLayerTextureUpdater.cpp » ('j') | cc/CCRenderingStats.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #if USE(ACCELERATED_COMPOSITING) 8 #if USE(ACCELERATED_COMPOSITING)
9 9
10 #include "BitmapCanvasLayerTextureUpdater.h" 10 #include "BitmapCanvasLayerTextureUpdater.h"
11 11
12 #include "CCRenderingStats.h"
13
12 #include "LayerPainterChromium.h" 14 #include "LayerPainterChromium.h"
13 #include "PlatformColor.h" 15 #include "PlatformColor.h"
14 #include "skia/ext/platform_canvas.h" 16 #include "skia/ext/platform_canvas.h"
15 17
16 namespace cc { 18 namespace cc {
17 19
18 BitmapCanvasLayerTextureUpdater::Texture::Texture(BitmapCanvasLayerTextureUpdate r* textureUpdater, PassOwnPtr<CCPrioritizedTexture> texture) 20 BitmapCanvasLayerTextureUpdater::Texture::Texture(BitmapCanvasLayerTextureUpdate r* textureUpdater, PassOwnPtr<CCPrioritizedTexture> texture)
19 : LayerTextureUpdater::Texture(texture) 21 : LayerTextureUpdater::Texture(texture)
20 , m_textureUpdater(textureUpdater) 22 , m_textureUpdater(textureUpdater)
21 { 23 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::S ampledTexelFormatBGRA; 59 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::S ampledTexelFormatBGRA;
58 } 60 }
59 61
60 void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect , const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats) 62 void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect , const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats)
61 { 63 {
62 if (m_canvasSize != contentRect.size()) { 64 if (m_canvasSize != contentRect.size()) {
63 m_canvasSize = contentRect.size(); 65 m_canvasSize = contentRect.size();
64 m_canvas = adoptPtr(skia::CreateBitmapCanvas(m_canvasSize.width(), m_can vasSize.height(), m_opaque)); 66 m_canvas = adoptPtr(skia::CreateBitmapCanvas(m_canvasSize.width(), m_can vasSize.height(), m_opaque));
65 } 67 }
66 68
69 stats.totalPixelsRasterized += contentRect.width() * contentRect.height();
70
67 paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeigh tScale, resultingOpaqueRect, stats); 71 paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeigh tScale, resultingOpaqueRect, stats);
68 } 72 }
69 73
70 void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCResourceProvider* reso urceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const In tSize& destOffset) 74 void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCResourceProvider* reso urceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const In tSize& destOffset)
71 { 75 {
72 const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false); 76 const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false);
73 bitmap.lockPixels(); 77 bitmap.lockPixels();
74 78
75 texture->upload(resourceProvider, static_cast<const uint8_t*>(bitmap.getPixe ls()), contentRect(), sourceRect, destOffset); 79 texture->upload(resourceProvider, static_cast<const uint8_t*>(bitmap.getPixe ls()), contentRect(), sourceRect, destOffset);
76 bitmap.unlockPixels(); 80 bitmap.unlockPixels();
77 } 81 }
78 82
79 void BitmapCanvasLayerTextureUpdater::setOpaque(bool opaque) 83 void BitmapCanvasLayerTextureUpdater::setOpaque(bool opaque)
80 { 84 {
81 if (opaque != m_opaque) { 85 if (opaque != m_opaque) {
82 m_canvas.clear(); 86 m_canvas.clear();
83 m_canvasSize = IntSize(); 87 m_canvasSize = IntSize();
84 } 88 }
85 m_opaque = opaque; 89 m_opaque = opaque;
86 } 90 }
87 91
88 } // namespace cc 92 } // namespace cc
89 #endif // USE(ACCELERATED_COMPOSITING) 93 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « no previous file | cc/BitmapSkPictureCanvasLayerTextureUpdater.cpp » ('j') | cc/CCRenderingStats.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698