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

Unified Diff: src/pipe/SkPipeFormat.h

Issue 2201323003: add pipecanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: initial reader 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
Index: src/pipe/SkPipeFormat.h
diff --git a/src/pipe/SkPipeFormat.h b/src/pipe/SkPipeFormat.h
new file mode 100644
index 0000000000000000000000000000000000000000..a4176265cc6c78e150ff18e00b1162c5b5904a49
--- /dev/null
+++ b/src/pipe/SkPipeFormat.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPipeFormat_DEFINED
+#define SkPipeFormat_DEFINED
+
+#include "SkTypes.h"
+
+enum Verb {
mtklein 2016/08/04 12:50:38 : uint8_t ?
mtklein 2016/08/04 12:50:38 Should probably namespace all these symbols someho
reed1 2016/08/04 13:18:41 Definitely, just going fast at the moment
+ kSave_Verb,
+ kRestore_Verb,
+ kConcat_Verb,
+
+ kClipRect_Verb,
+ kClipRRect_Verb,
+ kClipPath_Verb,
+ kClipRegion_Verb,
+
+ kDrawDRRect_Verb,
+ kDrawText_Verb,
+ kDrawPosText_Verb,
+ kDrawPosTextH_Verb,
+ kDrawTextOnPath_Verb,
+ kDrawTextBlob_Verb,
+ kDrawTextRSXform_Verb,
+ kDrawPatch_Verb,
+ kDrawPaint_Verb,
+ kDrawPoints_Verb,
+ kDrawRect_Verb,
+ kDrawPath_Verb,
+ kDrawOval_Verb,
+ kDrawRRect_Verb,
+
+ kDrawImage_Verb,
+ kDrawImageRect_Verb,
+ kDrawImageNine_Verb,
+
+ kDrawVertices_Verb,
+
+ kDrawPicture_Verb,
+ kDrawAnnotation_Verb,
+
+ kLastVerb = kDrawAnnotation_Verb,
+};
+
+enum PaintUsage {
+ kText_PaintUsage = 1 << 0,
+ kGeometry_PaintUsage = 1 << 1,
+ kImage_PaintUsage = 1 << 2,
+ kSaveLayer_PaintUsage = 1 << 3,
+ kDrawPaint_PaintUsage = 1 << 4,
+};
+
+// must sum to <= 32
+enum BitsPerField {
+ kFlags_BPF = 16,
+ kHint_BPF = 2,
+ kAlign_BPF = 2,
+ kFilter_BPF = 2,
+ kCaps_BPF = 2,
+ kJoins_BPF = 2,
+};
+
+enum {
+ kTextSize_NonDef = 1 << 0,
+ kTextScaleX_NonDef = 1 << 1,
+ kTextSkewX_NonDef = 1 << 2,
+ kStrokeWidth_NonDef = 1 << 3,
+ kStrokeMiter_NonDef = 1 << 4,
+ kColor_NonDef = 1 << 5,
+ kTypeface_NonDef = 1 << 6,
+ kPathEffect_NonDef = 1 << 7,
+ kShader_NonDef = 1 << 8,
+ kXfermode_NonDef = 1 << 9,
+ kMaskFilter_NonDef = 1 << 10,
+ kColorFilter_NonDef = 1 << 11,
+ kRasterizer_NonDef = 1 << 12,
+ kImageFilter_NonDef = 1 << 13,
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+static inline bool fits_in(int value, int bits) {
+ return value >= 0 && value < (1 << bits);
+}
+
+static inline void ASSERT_FITS_IN(int value, int bits) {
+ SkASSERT(fits_in(value, bits));
+}
+
+static inline uint32_t pack_verb(Verb verb, unsigned extra = 0) {
+ ASSERT_FITS_IN(verb, 8);
+ ASSERT_FITS_IN(extra, 24);
+ return ((uint32_t)verb << 24) | extra;
+}
+
+static inline Verb unpack_verb(uint32_t data) {
+ return (Verb)(data >> 24);
+}
+
+static inline unsigned unpack_verb_extra(uint32_t data) {
+ return data & 0xFFFFFF;
+}
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698