| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/canvas2d/CanvasRenderingContext2DState.h" | 5 #include "modules/canvas2d/CanvasRenderingContext2DState.h" |
| 6 | 6 |
| 7 #include "core/css/CSSFontSelector.h" | 7 #include "core/css/CSSFontSelector.h" |
| 8 #include "core/css/resolver/FilterOperationResolver.h" | 8 #include "core/css/resolver/FilterOperationResolver.h" |
| 9 #include "core/css/resolver/StyleBuilder.h" | 9 #include "core/css/resolver/StyleBuilder.h" |
| 10 #include "core/css/resolver/StyleResolverState.h" | 10 #include "core/css/resolver/StyleResolverState.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 , m_fillStyleDirty(other.m_fillStyleDirty) | 100 , m_fillStyleDirty(other.m_fillStyleDirty) |
| 101 , m_strokeStyleDirty(other.m_strokeStyleDirty) | 101 , m_strokeStyleDirty(other.m_strokeStyleDirty) |
| 102 , m_lineDashDirty(other.m_lineDashDirty) | 102 , m_lineDashDirty(other.m_lineDashDirty) |
| 103 , m_imageSmoothingEnabled(other.m_imageSmoothingEnabled) | 103 , m_imageSmoothingEnabled(other.m_imageSmoothingEnabled) |
| 104 , m_imageSmoothingQuality(other.m_imageSmoothingQuality) | 104 , m_imageSmoothingQuality(other.m_imageSmoothingQuality) |
| 105 { | 105 { |
| 106 if (mode == CopyClipList) { | 106 if (mode == CopyClipList) { |
| 107 m_clipList = other.m_clipList; | 107 m_clipList = other.m_clipList; |
| 108 } | 108 } |
| 109 if (m_realizedFont) | 109 if (m_realizedFont) |
| 110 static_cast<CSSFontSelector*>(m_font.fontSelector())->registerForInvalid
ationCallbacks(this); | 110 static_cast<CSSFontSelector*>(m_font.getFontSelector())->registerForInva
lidationCallbacks(this); |
| 111 } | 111 } |
| 112 | 112 |
| 113 CanvasRenderingContext2DState::~CanvasRenderingContext2DState() | 113 CanvasRenderingContext2DState::~CanvasRenderingContext2DState() |
| 114 { | 114 { |
| 115 #if !ENABLE(OILPAN) | 115 #if !ENABLE(OILPAN) |
| 116 if (m_realizedFont) | 116 if (m_realizedFont) |
| 117 static_cast<CSSFontSelector*>(m_font.fontSelector())->unregisterForInval
idationCallbacks(this); | 117 static_cast<CSSFontSelector*>(m_font.getFontSelector())->unregisterForIn
validationCallbacks(this); |
| 118 #endif | 118 #endif |
| 119 } | 119 } |
| 120 | 120 |
| 121 void CanvasRenderingContext2DState::fontsNeedUpdate(CSSFontSelector* fontSelecto
r) | 121 void CanvasRenderingContext2DState::fontsNeedUpdate(CSSFontSelector* fontSelecto
r) |
| 122 { | 122 { |
| 123 ASSERT_ARG(fontSelector, fontSelector == m_font.fontSelector()); | 123 ASSERT_ARG(fontSelector, fontSelector == m_font.getFontSelector()); |
| 124 ASSERT(m_realizedFont); | 124 ASSERT(m_realizedFont); |
| 125 | 125 |
| 126 m_font.update(fontSelector); | 126 m_font.update(fontSelector); |
| 127 // FIXME: We only really need to invalidate the resolved filter if the font | 127 // FIXME: We only really need to invalidate the resolved filter if the font |
| 128 // update above changed anything and the filter uses font-dependent units. | 128 // update above changed anything and the filter uses font-dependent units. |
| 129 m_resolvedFilter.clear(); | 129 m_resolvedFilter.clear(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 DEFINE_TRACE(CanvasRenderingContext2DState) | 132 DEFINE_TRACE(CanvasRenderingContext2DState) |
| 133 { | 133 { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 m_clipList.clipPath(path, antiAliasingMode, affineTransformToSkMatrix(m_tran
sform)); | 257 m_clipList.clipPath(path, antiAliasingMode, affineTransformToSkMatrix(m_tran
sform)); |
| 258 m_hasClip = true; | 258 m_hasClip = true; |
| 259 if (!path.isRect(0)) | 259 if (!path.isRect(0)) |
| 260 m_hasComplexClip = true; | 260 m_hasComplexClip = true; |
| 261 } | 261 } |
| 262 | 262 |
| 263 void CanvasRenderingContext2DState::setFont(const Font& font, CSSFontSelector* s
elector) | 263 void CanvasRenderingContext2DState::setFont(const Font& font, CSSFontSelector* s
elector) |
| 264 { | 264 { |
| 265 #if !ENABLE(OILPAN) | 265 #if !ENABLE(OILPAN) |
| 266 if (m_realizedFont) | 266 if (m_realizedFont) |
| 267 static_cast<CSSFontSelector*>(m_font.fontSelector())->unregisterForInval
idationCallbacks(this); | 267 static_cast<CSSFontSelector*>(m_font.getFontSelector())->unregisterForIn
validationCallbacks(this); |
| 268 #endif | 268 #endif |
| 269 m_font = font; | 269 m_font = font; |
| 270 m_font.update(selector); | 270 m_font.update(selector); |
| 271 m_realizedFont = true; | 271 m_realizedFont = true; |
| 272 selector->registerForInvalidationCallbacks(this); | 272 selector->registerForInvalidationCallbacks(this); |
| 273 // FIXME: We only really need to invalidate the resolved filter if it | 273 // FIXME: We only really need to invalidate the resolved filter if it |
| 274 // uses font-relative units. | 274 // uses font-relative units. |
| 275 m_resolvedFilter.clear(); | 275 m_resolvedFilter.clear(); |
| 276 } | 276 } |
| 277 | 277 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 paint->setLooper(0); | 563 paint->setLooper(0); |
| 564 paint->setImageFilter(shadowAndForegroundImageFilter()); | 564 paint->setImageFilter(shadowAndForegroundImageFilter()); |
| 565 return paint; | 565 return paint; |
| 566 } | 566 } |
| 567 paint->setLooper(shadowAndForegroundDrawLooper()); | 567 paint->setLooper(shadowAndForegroundDrawLooper()); |
| 568 paint->setImageFilter(0); | 568 paint->setImageFilter(0); |
| 569 return paint; | 569 return paint; |
| 570 } | 570 } |
| 571 | 571 |
| 572 } // namespace blink | 572 } // namespace blink |
| OLD | NEW |