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

Side by Side Diff: cc/resources/bitmap_content_layer_updater.h

Issue 315393002: Record SkPicture with correct LCD text setting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better unittest Created 6 years, 6 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 #ifndef CC_RESOURCES_BITMAP_CONTENT_LAYER_UPDATER_H_ 5 #ifndef CC_RESOURCES_BITMAP_CONTENT_LAYER_UPDATER_H_
6 #define CC_RESOURCES_BITMAP_CONTENT_LAYER_UPDATER_H_ 6 #define CC_RESOURCES_BITMAP_CONTENT_LAYER_UPDATER_H_
7 7
8 #include "cc/base/cc_export.h" 8 #include "cc/base/cc_export.h"
9 #include "cc/resources/content_layer_updater.h" 9 #include "cc/resources/content_layer_updater.h"
10 #include "skia/ext/refptr.h" 10 #include "skia/ext/refptr.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
12 12
13 class SkCanvas; 13 class SkCanvas;
14 14
15 namespace cc { 15 namespace cc {
16 16
17 class LayerPainter;
18 class RenderingStatsInstrumenation; 17 class RenderingStatsInstrumenation;
19 18
20 // This class rasterizes the content_rect into a skia bitmap canvas. It then 19 // This class rasterizes the content_rect into a skia bitmap canvas. It then
21 // creates a ResourceUpdate with this bitmap canvas and inserts the 20 // creates a ResourceUpdate with this bitmap canvas and inserts the
22 // ResourceBundle to the provided ResourceUpdateQueue. Actual texture uploading 21 // ResourceBundle to the provided ResourceUpdateQueue. Actual texture uploading
23 // is done by ResourceUpdateController. 22 // is done by ResourceUpdateController.
24 class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater { 23 class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater {
25 public: 24 public:
26 class Resource : public LayerUpdater::Resource { 25 class Resource : public LayerUpdater::Resource {
27 public: 26 public:
28 Resource(BitmapContentLayerUpdater* updater, 27 Resource(BitmapContentLayerUpdater* updater,
29 scoped_ptr<PrioritizedResource> resource); 28 scoped_ptr<PrioritizedResource> resource);
30 virtual ~Resource(); 29 virtual ~Resource();
31 30
32 virtual void Update(ResourceUpdateQueue* queue, 31 virtual void Update(ResourceUpdateQueue* queue,
33 const gfx::Rect& source_rect, 32 const gfx::Rect& source_rect,
34 const gfx::Vector2d& dest_offset, 33 const gfx::Vector2d& dest_offset,
35 bool partial_update) OVERRIDE; 34 bool partial_update) OVERRIDE;
36 35
37 private: 36 private:
38 BitmapContentLayerUpdater* updater_; 37 BitmapContentLayerUpdater* updater_;
39 38
40 DISALLOW_COPY_AND_ASSIGN(Resource); 39 DISALLOW_COPY_AND_ASSIGN(Resource);
41 }; 40 };
42 41
43 static scoped_refptr<BitmapContentLayerUpdater> Create( 42 static scoped_refptr<BitmapContentLayerUpdater> Create(
44 scoped_ptr<LayerPainter> painter, 43 scoped_ptr<ContentLayerPainter> painter,
45 RenderingStatsInstrumentation* stats_instrumenation, 44 RenderingStatsInstrumentation* stats_instrumenation,
46 int layer_id); 45 int layer_id);
47 46
48 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( 47 virtual scoped_ptr<LayerUpdater::Resource> CreateResource(
49 PrioritizedResourceManager* manager) OVERRIDE; 48 PrioritizedResourceManager* manager) OVERRIDE;
50 virtual void PrepareToUpdate(const gfx::Rect& content_rect, 49 virtual void PrepareToUpdate(const gfx::Rect& content_rect,
51 const gfx::Size& tile_size, 50 const gfx::Size& tile_size,
52 float contents_width_scale, 51 float contents_width_scale,
53 float contents_height_scale, 52 float contents_height_scale,
54 gfx::Rect* resulting_opaque_rect) OVERRIDE; 53 gfx::Rect* resulting_opaque_rect) OVERRIDE;
55 void UpdateTexture(ResourceUpdateQueue* queue, 54 void UpdateTexture(ResourceUpdateQueue* queue,
56 PrioritizedResource* resource, 55 PrioritizedResource* resource,
57 const gfx::Rect& source_rect, 56 const gfx::Rect& source_rect,
58 const gfx::Vector2d& dest_offset, 57 const gfx::Vector2d& dest_offset,
59 bool partial_update); 58 bool partial_update);
60 virtual void SetOpaque(bool opaque) OVERRIDE; 59 virtual void SetOpaque(bool opaque) OVERRIDE;
61 virtual void ReduceMemoryUsage() OVERRIDE; 60 virtual void ReduceMemoryUsage() OVERRIDE;
62 61
63 protected: 62 protected:
64 BitmapContentLayerUpdater( 63 BitmapContentLayerUpdater(scoped_ptr<ContentLayerPainter> painter,
65 scoped_ptr<LayerPainter> painter, 64 RenderingStatsInstrumentation* stats_instrumenation,
66 RenderingStatsInstrumentation* stats_instrumenation, 65 int layer_id);
67 int layer_id);
68 virtual ~BitmapContentLayerUpdater(); 66 virtual ~BitmapContentLayerUpdater();
69 67
70 SkBitmap bitmap_backing_; 68 SkBitmap bitmap_backing_;
71 skia::RefPtr<SkCanvas> canvas_; 69 skia::RefPtr<SkCanvas> canvas_;
72 gfx::Size canvas_size_; 70 gfx::Size canvas_size_;
73 71
74 private: 72 private:
75 DISALLOW_COPY_AND_ASSIGN(BitmapContentLayerUpdater); 73 DISALLOW_COPY_AND_ASSIGN(BitmapContentLayerUpdater);
76 }; 74 };
77 75
78 } // namespace cc 76 } // namespace cc
79 77
80 #endif // CC_RESOURCES_BITMAP_CONTENT_LAYER_UPDATER_H_ 78 #endif // CC_RESOURCES_BITMAP_CONTENT_LAYER_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698