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

Side by Side Diff: cc/BitmapSkPictureCanvasLayerTextureUpdater.cpp

Issue 11074009: cc: Remove LayerTextureUpdater::Texture::updateRect() callback. (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 #if USE(ACCELERATED_COMPOSITING) 8 #if USE(ACCELERATED_COMPOSITING)
9 9
10 #include "BitmapSkPictureCanvasLayerTextureUpdater.h" 10 #include "BitmapSkPictureCanvasLayerTextureUpdater.h"
11 11
12 #include "CCRenderingStats.h" 12 #include "CCRenderingStats.h"
13 #include "CCTextureUpdateQueue.h"
13 #include "LayerPainterChromium.h" 14 #include "LayerPainterChromium.h"
14 #include "PlatformColor.h" 15 #include "PlatformColor.h"
15 #include "SkCanvas.h" 16 #include "SkCanvas.h"
16 #include "SkDevice.h" 17 #include "SkDevice.h"
17 #include <wtf/CurrentTime.h> 18 #include <wtf/CurrentTime.h>
18 19
19 namespace cc { 20 namespace cc {
20 21
21 BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture(BitmapSkPictureCanvas LayerTextureUpdater* textureUpdater, PassOwnPtr<CCPrioritizedTexture> texture) 22 BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture(BitmapSkPictureCanvas LayerTextureUpdater* textureUpdater, PassOwnPtr<CCPrioritizedTexture> texture)
22 : CanvasLayerTextureUpdater::Texture(texture) 23 : CanvasLayerTextureUpdater::Texture(texture)
23 , m_textureUpdater(textureUpdater) 24 , m_textureUpdater(textureUpdater)
24 { 25 {
25 } 26 }
26 27
27 void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRec t& sourceRect, CCRenderingStats& stats) 28 void BitmapSkPictureCanvasLayerTextureUpdater::Texture::update(CCTextureUpdateQu eue& queue, const IntRect& sourceRect, const IntSize& destOffset, bool partialUp date, CCRenderingStats& stats)
28 { 29 {
29 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRe ct.height()); 30 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRe ct.height());
30 m_bitmap.allocPixels(); 31 m_bitmap.allocPixels();
31 m_bitmap.setIsOpaque(m_textureUpdater->layerIsOpaque()); 32 m_bitmap.setIsOpaque(m_textureUpdater->layerIsOpaque());
32 SkDevice device(m_bitmap); 33 SkDevice device(m_bitmap);
33 SkCanvas canvas(&device); 34 SkCanvas canvas(&device);
34 double paintBeginTime = monotonicallyIncreasingTime(); 35 double paintBeginTime = monotonicallyIncreasingTime();
35 textureUpdater()->paintContentsRect(&canvas, sourceRect, stats); 36 textureUpdater()->paintContentsRect(&canvas, sourceRect, stats);
36 stats.totalPaintTimeInSeconds += monotonicallyIncreasingTime() - paintBeginT ime; 37 stats.totalPaintTimeInSeconds += monotonicallyIncreasingTime() - paintBeginT ime;
37 }
38 38
39 void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCResourcePro vider* resourceProvider, const IntRect& sourceRect, const IntSize& destOffset) 39 TextureUploader::Parameters upload = { texture(), &m_bitmap, NULL, { sourceR ect, sourceRect, destOffset } };
40 { 40 if (partialUpdate)
41 m_bitmap.lockPixels(); 41 queue.appendPartialUpload(upload);
42 texture()->upload(resourceProvider, static_cast<uint8_t*>(m_bitmap.getPixels ()), sourceRect, sourceRect, destOffset); 42 else
43 m_bitmap.unlockPixels(); 43 queue.appendFullUpload(upload);
44 m_bitmap.reset();
45 } 44 }
46 45
47 PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerT extureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) 46 PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerT extureUpdater::create(PassOwnPtr<LayerPainterChromium> painter)
48 { 47 {
49 return adoptRef(new BitmapSkPictureCanvasLayerTextureUpdater(painter)); 48 return adoptRef(new BitmapSkPictureCanvasLayerTextureUpdater(painter));
50 } 49 }
51 50
52 BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdat er(PassOwnPtr<LayerPainterChromium> painter) 51 BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdat er(PassOwnPtr<LayerPainterChromium> painter)
53 : SkPictureCanvasLayerTextureUpdater(painter) 52 : SkPictureCanvasLayerTextureUpdater(painter)
54 { 53 {
(...skipping 20 matching lines...) Expand all
75 // Translate the origin of contentRect to that of sourceRect. 74 // Translate the origin of contentRect to that of sourceRect.
76 canvas->translate(contentRect().x() - sourceRect.x(), 75 canvas->translate(contentRect().x() - sourceRect.x(),
77 contentRect().y() - sourceRect.y()); 76 contentRect().y() - sourceRect.y());
78 double rasterizeBeginTime = monotonicallyIncreasingTime(); 77 double rasterizeBeginTime = monotonicallyIncreasingTime();
79 drawPicture(canvas); 78 drawPicture(canvas);
80 stats.totalRasterizeTimeInSeconds += monotonicallyIncreasingTime() - rasteri zeBeginTime; 79 stats.totalRasterizeTimeInSeconds += monotonicallyIncreasingTime() - rasteri zeBeginTime;
81 } 80 }
82 81
83 } // namespace cc 82 } // namespace cc
84 #endif // USE(ACCELERATED_COMPOSITING) 83 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698