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

Unified Diff: src/core/SkLatticeIter.h

Issue 1992283002: Add drawBitmapLattice() API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rewrite picture impls Created 4 years, 4 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
« no previous file with comments | « src/core/SkDevice.cpp ('k') | src/core/SkLatticeIter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLatticeIter.h
diff --git a/src/core/SkLatticeIter.h b/src/core/SkLatticeIter.h
new file mode 100644
index 0000000000000000000000000000000000000000..e2d767f1c8a5383d2f6d2e1b0bb115129a35156c
--- /dev/null
+++ b/src/core/SkLatticeIter.h
@@ -0,0 +1,49 @@
+/*
+ * 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 SkLatticeIter_DEFINED
+#define SkLatticeIter_DEFINED
+
+#include "SkCanvas.h"
+#include "SkScalar.h"
+#include "SkTArray.h"
+
+struct SkIRect;
+struct SkRect;
+
+/**
+ * Disect a lattice request into an sequence of src-rect / dst-rect pairs
+ */
+class SkLatticeIter {
+public:
+
+ static bool Valid(int imageWidth, int imageHeight, const SkCanvas::Lattice& lattice);
+
+ SkLatticeIter(int imageWidth, int imageHeight, const SkCanvas::Lattice& lattice,
+ const SkRect& dst);
+
+ static bool Valid(int imageWidth, int imageHeight, const SkIRect& center);
+
+ SkLatticeIter(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:
+ SkTArray<SkScalar> fSrcX;
+ SkTArray<SkScalar> fSrcY;
+ SkTArray<SkScalar> fDstX;
+ SkTArray<SkScalar> fDstY;
+
+ int fCurrX;
+ int fCurrY;
+ bool fDone;
+};
+
+#endif
« no previous file with comments | « src/core/SkDevice.cpp ('k') | src/core/SkLatticeIter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698