From: Niklas P Andersson Date: Wed, 2 Dec 2015 10:08:21 +0000 (+0100) Subject: fixed timeline-annotations in psd-producer that was accidentally broken in 5dcb547 X-Git-Tag: 2.1.0_Beta1~158 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6d14d5db38bc36d3ecb48ea32408d8f16c07c8fb;p=casparcg fixed timeline-annotations in psd-producer that was accidentally broken in 5dcb547 using ENUM_ENABLE_BITWISE for the layer_tag enum --- diff --git a/common/enum_class.h b/common/enum_class.h index fa8225ae8..c1cec94d5 100644 --- a/common/enum_class.h +++ b/common/enum_class.h @@ -19,6 +19,28 @@ { \ lhs = lhs & rhs; \ return lhs; \ + }; \ + static enum_class operator | (enum_class lhs, enum_class rhs) \ + { \ + return static_cast( \ + static_cast::type>(lhs) \ + | static_cast::type>(rhs)); \ + }; \ + 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) \ + { \ + return static_cast( \ + static_cast::type>(lhs) \ + ^ static_cast::type>(rhs)); \ + }; \ + static enum_class& operator^=(enum_class& lhs, enum_class rhs) \ + { \ + lhs = lhs ^ rhs; \ + return lhs; \ }; namespace caspar { diff --git a/modules/psd/misc.h b/modules/psd/misc.h index 8fe8de9cd..955903cbb 100644 --- a/modules/psd/misc.h +++ b/modules/psd/misc.h @@ -1,142 +1,143 @@ -/* -* Copyright (c) 2011 Sveriges Television AB -* -* 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 . -* -* Author: Niklas P Andersson, niklas.p.andersson@svt.se -*/ - -#pragma once - -#include - -#include -#include - -namespace caspar { namespace psd { - -template -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 -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 -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 -struct rect -{ - point location; - psd::size 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); - +/* +* Copyright (c) 2011 Sveriges Television AB +* +* 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 . +* +* Author: Niklas P Andersson, niklas.p.andersson@svt.se +*/ + +#pragma once + +#include +#include + +#include +#include + +namespace caspar { namespace psd { + +template +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 +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 +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 +struct rect +{ + point location; + psd::size 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); + enum class layer_tag : int { none = 0, @@ -147,25 +148,15 @@ enum class layer_tag : int { rasterized = 16, all = 31 }; -inline layer_tag operator | (layer_tag lhs, layer_tag rhs) -{ - return (layer_tag)(static_cast(lhs) | static_cast(rhs)); -} -inline layer_tag operator & (layer_tag lhs, layer_tag rhs) -{ - return (layer_tag)(static_cast(lhs) & static_cast(rhs)); -} -inline layer_tag operator ^ (layer_tag lhs, layer_tag rhs) -{ - return (layer_tag)(static_cast(lhs) ^ static_cast(rhs)); -} +ENUM_ENABLE_BITWISE(layer_tag); + inline layer_tag operator ~ (layer_tag rhs) { return (layer_tag)(static_cast(layer_tag::all) ^ static_cast(rhs)); } -layer_tag string_to_layer_tags(const std::wstring& str); - -} //namespace psd -} //namespace caspar - +layer_tag string_to_layer_tags(const std::wstring& str); + +} //namespace psd +} //namespace caspar + diff --git a/modules/psd/psd_document.cpp b/modules/psd/psd_document.cpp index bc467299e..57ae0742a 100644 --- a/modules/psd/psd_document.cpp +++ b/modules/psd/psd_document.cpp @@ -121,7 +121,6 @@ void psd_document::read_image_resources() { } - break; case 1005: {