| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "core/html/canvas/CanvasRenderingContext2DState.h" | 7 #include "core/html/canvas/CanvasRenderingContext2DState.h" |
| 8 | 8 |
| 9 #include "core/css/CSSFontSelector.h" | 9 #include "core/css/CSSFontSelector.h" |
| 10 #include "core/html/canvas/CanvasGradient.h" | 10 #include "core/html/canvas/CanvasGradient.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 { | 397 { |
| 398 SkXfermode* xferMode = m_strokePaint.getXfermode(); | 398 SkXfermode* xferMode = m_strokePaint.getXfermode(); |
| 399 SkXfermode::Mode mode; | 399 SkXfermode::Mode mode; |
| 400 if (!xferMode || !xferMode->asMode(&mode)) | 400 if (!xferMode || !xferMode->asMode(&mode)) |
| 401 return SkXfermode::kSrcOver_Mode; | 401 return SkXfermode::kSrcOver_Mode; |
| 402 return mode; | 402 return mode; |
| 403 } | 403 } |
| 404 | 404 |
| 405 void CanvasRenderingContext2DState::setImageSmoothingEnabled(bool enabled) | 405 void CanvasRenderingContext2DState::setImageSmoothingEnabled(bool enabled) |
| 406 { | 406 { |
| 407 SkFilterQuality filterQuality = enabled ? kLow_SkFilterQuality : kNone_SkFil
terQuality; | 407 SkFilterQuality filterQuality = enabled ? kMedium_SkFilterQuality : kNone_Sk
FilterQuality; |
| 408 m_strokePaint.setFilterQuality(filterQuality); | 408 m_strokePaint.setFilterQuality(filterQuality); |
| 409 m_fillPaint.setFilterQuality(filterQuality); | 409 m_fillPaint.setFilterQuality(filterQuality); |
| 410 m_imagePaint.setFilterQuality(filterQuality); | 410 m_imagePaint.setFilterQuality(filterQuality); |
| 411 } | 411 } |
| 412 | 412 |
| 413 bool CanvasRenderingContext2DState::imageSmoothingEnabled() const | 413 bool CanvasRenderingContext2DState::imageSmoothingEnabled() const |
| 414 { | 414 { |
| 415 return m_imagePaint.getFilterQuality() == kLow_SkFilterQuality; | 415 return m_imagePaint.getFilterQuality() == kMedium_SkFilterQuality; |
| 416 } | 416 } |
| 417 | 417 |
| 418 bool CanvasRenderingContext2DState::shouldDrawShadows() const | 418 bool CanvasRenderingContext2DState::shouldDrawShadows() const |
| 419 { | 419 { |
| 420 return alphaChannel(m_shadowColor) && (m_shadowBlur || !m_shadowOffset.isZer
o()); | 420 return alphaChannel(m_shadowColor) && (m_shadowBlur || !m_shadowOffset.isZer
o()); |
| 421 } | 421 } |
| 422 | 422 |
| 423 const SkPaint* CanvasRenderingContext2DState::getPaint(PaintType paintType, Shad
owMode shadowMode, ImageType imageType) const | 423 const SkPaint* CanvasRenderingContext2DState::getPaint(PaintType paintType, Shad
owMode shadowMode, ImageType imageType) const |
| 424 { | 424 { |
| 425 SkPaint* paint; | 425 SkPaint* paint; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 paint->setLooper(0); | 469 paint->setLooper(0); |
| 470 paint->setImageFilter(shadowAndForegroundImageFilter()); | 470 paint->setImageFilter(shadowAndForegroundImageFilter()); |
| 471 return paint; | 471 return paint; |
| 472 } | 472 } |
| 473 paint->setLooper(shadowAndForegroundDrawLooper()); | 473 paint->setLooper(shadowAndForegroundDrawLooper()); |
| 474 paint->setImageFilter(0); | 474 paint->setImageFilter(0); |
| 475 return paint; | 475 return paint; |
| 476 } | 476 } |
| 477 | 477 |
| 478 } // blink | 478 } // blink |
| OLD | NEW |