OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 28 matching lines...) Expand all Loading... |
39 enum SourceImageStatus { | 39 enum SourceImageStatus { |
40 NormalSourceImageStatus, | 40 NormalSourceImageStatus, |
41 UndecodableSourceImageStatus, // Image element with a 'broken' image | 41 UndecodableSourceImageStatus, // Image element with a 'broken' image |
42 ZeroSizeCanvasSourceImageStatus, // Source is a canvas with width or heigh o
f zero | 42 ZeroSizeCanvasSourceImageStatus, // Source is a canvas with width or heigh o
f zero |
43 IncompleteSourceImageStatus, // Image element with no source media | 43 IncompleteSourceImageStatus, // Image element with no source media |
44 InvalidSourceImageStatus, | 44 InvalidSourceImageStatus, |
45 }; | 45 }; |
46 | 46 |
47 class CORE_EXPORT CanvasImageSource { | 47 class CORE_EXPORT CanvasImageSource { |
48 public: | 48 public: |
49 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, Accele
rationHint, SnapshotReason) const = 0; | 49 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, Accele
rationHint, SnapshotReason, const FloatSize&) const = 0; |
50 | 50 |
51 // IMPORTANT: Result must be independent of whether destinationContext is | 51 // IMPORTANT: Result must be independent of whether destinationContext is |
52 // already tainted because this function may be used to determine whether | 52 // already tainted because this function may be used to determine whether |
53 // a CanvasPattern is "origin clean", and that pattern may be used on | 53 // a CanvasPattern is "origin clean", and that pattern may be used on |
54 // another canvas, which may not be already tainted. | 54 // another canvas, which may not be already tainted. |
55 virtual bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) con
st = 0; | 55 virtual bool wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigin) con
st = 0; |
56 | 56 |
57 virtual bool isVideoElement() const { return false; } | 57 virtual bool isVideoElement() const { return false; } |
58 virtual bool isCanvasElement() const { return false; } | 58 virtual bool isCanvasElement() const { return false; } |
59 virtual bool isSVGSource() const { return false; } | 59 virtual bool isSVGSource() const { return false; } |
60 | 60 |
61 // Adjusts the source and destination rectangles for cases where the actual | 61 // Adjusts the source and destination rectangles for cases where the actual |
62 // source image is a subregion of the image returned by getSourceImageForCan
vas. | 62 // source image is a subregion of the image returned by getSourceImageForCan
vas. |
63 virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const {
} | 63 virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const {
} |
64 | 64 |
65 virtual FloatSize elementSize() const = 0; | 65 virtual FloatSize elementSize(const FloatSize& defaultObjectSize) const = 0; |
66 virtual FloatSize defaultDestinationSize() const { return elementSize(); } | 66 virtual FloatSize defaultDestinationSize(const FloatSize& defaultObjectSize)
const { return elementSize(defaultObjectSize); } |
67 virtual const KURL& sourceURL() const { return blankURL(); } | 67 virtual const KURL& sourceURL() const { return blankURL(); } |
68 virtual bool isOpaque() const { return false; } | 68 virtual bool isOpaque() const { return false; } |
69 | 69 |
70 protected: | 70 protected: |
71 virtual ~CanvasImageSource() { } | 71 virtual ~CanvasImageSource() { } |
72 }; | 72 }; |
73 | 73 |
74 } // namespace blink | 74 } // namespace blink |
75 | 75 |
76 #endif | 76 #endif |
OLD | NEW |