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

Side by Side Diff: cc/nine_patch_layer.h

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 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
« no previous file with comments | « cc/layer_unittest.cc ('k') | cc/nine_patch_layer.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_NINE_PATCH_LAYER_H_ 5 #ifndef CC_NINE_PATCH_LAYER_H_
6 #define CC_NINE_PATCH_LAYER_H_ 6 #define CC_NINE_PATCH_LAYER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/cc_export.h" 9 #include "cc/cc_export.h"
10 #include "cc/layer.h" 10 #include "cc/layer.h"
11 #include "cc/image_layer_updater.h" 11 #include "cc/image_layer_updater.h"
12 #include "ui/gfx/rect.h" 12 #include "ui/gfx/rect.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 class ResourceUpdateQueue; 17 class ResourceUpdateQueue;
18 18
19 class CC_EXPORT NinePatchLayer : public Layer { 19 class CC_EXPORT NinePatchLayer : public Layer {
20 public: 20 public:
21 static scoped_refptr<NinePatchLayer> Create(); 21 static scoped_refptr<NinePatchLayer> Create();
22 22
23 virtual bool drawsContent() const OVERRIDE; 23 virtual bool DrawsContent() const OVERRIDE;
24 virtual void setTexturePriorities(const PriorityCalculator& priority_calc) 24 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc)
25 OVERRIDE; 25 OVERRIDE;
26 virtual void update(ResourceUpdateQueue& queue, 26 virtual void Update(ResourceUpdateQueue* queue,
27 const OcclusionTracker* occlusion, 27 const OcclusionTracker* occlusion,
28 RenderingStats* stats) OVERRIDE; 28 RenderingStats* stats) OVERRIDE;
29 virtual void pushPropertiesTo(LayerImpl* layer) OVERRIDE; 29 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
30 30
31 // aperture is in the pixel space of the bitmap resource and refers to 31 // aperture is in the pixel space of the bitmap resource and refers to
32 // the center patch of the ninepatch (which is unused in this 32 // the center patch of the ninepatch (which is unused in this
33 // implementation). We split off eight rects surrounding it and stick them 33 // implementation). We split off eight rects surrounding it and stick them
34 // on the edges of the layer. The corners are unscaled, the top and bottom 34 // on the edges of the layer. The corners are unscaled, the top and bottom
35 // rects are x-stretched to fit, and the left and right rects are 35 // rects are x-stretched to fit, and the left and right rects are
36 // y-stretched to fit. 36 // y-stretched to fit.
37 void SetBitmap(const SkBitmap& bitmap, gfx::Rect aperture); 37 void SetBitmap(const SkBitmap& bitmap, gfx::Rect aperture);
38 38
39 private: 39 private:
40 NinePatchLayer(); 40 NinePatchLayer();
41 virtual ~NinePatchLayer(); 41 virtual ~NinePatchLayer();
42 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* tree_impl) 42 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
43 OVERRIDE; 43 OVERRIDE;
44 44
45 void CreateUpdaterIfNeeded(); 45 void CreateUpdaterIfNeeded();
46 void CreateResource(); 46 void CreateResource();
47 47
48 scoped_refptr<ImageLayerUpdater> updater_; 48 scoped_refptr<ImageLayerUpdater> updater_;
49 scoped_ptr<LayerUpdater::Resource> resource_; 49 scoped_ptr<LayerUpdater::Resource> resource_;
50 50
51 SkBitmap bitmap_; 51 SkBitmap bitmap_;
52 bool bitmap_dirty_; 52 bool bitmap_dirty_;
53 53
54 // The transparent center region that shows the parent layer's contents in 54 // The transparent center region that shows the parent layer's contents in
55 // image space. 55 // image space.
56 gfx::Rect image_aperture_; 56 gfx::Rect image_aperture_;
57 }; 57 };
58 58
59 } // namespace cc 59 } // namespace cc
60 60
61 #endif // CC_NINE_PATCH_LAYER_H_ 61 #endif // CC_NINE_PATCH_LAYER_H_
OLDNEW
« no previous file with comments | « cc/layer_unittest.cc ('k') | cc/nine_patch_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698