Home | History | Annotate | Download | only in fxgraphics
      1 // Copyright 2016 PDFium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
      6 
      7 #include "xfa/fxgraphics/cfx_color.h"
      8 
      9 CFX_Color::CFX_Color() : m_type(FX_COLOR_None) {}
     10 
     11 CFX_Color::CFX_Color(const FX_ARGB argb) {
     12   Set(argb);
     13 }
     14 
     15 CFX_Color::CFX_Color(CFX_Pattern* pattern, const FX_ARGB argb) {
     16   Set(pattern, argb);
     17 }
     18 
     19 CFX_Color::CFX_Color(CFX_Shading* shading) {
     20   Set(shading);
     21 }
     22 
     23 CFX_Color::~CFX_Color() {
     24   m_type = FX_COLOR_None;
     25 }
     26 
     27 void CFX_Color::Set(const FX_ARGB argb) {
     28   m_type = FX_COLOR_Solid;
     29   m_info.argb = argb;
     30   m_info.pattern = nullptr;
     31 }
     32 
     33 void CFX_Color::Set(CFX_Pattern* pattern, const FX_ARGB argb) {
     34   if (!pattern)
     35     return;
     36   m_type = FX_COLOR_Pattern;
     37   m_info.argb = argb;
     38   m_info.pattern = pattern;
     39 }
     40 
     41 void CFX_Color::Set(CFX_Shading* shading) {
     42   if (!shading)
     43     return;
     44   m_type = FX_COLOR_Shading;
     45   m_shading = shading;
     46 }
     47