| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
| 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 10 * | 10 * |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if (c) | 103 if (c) |
| 104 c->restoreToCount(m_saveCount); | 104 c->restoreToCount(m_saveCount); |
| 105 m_context->validateStateStack(); | 105 m_context->validateStateStack(); |
| 106 } | 106 } |
| 107 private: | 107 private: |
| 108 Member<CanvasRenderingContext2D> m_context; | 108 Member<CanvasRenderingContext2D> m_context; |
| 109 int m_saveCount; | 109 int m_saveCount; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co
nst CanvasContextCreationAttributes& attrs, Document& document) | 112 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co
nst CanvasContextCreationAttributes& attrs, Document& document) |
| 113 : CanvasRenderingContext(canvas) | 113 : CanvasRenderingContext(canvas, nullptr, attrs) |
| 114 , m_hasAlpha(attrs.alpha()) | |
| 115 , m_contextLostMode(NotLostContext) | 114 , m_contextLostMode(NotLostContext) |
| 116 , m_contextRestorable(true) | 115 , m_contextRestorable(true) |
| 117 , m_tryRestoreContextAttemptCount(0) | 116 , m_tryRestoreContextAttemptCount(0) |
| 118 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC
ontextLostEvent) | 117 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC
ontextLostEvent) |
| 119 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa
tchContextRestoredEvent) | 118 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa
tchContextRestoredEvent) |
| 120 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC
ontextEvent) | 119 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC
ontextEvent) |
| 121 , m_pruneLocalFontCacheScheduled(false) | 120 , m_pruneLocalFontCacheScheduled(false) |
| 122 { | 121 { |
| 123 if (document.settings() && document.settings()->antialiasedClips2dCanvasEnab
led()) | 122 if (document.settings() && document.settings()->antialiasedClips2dCanvasEnab
led()) |
| 124 m_clipAntialiasing = AntiAliased; | 123 m_clipAntialiasing = AntiAliased; |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 SkCanvas* c = drawingCanvas(); | 777 SkCanvas* c = drawingCanvas(); |
| 779 if (!c) | 778 if (!c) |
| 780 return; | 779 return; |
| 781 | 780 |
| 782 if (!std::isfinite(x) || !std::isfinite(y)) | 781 if (!std::isfinite(x) || !std::isfinite(y)) |
| 783 return; | 782 return; |
| 784 if (maxWidth && (!std::isfinite(*maxWidth) || *maxWidth <= 0)) | 783 if (maxWidth && (!std::isfinite(*maxWidth) || *maxWidth <= 0)) |
| 785 return; | 784 return; |
| 786 | 785 |
| 787 // Currently, SkPictureImageFilter does not support subpixel text anti-alias
ing, which | 786 // Currently, SkPictureImageFilter does not support subpixel text anti-alias
ing, which |
| 788 // is expected when !m_hasAlpha, so we need to fall out of display list mode
when | 787 // is expected when !creationAttributes().alpha(), so we need to fall out of
display |
| 789 // drawing text to an opaque canvas | 788 // list mode when drawing text to an opaque canvas. |
| 790 // crbug.com/583809 | 789 // crbug.com/583809 |
| 791 if (!m_hasAlpha && !isAccelerated()) | 790 if (!creationAttributes().alpha() && !isAccelerated()) |
| 792 canvas()->disableDeferral(DisableDeferralReasonSubPixelTextAntiAliasingS
upport); | 791 canvas()->disableDeferral(DisableDeferralReasonSubPixelTextAntiAliasingS
upport); |
| 793 | 792 |
| 794 const Font& font = accessFont(); | 793 const Font& font = accessFont(); |
| 795 if (!font.primaryFont()) | 794 if (!font.primaryFont()) |
| 796 return; | 795 return; |
| 797 | 796 |
| 798 const FontMetrics& fontMetrics = font.getFontMetrics(); | 797 const FontMetrics& fontMetrics = font.getFontMetrics(); |
| 799 | 798 |
| 800 // FIXME: Need to turn off font smoothing. | 799 // FIXME: Need to turn off font smoothing. |
| 801 | 800 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 return state().isTransformInvertible(); | 903 return state().isTransformInvertible(); |
| 905 } | 904 } |
| 906 | 905 |
| 907 WebLayer* CanvasRenderingContext2D::platformLayer() const | 906 WebLayer* CanvasRenderingContext2D::platformLayer() const |
| 908 { | 907 { |
| 909 return canvas()->buffer() ? canvas()->buffer()->platformLayer() : 0; | 908 return canvas()->buffer() ? canvas()->buffer()->platformLayer() : 0; |
| 910 } | 909 } |
| 911 | 910 |
| 912 void CanvasRenderingContext2D::getContextAttributes(Canvas2DContextAttributes& a
ttrs) const | 911 void CanvasRenderingContext2D::getContextAttributes(Canvas2DContextAttributes& a
ttrs) const |
| 913 { | 912 { |
| 914 attrs.setAlpha(m_hasAlpha); | 913 attrs.setAlpha(creationAttributes().alpha()); |
| 914 attrs.setColorSpace(colorSpaceAsString()); |
| 915 } | 915 } |
| 916 | 916 |
| 917 void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element) | 917 void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element) |
| 918 { | 918 { |
| 919 drawFocusIfNeededInternal(m_path, element); | 919 drawFocusIfNeededInternal(m_path, element); |
| 920 } | 920 } |
| 921 | 921 |
| 922 void CanvasRenderingContext2D::drawFocusIfNeeded(Path2D* path2d, Element* elemen
t) | 922 void CanvasRenderingContext2D::drawFocusIfNeeded(Path2D* path2d, Element* elemen
t) |
| 923 { | 923 { |
| 924 drawFocusIfNeededInternal(path2d->path(), element); | 924 drawFocusIfNeededInternal(path2d->path(), element); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 return true; | 1090 return true; |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 void CanvasRenderingContext2D::resetUsageTracking() | 1093 void CanvasRenderingContext2D::resetUsageTracking() |
| 1094 { | 1094 { |
| 1095 UsageCounters newCounters; | 1095 UsageCounters newCounters; |
| 1096 m_usageCounters = newCounters; | 1096 m_usageCounters = newCounters; |
| 1097 } | 1097 } |
| 1098 | 1098 |
| 1099 } // namespace blink | 1099 } // namespace blink |
| OLD | NEW |