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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #include "platform/geometry/FloatQuad.h" | 62 #include "platform/geometry/FloatQuad.h" |
63 #include "platform/graphics/DrawLooperBuilder.h" | 63 #include "platform/graphics/DrawLooperBuilder.h" |
64 #include "platform/graphics/GraphicsContextStateSaver.h" | 64 #include "platform/graphics/GraphicsContextStateSaver.h" |
65 #include "platform/text/TextRun.h" | 65 #include "platform/text/TextRun.h" |
66 #include "wtf/CheckedArithmetic.h" | 66 #include "wtf/CheckedArithmetic.h" |
67 #include "wtf/MathExtras.h" | 67 #include "wtf/MathExtras.h" |
68 #include "wtf/OwnPtr.h" | 68 #include "wtf/OwnPtr.h" |
69 #include "wtf/Uint8ClampedArray.h" | 69 #include "wtf/Uint8ClampedArray.h" |
70 #include "wtf/text/StringBuilder.h" | 70 #include "wtf/text/StringBuilder.h" |
71 | 71 |
72 using namespace std; | |
73 | |
74 namespace WebCore { | 72 namespace WebCore { |
75 | 73 |
76 static const int defaultFontSize = 10; | 74 static const int defaultFontSize = 10; |
77 static const char defaultFontFamily[] = "sans-serif"; | 75 static const char defaultFontFamily[] = "sans-serif"; |
78 static const char defaultFont[] = "10px sans-serif"; | 76 static const char defaultFont[] = "10px sans-serif"; |
79 static const double TryRestoreContextInterval = 0.5; | 77 static const double TryRestoreContextInterval = 0.5; |
80 static const unsigned MaxTryRestoreContextAttempts = 4; | 78 static const unsigned MaxTryRestoreContextAttempts = 4; |
81 | 79 |
82 static bool contextLostRestoredEventsEnabled() | 80 static bool contextLostRestoredEventsEnabled() |
83 { | 81 { |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 } | 1406 } |
1409 } | 1407 } |
1410 | 1408 |
1411 bool CanvasRenderingContext2D::shouldDrawShadows() const | 1409 bool CanvasRenderingContext2D::shouldDrawShadows() const |
1412 { | 1410 { |
1413 return alphaChannel(state().m_shadowColor) && (state().m_shadowBlur || !stat
e().m_shadowOffset.isZero()); | 1411 return alphaChannel(state().m_shadowColor) && (state().m_shadowBlur || !stat
e().m_shadowOffset.isZero()); |
1414 } | 1412 } |
1415 | 1413 |
1416 static inline FloatRect normalizeRect(const FloatRect& rect) | 1414 static inline FloatRect normalizeRect(const FloatRect& rect) |
1417 { | 1415 { |
1418 return FloatRect(min(rect.x(), rect.maxX()), | 1416 return FloatRect(std::min(rect.x(), rect.maxX()), |
1419 min(rect.y(), rect.maxY()), | 1417 std::min(rect.y(), rect.maxY()), |
1420 max(rect.width(), -rect.width()), | 1418 std::max(rect.width(), -rect.width()), |
1421 max(rect.height(), -rect.height())); | 1419 std::max(rect.height(), -rect.height())); |
1422 } | 1420 } |
1423 | 1421 |
1424 static inline void clipRectsToImageRect(const FloatRect& imageRect, FloatRect* s
rcRect, FloatRect* dstRect) | 1422 static inline void clipRectsToImageRect(const FloatRect& imageRect, FloatRect* s
rcRect, FloatRect* dstRect) |
1425 { | 1423 { |
1426 if (imageRect.contains(*srcRect)) | 1424 if (imageRect.contains(*srcRect)) |
1427 return; | 1425 return; |
1428 | 1426 |
1429 // Compute the src to dst transform | 1427 // Compute the src to dst transform |
1430 FloatSize scale(dstRect->size().width() / srcRect->size().width(), dstRect->
size().height() / srcRect->size().height()); | 1428 FloatSize scale(dstRect->size().width() / srcRect->size().width(), dstRect->
size().height() / srcRect->size().height()); |
1431 FloatPoint scaledSrcLocation = srcRect->location(); | 1429 FloatPoint scaledSrcLocation = srcRect->location(); |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2353 c->setAlphaAsFloat(1.0); | 2351 c->setAlphaAsFloat(1.0); |
2354 c->clearShadow(); | 2352 c->clearShadow(); |
2355 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); | 2353 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); |
2356 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); | 2354 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); |
2357 c->restore(); | 2355 c->restore(); |
2358 validateStateStack(); | 2356 validateStateStack(); |
2359 didDraw(dirtyRect); | 2357 didDraw(dirtyRect); |
2360 } | 2358 } |
2361 | 2359 |
2362 } // namespace WebCore | 2360 } // namespace WebCore |
OLD | NEW |