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

Unified Diff: runtime/embedders/openglui/common/support.h

Issue 12186002: Canvas API. There are still a number of things to do: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | « runtime/embedders/openglui/common/sound_handler.cc ('k') | runtime/embedders/openglui/common/timer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/embedders/openglui/common/support.h
===================================================================
--- runtime/embedders/openglui/common/support.h (revision 0)
+++ runtime/embedders/openglui/common/support.h (revision 0)
@@ -0,0 +1,37 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef EMBEDDERS_OPENGLUI_COMMON_SUPPORT_H_
+#define EMBEDDERS_OPENGLUI_COMMON_SUPPORT_H_
+
+#include "embedders/openglui/common/opengl.h"
+
+#ifndef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+#ifndef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
+// Colors as used by canvas.
+typedef struct ColorRGBA {
+ // We store Skia-compatible values. Skia uses
+ // the form AARRGGBB.
+ uint32_t v;
+
+ inline ColorRGBA(char rp, char gp, char bp, char ap = 255) {
+ v = ((static_cast<uint32_t>(rp) & 0xFF) << 16) |
+ ((static_cast<uint32_t>(gp) & 0xFF) << 8) |
+ ((static_cast<uint32_t>(bp) & 0xFF) << 0) |
+ ((static_cast<uint32_t>(ap) & 0xFF) << 24);
+ }
+ inline ColorRGBA(uint32_t vp)
+ : v(vp) {
+ }
+ inline uint8_t alpha() {
+ return (v >> 24) & 0xFF;
+ }
+} ColorRGBA;
+
+#endif // EMBEDDERS_OPENGLUI_COMMON_SUPPORT_H_
« no previous file with comments | « runtime/embedders/openglui/common/sound_handler.cc ('k') | runtime/embedders/openglui/common/timer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698