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

Unified Diff: ui/android/resources/nine_patch_resource.h

Issue 2752693003: chrome/android: Update toolbar drawing in native. (Closed)
Patch Set: .. 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 side-by-side diff with in-line comments
Download patch
Index: ui/android/resources/nine_patch_resource.h
diff --git a/ui/android/resources/nine_patch_resource.h b/ui/android/resources/nine_patch_resource.h
index 11b6502dbc905b9fa2151a1332ad930b736ef29d..9fe3815eae5d231eb86dc28996302050b83441a6 100644
--- a/ui/android/resources/nine_patch_resource.h
+++ b/ui/android/resources/nine_patch_resource.h
@@ -8,6 +8,11 @@
#include "ui/android/resources/resource.h"
#include "ui/android/ui_android_export.h"
#include "ui/gfx/geometry/insets_f.h"
+#include "ui/gfx/geometry/point_f.h"
+
+namespace cc {
+class NinePatchLayer;
+}
namespace ui {
@@ -20,6 +25,20 @@ class UI_ANDROID_EXPORT NinePatchResource final : public Resource {
std::unique_ptr<Resource> CreateForCopy() override;
+ // Returns the drawing size that the resource will take for padding content
+ // of size |content_size|.
+ gfx::Size DrawSize(const gfx::Size& content_size) const;
+
+ // Returns the position where the resource should be drawn to account for
+ // margins, given the |content_position| in the parent's coordinate space.
+ gfx::PointF DrawPosition(const gfx::Point& content_position) const;
+
+ // Updates draw properties on |layer| used to draw this resource. The
+ // |content_location| is the rect of the content to be fit inside the resource
+ // in the parent's coordinate space.
+ void UpdateNinePatchLayer(cc::NinePatchLayer* layer,
+ const gfx::Rect& content_location) const;
+
gfx::Rect Border(const gfx::Size& bounds) const;
gfx::Rect Border(const gfx::Size& bounds, const gfx::InsetsF& scale) const;

Powered by Google App Engine
This is Rietveld 408576698