OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2008-2009 Torch Mobile, Inc. |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 enum AccessMode { | 68 enum AccessMode { |
69 ReadOnly, | 69 ReadOnly, |
70 ReadWrite | 70 ReadWrite |
71 }; | 71 }; |
72 | 72 |
73 enum DisabledMode { | 73 enum DisabledMode { |
74 NothingDisabled = 0, // Run as normal. | 74 NothingDisabled = 0, // Run as normal. |
75 FullyDisabled = 1 // Do absolutely minimal work to remove the cost of th
e context from performance tests. | 75 FullyDisabled = 1 // Do absolutely minimal work to remove the cost of th
e context from performance tests. |
76 }; | 76 }; |
77 | 77 |
| 78 // Create a context using an existing canvas. |
78 explicit GraphicsContext(SkCanvas*, DisabledMode = NothingDisabled); | 79 explicit GraphicsContext(SkCanvas*, DisabledMode = NothingDisabled); |
| 80 |
| 81 // Create a context with a recording canvas of the given size, and beginReco
rding on it. |
| 82 explicit GraphicsContext(const FloatRect&, DisabledMode = NothingDisabled); |
| 83 |
79 ~GraphicsContext(); | 84 ~GraphicsContext(); |
80 | 85 |
81 // Returns the canvas used for painting. Must not be called if painting is d
isabled. | 86 // Returns the canvas used for painting. Must not be called if painting is d
isabled. |
82 // Accessing the backing canvas this way flushes all queued save ops, | 87 // Accessing the backing canvas this way flushes all queued save ops, |
83 // so it should be avoided. Use the corresponding draw/matrix/clip methods i
nstead. | 88 // so it should be avoided. Use the corresponding draw/matrix/clip methods i
nstead. |
84 SkCanvas* canvas() | 89 SkCanvas* canvas() |
85 { | 90 { |
86 // Flush any pending saves. | 91 // Flush any pending saves. |
87 realizeCanvasSave(); | 92 realizeCanvasSave(); |
88 | 93 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 423 |
419 private: | 424 private: |
420 const GraphicsContextState* immutableState() const { return m_paintState; } | 425 const GraphicsContextState* immutableState() const { return m_paintState; } |
421 | 426 |
422 GraphicsContextState* mutableState() | 427 GraphicsContextState* mutableState() |
423 { | 428 { |
424 realizePaintSave(); | 429 realizePaintSave(); |
425 return m_paintState; | 430 return m_paintState; |
426 } | 431 } |
427 | 432 |
| 433 void initializeStateStack(); |
| 434 |
| 435 void beginRecordingImpl(PassRefPtr<DisplayList>, uint32_t, SkCanvas*, SkMatr
ix&); |
| 436 |
428 static void setPathFromConvexPoints(SkPath*, size_t, const FloatPoint*); | 437 static void setPathFromConvexPoints(SkPath*, size_t, const FloatPoint*); |
429 static void setRadii(SkVector*, IntSize, IntSize, IntSize, IntSize); | 438 static void setRadii(SkVector*, IntSize, IntSize, IntSize, IntSize); |
430 | 439 |
431 static PassRefPtr<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFi
lter); | 440 static PassRefPtr<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFi
lter); |
432 | 441 |
433 #if OS(MACOSX) | 442 #if OS(MACOSX) |
434 static inline int focusRingOutset(int offset) { return offset + 2; } | 443 static inline int focusRingOutset(int offset) { return offset + 2; } |
435 static inline int focusRingWidth(int width) { return width; } | 444 static inline int focusRingWidth(int width) { return width; } |
436 #else | 445 #else |
437 static inline int focusRingOutset(int offset) { return 0; } | 446 static inline int focusRingOutset(int offset) { return 0; } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 bool m_accelerated : 1; | 545 bool m_accelerated : 1; |
537 bool m_isCertainlyOpaque : 1; | 546 bool m_isCertainlyOpaque : 1; |
538 bool m_printing : 1; | 547 bool m_printing : 1; |
539 bool m_antialiasHairlineImages : 1; | 548 bool m_antialiasHairlineImages : 1; |
540 bool m_shouldSmoothFonts : 1; | 549 bool m_shouldSmoothFonts : 1; |
541 }; | 550 }; |
542 | 551 |
543 } // namespace blink | 552 } // namespace blink |
544 | 553 |
545 #endif // GraphicsContext_h | 554 #endif // GraphicsContext_h |
OLD | NEW |