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

Side by Side Diff: cc/BitmapCanvasLayerTextureUpdater.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 "BitmapCanvasLayerTextureUpdater.h" 10 #include "BitmapCanvasLayerTextureUpdater.h"
11 11
12 #include "CCTextureUpdateQueue.h"
12 #include "LayerPainterChromium.h" 13 #include "LayerPainterChromium.h"
13 #include "PlatformColor.h" 14 #include "PlatformColor.h"
14 #include "skia/ext/platform_canvas.h" 15 #include "skia/ext/platform_canvas.h"
15 16
16 namespace cc { 17 namespace cc {
17 18
18 BitmapCanvasLayerTextureUpdater::Texture::Texture(BitmapCanvasLayerTextureUpdate r* textureUpdater, PassOwnPtr<CCPrioritizedTexture> texture) 19 BitmapCanvasLayerTextureUpdater::Texture::Texture(BitmapCanvasLayerTextureUpdate r* textureUpdater, PassOwnPtr<CCPrioritizedTexture> texture)
19 : LayerTextureUpdater::Texture(texture) 20 : LayerTextureUpdater::Texture(texture)
20 , m_textureUpdater(textureUpdater) 21 , m_textureUpdater(textureUpdater)
21 { 22 {
22 } 23 }
23 24
24 BitmapCanvasLayerTextureUpdater::Texture::~Texture() 25 BitmapCanvasLayerTextureUpdater::Texture::~Texture()
25 { 26 {
26 } 27 }
27 28
28 void BitmapCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* re sourceProvider, const IntRect& sourceRect, const IntSize& destOffset) 29 void BitmapCanvasLayerTextureUpdater::Texture::update(CCTextureUpdateQueue& queu e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, CCR enderingStats&)
29 { 30 {
30 textureUpdater()->updateTextureRect(resourceProvider, texture(), sourceRect, destOffset); 31 textureUpdater()->updateTexture(queue, texture(), sourceRect, destOffset, pa rtialUpdate);
31 } 32 }
32 33
33 PassRefPtr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::cre ate(PassOwnPtr<LayerPainterChromium> painter) 34 PassRefPtr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::cre ate(PassOwnPtr<LayerPainterChromium> painter)
34 { 35 {
35 return adoptRef(new BitmapCanvasLayerTextureUpdater(painter)); 36 return adoptRef(new BitmapCanvasLayerTextureUpdater(painter));
36 } 37 }
37 38
38 BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(PassOwnPtr<Laye rPainterChromium> painter) 39 BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(PassOwnPtr<Laye rPainterChromium> painter)
39 : CanvasLayerTextureUpdater(painter) 40 : CanvasLayerTextureUpdater(painter)
40 , m_opaque(false) 41 , m_opaque(false)
(...skipping 19 matching lines...) Expand all
60 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)
61 { 62 {
62 if (m_canvasSize != contentRect.size()) { 63 if (m_canvasSize != contentRect.size()) {
63 m_canvasSize = contentRect.size(); 64 m_canvasSize = contentRect.size();
64 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));
65 } 66 }
66 67
67 paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeigh tScale, resultingOpaqueRect, stats); 68 paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeigh tScale, resultingOpaqueRect, stats);
68 } 69 }
69 70
70 void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCResourceProvider* reso urceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const In tSize& destOffset) 71 void BitmapCanvasLayerTextureUpdater::updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOf fset, bool partialUpdate)
71 { 72 {
72 const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false); 73 TextureUploader::Parameters upload = { texture, &m_canvas->getDevice()->acce ssBitmap(false), NULL, { contentRect(), sourceRect, destOffset } };
73 bitmap.lockPixels(); 74 if (partialUpdate)
74 75 queue.appendPartialUpload(upload);
75 texture->upload(resourceProvider, static_cast<const uint8_t*>(bitmap.getPixe ls()), contentRect(), sourceRect, destOffset); 76 else
76 bitmap.unlockPixels(); 77 queue.appendFullUpload(upload);
77 } 78 }
78 79
79 void BitmapCanvasLayerTextureUpdater::setOpaque(bool opaque) 80 void BitmapCanvasLayerTextureUpdater::setOpaque(bool opaque)
80 { 81 {
81 if (opaque != m_opaque) { 82 if (opaque != m_opaque) {
82 m_canvas.clear(); 83 m_canvas.clear();
83 m_canvasSize = IntSize(); 84 m_canvasSize = IntSize();
84 } 85 }
85 m_opaque = opaque; 86 m_opaque = opaque;
86 } 87 }
87 88
88 } // namespace cc 89 } // namespace cc
89 #endif // USE(ACCELERATED_COMPOSITING) 90 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698