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

Unified Diff: src/core/SkNinePatchIter.h

Issue 1211583003: add drawImageNine (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: uniformly check for null-pixelref Created 5 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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkNinePatchIter.h
diff --git a/src/core/SkNinePatchIter.h b/src/core/SkNinePatchIter.h
new file mode 100644
index 0000000000000000000000000000000000000000..693467c4311be80e1b55679a0c37a48494e64d35
--- /dev/null
+++ b/src/core/SkNinePatchIter.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkNinePatchIter_DEFINED
+#define SkNinePatchIter_DEFINED
+
+#include "SkScalar.h"
+
+struct SkIRect;
+struct SkRect;
+
+/**
robertphillips 2015/06/25 15:53:21 dissect ? iterator -> series ?
reed1 2015/06/25 19:12:29 Done.
+ * Disect a ninepatch request into an iterator of src-rect / dst-rect pairs
+ */
+class SkNinePatchIter {
+public:
+ static bool Valid(int imageWidth, int imageHeight, const SkIRect& center);
+
+ SkNinePatchIter(int imageWidth, int imageHeight, const SkIRect& center, const SkRect& dst);
+
+ /**
+ * While it returns true, use src/dst to draw the image/bitmap
+ */
+ bool next(SkRect* src, SkRect* dst);
+
+private:
+ SkScalar fSrcX[4];
+ SkScalar fSrcY[4];
+ SkScalar fDstX[4];
+ SkScalar fDstY[4];
+
+ int fCurrX;
+ int fCurrY;
+ bool fDone;
+};
+
+#endif
+

Powered by Google App Engine
This is Rietveld 408576698