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

Side by Side Diff: ui/android/resources/nine_patch_resource.h

Issue 2752693003: chrome/android: Update toolbar drawing in native. (Closed)
Patch Set: fix math for tablets Created 3 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 UI_ANDROID_RESOURCES_NINE_PATCH_RESOURCE_H_ 5 #ifndef UI_ANDROID_RESOURCES_NINE_PATCH_RESOURCE_H_
6 #define UI_ANDROID_RESOURCES_NINE_PATCH_RESOURCE_H_ 6 #define UI_ANDROID_RESOURCES_NINE_PATCH_RESOURCE_H_
7 7
8 #include "ui/android/resources/resource.h" 8 #include "ui/android/resources/resource.h"
9 #include "ui/android/ui_android_export.h" 9 #include "ui/android/ui_android_export.h"
10 #include "ui/gfx/geometry/insets_f.h" 10 #include "ui/gfx/geometry/insets_f.h"
11 11
12 namespace cc {
13 class NinePatchLayer;
14 }
15
12 namespace ui { 16 namespace ui {
13 17
14 class UI_ANDROID_EXPORT NinePatchResource final : public Resource { 18 class UI_ANDROID_EXPORT NinePatchResource final : public Resource {
15 public: 19 public:
16 static NinePatchResource* From(Resource* resource); 20 static NinePatchResource* From(Resource* resource);
17 21
18 NinePatchResource(gfx::Rect padding, gfx::Rect aperture); 22 NinePatchResource(gfx::Rect padding, gfx::Rect aperture);
19 ~NinePatchResource() override; 23 ~NinePatchResource() override;
20 24
21 std::unique_ptr<Resource> CreateForCopy() override; 25 std::unique_ptr<Resource> CreateForCopy() override;
22 26
27 // Updates draw properties on |layer| used to draw this resource. The
28 // |content_location| is the rect of the content to be fit inside the resource
29 // in the parent's coordinate space.
30 void UpdateNinePatchLayer(cc::NinePatchLayer* layer,
31 const gfx::Rect& content_location) const;
32
23 gfx::Rect Border(const gfx::Size& bounds) const; 33 gfx::Rect Border(const gfx::Size& bounds) const;
24 gfx::Rect Border(const gfx::Size& bounds, const gfx::InsetsF& scale) const; 34 gfx::Rect Border(const gfx::Size& bounds, const gfx::InsetsF& scale) const;
25 35
26 gfx::Rect padding() const { return padding_; } 36 gfx::Rect padding() const { return padding_; }
27 gfx::Rect aperture() const { return aperture_; } 37 gfx::Rect aperture() const { return aperture_; }
28 38
29 private: 39 private:
30 const gfx::Rect padding_; 40 const gfx::Rect padding_;
31 const gfx::Rect aperture_; 41 const gfx::Rect aperture_;
32 }; 42 };
33 43
34 } // namespace ui 44 } // namespace ui
35 45
36 #endif // UI_ANDROID_RESOURCES_NINE_PATCH_RESOURCE_H_ 46 #endif // UI_ANDROID_RESOURCES_NINE_PATCH_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698