| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 CanvasStyle::CanvasStyle(RGBA32 rgba) : type_(kColorRGBA), rgba_(rgba) {} | 93 CanvasStyle::CanvasStyle(RGBA32 rgba) : type_(kColorRGBA), rgba_(rgba) {} |
| 94 | 94 |
| 95 CanvasStyle::CanvasStyle(CanvasGradient* gradient) | 95 CanvasStyle::CanvasStyle(CanvasGradient* gradient) |
| 96 : type_(kGradient), gradient_(gradient) {} | 96 : type_(kGradient), gradient_(gradient) {} |
| 97 | 97 |
| 98 CanvasStyle::CanvasStyle(CanvasPattern* pattern) | 98 CanvasStyle::CanvasStyle(CanvasPattern* pattern) |
| 99 : type_(kImagePattern), pattern_(pattern) {} | 99 : type_(kImagePattern), pattern_(pattern) {} |
| 100 | 100 |
| 101 CanvasStyle* CanvasStyle::CreateFromGradient(CanvasGradient* gradient) { | 101 CanvasStyle* CanvasStyle::CreateFromGradient(CanvasGradient* gradient) { |
| 102 ASSERT(gradient); | 102 DCHECK(gradient); |
| 103 return new CanvasStyle(gradient); | 103 return new CanvasStyle(gradient); |
| 104 } | 104 } |
| 105 | 105 |
| 106 CanvasStyle* CanvasStyle::CreateFromPattern(CanvasPattern* pattern) { | 106 CanvasStyle* CanvasStyle::CreateFromPattern(CanvasPattern* pattern) { |
| 107 ASSERT(pattern); | 107 DCHECK(pattern); |
| 108 return new CanvasStyle(pattern); | 108 return new CanvasStyle(pattern); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void CanvasStyle::ApplyToFlags(PaintFlags& flags) const { | 111 void CanvasStyle::ApplyToFlags(PaintFlags& flags) const { |
| 112 switch (type_) { | 112 switch (type_) { |
| 113 case kColorRGBA: | 113 case kColorRGBA: |
| 114 flags.setShader(nullptr); | 114 flags.setShader(nullptr); |
| 115 break; | 115 break; |
| 116 case kGradient: | 116 case kGradient: |
| 117 GetCanvasGradient()->GetGradient()->ApplyToFlags(flags, SkMatrix::I()); | 117 GetCanvasGradient()->GetGradient()->ApplyToFlags(flags, SkMatrix::I()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 131 ASSERT(type_ == kGradient || type_ == kImagePattern); | 131 ASSERT(type_ == kGradient || type_ == kImagePattern); |
| 132 return Color::kBlack; | 132 return Color::kBlack; |
| 133 } | 133 } |
| 134 | 134 |
| 135 DEFINE_TRACE(CanvasStyle) { | 135 DEFINE_TRACE(CanvasStyle) { |
| 136 visitor->Trace(gradient_); | 136 visitor->Trace(gradient_); |
| 137 visitor->Trace(pattern_); | 137 visitor->Trace(pattern_); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |