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

Unified Diff: src/core/SkDeviceLooper.h

Issue 23392006: add SkDeviceLooper to handle larger-than-fixedpoint (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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
Index: src/core/SkDeviceLooper.h
diff --git a/src/core/SkDeviceLooper.h b/src/core/SkDeviceLooper.h
new file mode 100644
index 0000000000000000000000000000000000000000..fae03be82c8c4559686087367804ec124bd61487
--- /dev/null
+++ b/src/core/SkDeviceLooper.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkDeviceLooper_DEFINED
+#define SkDeviceLooper_DEFINED
+
+#include "SkBitmap.h"
+#include "SkMatrix.h"
+#include "SkRasterClip.h"
+
+class SkDeviceLooper {
tomhudson 2013/08/28 10:53:05 Since this has state that changes the class semant
reed1 2013/08/28 12:35:07 Yes indeed, I will add dox.
+public:
+ SkDeviceLooper(const SkBitmap& base, const SkRasterClip&,
+ const SkIRect& bounds, bool aa);
+ ~SkDeviceLooper();
+
+ const SkBitmap& getBitmap() const {
+ SkASSERT(kDone_State != fState);
+ return *fCurrBitmap;
+ }
+
+ const SkRasterClip& getRC() const {
+ SkASSERT(kDone_State != fState);
+ return *fCurrRC;
+ }
+
+ void mapRect(SkRect* dst, const SkRect& src) const;
+ void mapMatrix(SkMatrix* dst, const SkMatrix& src) const;
+
+ bool next();
+
+private:
+ const SkBitmap& fBaseBitmap;
+ const SkRasterClip& fBaseRC;
+
+ enum State {
+ kDone_State, // iteration is complete, getters will assert
+ kSimple_State, // no translate/clip mods needed
+ kComplex_State
+ };
+
+ // storage for our tiled versions. Perhaps could use SkTLazy
+ SkBitmap fSubsetBitmap;
+ SkRasterClip fSubsetRC;
+
+ const SkBitmap* fCurrBitmap;
+ const SkRasterClip* fCurrRC;
+ SkIRect fClippedBounds;
+ SkIPoint fCurrOffset;
+ int fDelta;
+ State fState;
+
+ enum Delta {
+ kBW_Delta = 1 << 14, // 16K, gives room to spare for fixedpoint
+ kAA_Delta = kBW_Delta >> 2 // supersample 4x
+ };
+
+ bool fitsInDelta(const SkIRect& r) const {
+ return r.right() < fDelta && r.bottom() < fDelta;
+ }
+
+ bool computeCurrBitmapAndClip();
+};
+
+#endif
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkDeviceLooper.cpp » ('j') | src/core/SkDraw.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698