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

Side by Side Diff: cc/nine_patch_layer_impl.h

Issue 11304020: cc: Nine patch layer. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add unit tests and address code review 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NinePatchLayerImpl_h
6 #define NinePatchLayerImpl_h
7
8 #include "cc/layer_impl.h"
9 #include "cc/resource_provider.h"
10 #include "ui/gfx/size.h"
11 #include "ui/gfx/rect.h"
12
13 namespace cc {
14
15 class NinePatchLayerImpl : public LayerImpl {
16 public:
17 static scoped_ptr<NinePatchLayerImpl> create(int id)
18 {
19 return make_scoped_ptr(new NinePatchLayerImpl(id));
20 }
21 virtual ~NinePatchLayerImpl();
22
23 void setResourceId(unsigned id) { m_resourceId = id; }
24 void setLayout(const gfx::Size& imageBounds, const gfx::Rect& aperture);
25
26 virtual void willDraw(ResourceProvider*) OVERRIDE;
27 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
28 virtual void didDraw(ResourceProvider*) OVERRIDE;
29 virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE;
30 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
31 virtual void didLoseContext() OVERRIDE;
32
33 protected:
34 explicit NinePatchLayerImpl(int id);
35
36 private:
37 virtual const char* layerTypeAsString() const OVERRIDE;
38
39 // The size of the NinePatch bitmap in pixels.
40 gfx::Size m_imageBounds;
41
42 // The transparent center region that shows the parent layer's contents in i mage space.
43 gfx::Rect m_imageAperture;
44
45 ResourceProvider::ResourceId m_resourceId;
46 };
47
48 }
49
50 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698