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

Side by Side Diff: cc/bitmap_content_layer_updater.cc

Issue 11266030: Use gfx:: Geometry types for the resource provider and layer updater classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uint8 Created 8 years, 1 month 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 | « cc/bitmap_content_layer_updater.h ('k') | cc/bitmap_skpicture_content_layer_updater.h » ('j') | no next file with comments »
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 #include "config.h" 5 #include "config.h"
6 6
7 #include "cc/bitmap_content_layer_updater.h" 7 #include "cc/bitmap_content_layer_updater.h"
8 8
9 #include "cc/layer_painter.h" 9 #include "cc/layer_painter.h"
10 #include "cc/resource_update.h" 10 #include "cc/resource_update.h"
11 #include "cc/resource_update_queue.h" 11 #include "cc/resource_update_queue.h"
12 #include "skia/ext/platform_canvas.h" 12 #include "skia/ext/platform_canvas.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 BitmapContentLayerUpdater::Resource::Resource(BitmapContentLayerUpdater* updater , scoped_ptr<PrioritizedTexture> texture) 16 BitmapContentLayerUpdater::Resource::Resource(BitmapContentLayerUpdater* updater , scoped_ptr<PrioritizedTexture> texture)
17 : LayerUpdater::Resource(texture.Pass()) 17 : LayerUpdater::Resource(texture.Pass())
18 , m_updater(updater) 18 , m_updater(updater)
19 { 19 {
20 } 20 }
21 21
22 BitmapContentLayerUpdater::Resource::~Resource() 22 BitmapContentLayerUpdater::Resource::~Resource()
23 { 23 {
24 } 24 }
25 25
26 void BitmapContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, con st IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate, Rendering Stats&) 26 void BitmapContentLayerUpdater::Resource::update(ResourceUpdateQueue& queue, con st gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, R enderingStats&)
27 { 27 {
28 updater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUp date); 28 updater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUp date);
29 } 29 }
30 30
31 scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::create(scope d_ptr<LayerPainter> painter) 31 scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::create(scope d_ptr<LayerPainter> painter)
32 { 32 {
33 return make_scoped_refptr(new BitmapContentLayerUpdater(painter.Pass())); 33 return make_scoped_refptr(new BitmapContentLayerUpdater(painter.Pass()));
34 } 34 }
35 35
36 BitmapContentLayerUpdater::BitmapContentLayerUpdater(scoped_ptr<LayerPainter> pa inter) 36 BitmapContentLayerUpdater::BitmapContentLayerUpdater(scoped_ptr<LayerPainter> pa inter)
37 : ContentLayerUpdater(painter.Pass()) 37 : ContentLayerUpdater(painter.Pass())
38 , m_opaque(false) 38 , m_opaque(false)
39 { 39 {
40 } 40 }
41 41
42 BitmapContentLayerUpdater::~BitmapContentLayerUpdater() 42 BitmapContentLayerUpdater::~BitmapContentLayerUpdater()
43 { 43 {
44 } 44 }
45 45
46 scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::createResource(Pri oritizedTextureManager* manager) 46 scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::createResource(Pri oritizedTextureManager* manager)
47 { 47 {
48 return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedText ure::create(manager))); 48 return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedText ure::create(manager)));
49 } 49 }
50 50
51 void BitmapContentLayerUpdater::prepareToUpdate(const IntRect& contentRect, cons t IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRec t& resultingOpaqueRect, RenderingStats& stats) 51 void BitmapContentLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, co nst gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gf x::Rect& resultingOpaqueRect, RenderingStats& stats)
52 { 52 {
53 if (m_canvasSize != contentRect.size()) { 53 if (m_canvasSize != contentRect.size()) {
54 m_canvasSize = contentRect.size(); 54 m_canvasSize = contentRect.size();
55 m_canvas = make_scoped_ptr(skia::CreateBitmapCanvas(m_canvasSize.width() , m_canvasSize.height(), m_opaque)); 55 m_canvas = make_scoped_ptr(skia::CreateBitmapCanvas(m_canvasSize.width() , m_canvasSize.height(), m_opaque));
56 } 56 }
57 57
58 paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeigh tScale, resultingOpaqueRect, stats); 58 paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeigh tScale, resultingOpaqueRect, stats);
59 } 59 }
60 60
61 void BitmapContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, Priori tizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, boo l partialUpdate) 61 void BitmapContentLayerUpdater::updateTexture(ResourceUpdateQueue& queue, Priori tizedTexture* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOff set, bool partialUpdate)
62 { 62 {
63 ResourceUpdate upload = ResourceUpdate::Create( 63 ResourceUpdate upload = ResourceUpdate::Create(
64 texture, 64 texture,
65 &m_canvas->getDevice()->accessBitmap(false), 65 &m_canvas->getDevice()->accessBitmap(false),
66 contentRect(), 66 contentRect(),
67 sourceRect, 67 sourceRect,
68 destOffset); 68 destOffset);
69 if (partialUpdate) 69 if (partialUpdate)
70 queue.appendPartialUpload(upload); 70 queue.appendPartialUpload(upload);
71 else 71 else
72 queue.appendFullUpload(upload); 72 queue.appendFullUpload(upload);
73 } 73 }
74 74
75 void BitmapContentLayerUpdater::setOpaque(bool opaque) 75 void BitmapContentLayerUpdater::setOpaque(bool opaque)
76 { 76 {
77 if (opaque != m_opaque) { 77 if (opaque != m_opaque) {
78 m_canvas.reset(); 78 m_canvas.reset();
79 m_canvasSize = IntSize(); 79 m_canvasSize = gfx::Size();
80 } 80 }
81 m_opaque = opaque; 81 m_opaque = opaque;
82 } 82 }
83 83
84 } // namespace cc 84 } // namespace cc
OLDNEW
« no previous file with comments | « cc/bitmap_content_layer_updater.h ('k') | cc/bitmap_skpicture_content_layer_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698