| OLD | NEW |
| 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 "BitmapSkPictureCanvasLayerTextureUpdater.h" | 10 #include "BitmapSkPictureCanvasLayerTextureUpdater.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRec
t& sourceRect, CCRenderingStats& stats) | 27 void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRec
t& sourceRect, CCRenderingStats& stats) |
| 28 { | 28 { |
| 29 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRe
ct.height()); | 29 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRe
ct.height()); |
| 30 m_bitmap.allocPixels(); | 30 m_bitmap.allocPixels(); |
| 31 m_bitmap.setIsOpaque(m_textureUpdater->layerIsOpaque()); | 31 m_bitmap.setIsOpaque(m_textureUpdater->layerIsOpaque()); |
| 32 SkDevice device(m_bitmap); | 32 SkDevice device(m_bitmap); |
| 33 SkCanvas canvas(&device); | 33 SkCanvas canvas(&device); |
| 34 double paintBeginTime = monotonicallyIncreasingTime(); | 34 double paintBeginTime = monotonicallyIncreasingTime(); |
| 35 textureUpdater()->paintContentsRect(&canvas, sourceRect, stats); | 35 textureUpdater()->paintContentsRect(&canvas, sourceRect, stats); |
| 36 stats.totalPaintTimeInSeconds += monotonicallyIncreasingTime() - paintBeginT
ime; | 36 stats.totalPaintTimeInSeconds += monotonicallyIncreasingTime() - paintBeginT
ime; |
| 37 stats.totalPixelsPainted += sourceRect.width() * sourceRect.height(); |
| 37 } | 38 } |
| 38 | 39 |
| 39 void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourcePro
vider* resourceProvider, const IntRect& sourceRect, const IntSize& destOffset) | 40 void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourcePro
vider* resourceProvider, const IntRect& sourceRect, const IntSize& destOffset) |
| 40 { | 41 { |
| 41 m_bitmap.lockPixels(); | 42 m_bitmap.lockPixels(); |
| 42 texture()->upload(resourceProvider, static_cast<uint8_t*>(m_bitmap.getPixels
()), sourceRect, sourceRect, destOffset); | 43 texture()->upload(resourceProvider, static_cast<uint8_t*>(m_bitmap.getPixels
()), sourceRect, sourceRect, destOffset); |
| 43 m_bitmap.unlockPixels(); | 44 m_bitmap.unlockPixels(); |
| 44 m_bitmap.reset(); | 45 m_bitmap.reset(); |
| 45 } | 46 } |
| 46 | 47 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 71 } | 72 } |
| 72 | 73 |
| 73 void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canva
s, const IntRect& sourceRect, CCRenderingStats& stats) | 74 void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canva
s, const IntRect& sourceRect, CCRenderingStats& stats) |
| 74 { | 75 { |
| 75 // Translate the origin of contentRect to that of sourceRect. | 76 // Translate the origin of contentRect to that of sourceRect. |
| 76 canvas->translate(contentRect().x() - sourceRect.x(), | 77 canvas->translate(contentRect().x() - sourceRect.x(), |
| 77 contentRect().y() - sourceRect.y()); | 78 contentRect().y() - sourceRect.y()); |
| 78 double rasterizeBeginTime = monotonicallyIncreasingTime(); | 79 double rasterizeBeginTime = monotonicallyIncreasingTime(); |
| 79 drawPicture(canvas); | 80 drawPicture(canvas); |
| 80 stats.totalRasterizeTimeInSeconds += monotonicallyIncreasingTime() - rasteri
zeBeginTime; | 81 stats.totalRasterizeTimeInSeconds += monotonicallyIncreasingTime() - rasteri
zeBeginTime; |
| 82 stats.totalPixelsRasterized += sourceRect.width() * sourceRect.height(); |
| 81 } | 83 } |
| 82 | 84 |
| 83 } // namespace cc | 85 } // namespace cc |
| 84 #endif // USE(ACCELERATED_COMPOSITING) | 86 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |