| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2
D canvas and the existing | 52 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2
D canvas and the existing |
| 53 // context is already 2D, just return that. If the existing context is WebGL
, then destroy it | 53 // context is already 2D, just return that. If the existing context is WebGL
, then destroy it |
| 54 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a | 54 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a |
| 55 // context with any other type string will destroy any existing context. | 55 // context with any other type string will destroy any existing context. |
| 56 enum ContextType { | 56 enum ContextType { |
| 57 // Do not change assigned numbers of existing items: add new features to
the end of the list. | 57 // Do not change assigned numbers of existing items: add new features to
the end of the list. |
| 58 Context2d = 0, | 58 Context2d = 0, |
| 59 ContextExperimentalWebgl = 2, | 59 ContextExperimentalWebgl = 2, |
| 60 ContextWebgl = 3, | 60 ContextWebgl = 3, |
| 61 ContextWebgl2 = 4, | 61 ContextWebgl2 = 4, |
| 62 ContextImageBitmap = 5, |
| 62 ContextTypeCount, | 63 ContextTypeCount, |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 static ContextType contextTypeFromId(const String& id); | 66 static ContextType contextTypeFromId(const String& id); |
| 66 static ContextType resolveContextTypeAliases(ContextType); | 67 static ContextType resolveContextTypeAliases(ContextType); |
| 67 | 68 |
| 68 #if !ENABLE(OILPAN) | 69 #if !ENABLE(OILPAN) |
| 69 void ref() { m_canvas->ref(); } | 70 void ref() { m_canvas->ref(); } |
| 70 void deref() { m_canvas->deref(); } | 71 void deref() { m_canvas->deref(); } |
| 71 #endif | 72 #endif |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 virtual void styleDidChange(const ComputedStyle* oldStyle, const ComputedSty
le& newStyle) { } | 110 virtual void styleDidChange(const ComputedStyle* oldStyle, const ComputedSty
le& newStyle) { } |
| 110 | 111 |
| 111 // WebGL-specific interface | 112 // WebGL-specific interface |
| 112 virtual bool is3d() const { return false; } | 113 virtual bool is3d() const { return false; } |
| 113 virtual void setFilterQuality(SkFilterQuality) { ASSERT_NOT_REACHED(); } | 114 virtual void setFilterQuality(SkFilterQuality) { ASSERT_NOT_REACHED(); } |
| 114 virtual void reshape(int width, int height) { ASSERT_NOT_REACHED(); } | 115 virtual void reshape(int width, int height) { ASSERT_NOT_REACHED(); } |
| 115 virtual void markLayerComposited() { ASSERT_NOT_REACHED(); } | 116 virtual void markLayerComposited() { ASSERT_NOT_REACHED(); } |
| 116 virtual ImageData* paintRenderingResultsToImageData(SourceDrawingBuffer) { A
SSERT_NOT_REACHED(); return nullptr; } | 117 virtual ImageData* paintRenderingResultsToImageData(SourceDrawingBuffer) { A
SSERT_NOT_REACHED(); return nullptr; } |
| 117 virtual int externallyAllocatedBytesPerPixel() { ASSERT_NOT_REACHED(); retur
n 0; } | 118 virtual int externallyAllocatedBytesPerPixel() { ASSERT_NOT_REACHED(); retur
n 0; } |
| 118 | 119 |
| 120 // ImageBitmap-specific interface |
| 121 virtual bool paint(GraphicsContext&, const IntRect&) { return false; } |
| 122 |
| 119 bool wouldTaintOrigin(CanvasImageSource*); | 123 bool wouldTaintOrigin(CanvasImageSource*); |
| 120 void didMoveToNewDocument(Document*); | 124 void didMoveToNewDocument(Document*); |
| 121 | 125 |
| 122 protected: | 126 protected: |
| 123 CanvasRenderingContext(HTMLCanvasElement*); | 127 CanvasRenderingContext(HTMLCanvasElement*); |
| 124 DECLARE_VIRTUAL_TRACE(); | 128 DECLARE_VIRTUAL_TRACE(); |
| 125 | 129 |
| 126 virtual void stop() = 0; | 130 virtual void stop() = 0; |
| 127 | 131 |
| 128 private: | 132 private: |
| 129 RawPtrWillBeMember<HTMLCanvasElement> m_canvas; | 133 RawPtrWillBeMember<HTMLCanvasElement> m_canvas; |
| 130 HashSet<String> m_cleanURLs; | 134 HashSet<String> m_cleanURLs; |
| 131 HashSet<String> m_dirtyURLs; | 135 HashSet<String> m_dirtyURLs; |
| 132 }; | 136 }; |
| 133 | 137 |
| 134 } // namespace blink | 138 } // namespace blink |
| 135 | 139 |
| 136 #endif | 140 #endif |
| OLD | NEW |