]> git.sesse.net Git - casparcg/commitdiff
fixed timeline-annotations in psd-producer that was accidentally broken in 5dcb547
authorNiklas P Andersson <niklas.p.andersson@svt.se>
Wed, 2 Dec 2015 10:08:21 +0000 (11:08 +0100)
committerNiklas P Andersson <niklas.p.andersson@svt.se>
Wed, 2 Dec 2015 10:08:21 +0000 (11:08 +0100)
using ENUM_ENABLE_BITWISE for the layer_tag enum

common/enum_class.h
modules/psd/misc.h
modules/psd/psd_document.cpp

index fa8225ae8a2272848ba9f88b6285d0824fe8fb49..c1cec94d5dba1aacbe5a3775e5ce5f034de74559 100644 (file)
        { \
                lhs = lhs & rhs; \
                return lhs; \
+       }; \
+       static enum_class operator | (enum_class lhs, enum_class rhs) \\r
+       { \\r
+               return static_cast<enum_class>( \\r
+                               static_cast<std::underlying_type<enum_class>::type>(lhs) \\r
+                                       | static_cast<std::underlying_type<enum_class>::type>(rhs)); \\r
+       }; \\r
+       static enum_class& operator|=(enum_class& lhs, enum_class rhs) \
+       { \
+               lhs = lhs | rhs; \
+               return lhs; \
+       }; \
+       static enum_class operator ^ (enum_class lhs, enum_class rhs) \\r
+       { \\r
+               return static_cast<enum_class>( \\r
+                               static_cast<std::underlying_type<enum_class>::type>(lhs) \\r
+                                       ^ static_cast<std::underlying_type<enum_class>::type>(rhs)); \\r
+       }; \\r
+       static enum_class& operator^=(enum_class& lhs, enum_class rhs) \
+       { \
+               lhs = lhs ^ rhs; \
+               return lhs; \
        };
 
 namespace caspar {
index 8fe8de9cd679746aa002f3b741d0bf97c0e9ee43..955903cbb0ba876f5fde1c58c2362e89d65fd78b 100644 (file)
-/*
-* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
-*
-* This file is part of CasparCG (www.casparcg.com).
-*
-* CasparCG is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* CasparCG is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
-*
-* Author: Niklas P Andersson, niklas.p.andersson@svt.se
-*/
-
-#pragma once
-
-#include <common/except.h>
-
-#include <string>
-#include <cstdint>
-
-namespace caspar { namespace psd {
-       
-template<typename T>
-struct point
-{
-       point() : x(0), y(0) {}
-       point(T x1, T y1) : x(x1), y(y1) {}
-       T x;
-       T y;
-
-       void clear() { x = 0; y = 0; }
-};
-
-template<typename T>
-struct color
-{
-       T red           = 0;
-       T green         = 0;
-       T blue          = 0;
-       T alpha         = 0;
-
-       std::uint32_t to_uint32()
-       {
-               return (alpha << 24) + (red << 16) + (green << 8) + blue;
-       }
-};
-
-template<typename T>
-struct size
-{
-       size() : width(0), height(0) {}
-       size(T w, T h) : width(w), height(h) {}
-       T width;
-       T height;
-
-       void clear() { width = 0; height = 0; }
-};
-
-template<typename T>
-struct rect
-{
-       point<T>                location;
-       psd::size<T>    size;
-
-       bool empty() const { return size.width == 0 || size.height == 0; }
-       void clear() { location.clear(); size.clear(); }
-};
-
-struct psd_file_format_exception : virtual caspar_exception {};
-
-enum class channel_type
-{
-       total_user_mask = -3,
-       user_mask = -2,
-       transparency = -1,
-       color_red = 0,
-       color_green = 1,
-       color_blue = 2
-};
-
-enum class layer_type
-{
-       content = 0,
-       group,
-       timeline_group,
-       group_delimiter
-};
-layer_type int_to_layer_type(std::uint32_t x, std::uint32_t y);
-std::wstring layer_type_to_string(layer_type b);
-
-enum class blend_mode
-{
-       InvalidBlendMode = -1,
-       Normal = 'norm',
-       Darken = 'dark',
-       Lighten = 'lite',
-       Hue = 'hue ',
-       Saturation = 'sat ',
-       Color = 'colr',
-       Luminosity = 'lum ',
-       Multiply = 'mul ',
-       Screen = 'scrn',
-       Dissolve = 'diss',
-       Overlay = 'over',
-       HardLight = 'hLit',
-       SoftLight = 'sLit',
-       Difference = 'diff',
-       Exclusion = 'smud',
-       ColorDodge = 'div ',
-       ColorBurn = 'idiv'
-};
-
-blend_mode int_to_blend_mode(std::uint32_t x);
-std::wstring blend_mode_to_string(blend_mode b);
-
-enum class color_mode
-{
-       InvalidColorMode = -1,
-       Bitmap = 0,
-       Grayscale = 1,
-       Indexed = 2,
-       RGB = 3,
-       CMYK = 4,
-       Multichannel = 7,
-       Duotone = 8,
-       Lab = 9
-};
-
-color_mode int_to_color_mode(std::uint16_t x);
-std::wstring color_mode_to_string(color_mode c);
-
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Niklas P Andersson, niklas.p.andersson@svt.se\r
+*/\r
+\r
+#pragma once\r
+\r
+#include <common/except.h>\r
+#include <common/enum_class.h>\r
+\r
+#include <string>\r
+#include <cstdint>\r
+\r
+namespace caspar { namespace psd {\r
+       \r
+template<typename T>\r
+struct point\r
+{\r
+       point() : x(0), y(0) {}\r
+       point(T x1, T y1) : x(x1), y(y1) {}\r
+       T x;\r
+       T y;\r
+\r
+       void clear() { x = 0; y = 0; }\r
+};\r
+\r
+template<typename T>\r
+struct color\r
+{\r
+       T red           = 0;\r
+       T green         = 0;\r
+       T blue          = 0;\r
+       T alpha         = 0;\r
+\r
+       std::uint32_t to_uint32()\r
+       {\r
+               return (alpha << 24) + (red << 16) + (green << 8) + blue;\r
+       }\r
+};\r
+\r
+template<typename T>\r
+struct size\r
+{\r
+       size() : width(0), height(0) {}\r
+       size(T w, T h) : width(w), height(h) {}\r
+       T width;\r
+       T height;\r
+\r
+       void clear() { width = 0; height = 0; }\r
+};\r
+\r
+template<typename T>\r
+struct rect\r
+{\r
+       point<T>                location;\r
+       psd::size<T>    size;\r
+\r
+       bool empty() const { return size.width == 0 || size.height == 0; }\r
+       void clear() { location.clear(); size.clear(); }\r
+};\r
+\r
+struct psd_file_format_exception : virtual caspar_exception {};\r
+\r
+enum class channel_type\r
+{\r
+       total_user_mask = -3,\r
+       user_mask = -2,\r
+       transparency = -1,\r
+       color_red = 0,\r
+       color_green = 1,\r
+       color_blue = 2\r
+};\r
+\r
+enum class layer_type\r
+{\r
+       content = 0,\r
+       group,\r
+       timeline_group,\r
+       group_delimiter\r
+};\r
+layer_type int_to_layer_type(std::uint32_t x, std::uint32_t y);\r
+std::wstring layer_type_to_string(layer_type b);\r
+\r
+enum class blend_mode\r
+{\r
+       InvalidBlendMode = -1,\r
+       Normal = 'norm',\r
+       Darken = 'dark',\r
+       Lighten = 'lite',\r
+       Hue = 'hue ',\r
+       Saturation = 'sat ',\r
+       Color = 'colr',\r
+       Luminosity = 'lum ',\r
+       Multiply = 'mul ',\r
+       Screen = 'scrn',\r
+       Dissolve = 'diss',\r
+       Overlay = 'over',\r
+       HardLight = 'hLit',\r
+       SoftLight = 'sLit',\r
+       Difference = 'diff',\r
+       Exclusion = 'smud',\r
+       ColorDodge = 'div ',\r
+       ColorBurn = 'idiv'\r
+};\r
+\r
+blend_mode int_to_blend_mode(std::uint32_t x);\r
+std::wstring blend_mode_to_string(blend_mode b);\r
+\r
+enum class color_mode\r
+{\r
+       InvalidColorMode = -1,\r
+       Bitmap = 0,\r
+       Grayscale = 1,\r
+       Indexed = 2,\r
+       RGB = 3,\r
+       CMYK = 4,\r
+       Multichannel = 7,\r
+       Duotone = 8,\r
+       Lab = 9\r
+};\r
+\r
+color_mode int_to_color_mode(std::uint16_t x);\r
+std::wstring color_mode_to_string(color_mode c);\r
+\r
 \r
 enum class layer_tag : int {\r
        none = 0,\r
@@ -147,25 +148,15 @@ enum class layer_tag : int {
        rasterized = 16,\r
        all = 31\r
 };\r
-inline layer_tag operator | (layer_tag lhs, layer_tag rhs)\r
-{\r
-       return (layer_tag)(static_cast<int>(lhs) | static_cast<int>(rhs));\r
-}\r
-inline layer_tag operator & (layer_tag lhs, layer_tag rhs)\r
-{\r
-       return (layer_tag)(static_cast<int>(lhs) & static_cast<int>(rhs));\r
-}\r
-inline layer_tag operator ^ (layer_tag lhs, layer_tag rhs)\r
-{\r
-       return (layer_tag)(static_cast<int>(lhs) ^ static_cast<int>(rhs));\r
-}\r
+ENUM_ENABLE_BITWISE(layer_tag);\r
+\r
 inline layer_tag operator ~ (layer_tag rhs)\r
 {\r
        return (layer_tag)(static_cast<int>(layer_tag::all) ^ static_cast<int>(rhs));\r
 }\r
 \r
-layer_tag string_to_layer_tags(const std::wstring& str);
-
-}      //namespace psd
-}      //namespace caspar
-
+layer_tag string_to_layer_tags(const std::wstring& str);\r
+\r
+}      //namespace psd\r
+}      //namespace caspar\r
+\r
index bc467299e9e208cdca54fac3f245c4bb2c0ec4e6..57ae0742a163bc6b577af9b2c172a52034198543 100644 (file)
@@ -121,7 +121,6 @@ void psd_document::read_image_resources()
                                                {
 
                                                }
-                                               break;
 
                                        case 1005:
                                                {