OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 void setClient(ImageBufferClient* client) { m_client = client; } | 76 void setClient(ImageBufferClient* client) { m_client = client; } |
77 | 77 |
78 const IntSize& size() const { return m_surface->size(); } | 78 const IntSize& size() const { return m_surface->size(); } |
79 bool isAccelerated() const { return m_surface->isAccelerated(); } | 79 bool isAccelerated() const { return m_surface->isAccelerated(); } |
80 bool isRecording() const { return m_surface->isRecording(); } | 80 bool isRecording() const { return m_surface->isRecording(); } |
81 void setHasExpensiveOp() { m_surface->setHasExpensiveOp(); } | 81 void setHasExpensiveOp() { m_surface->setHasExpensiveOp(); } |
82 bool isExpensiveToPaint() const { return m_surface->isExpensiveToPaint(); } | 82 bool isExpensiveToPaint() const { return m_surface->isExpensiveToPaint(); } |
83 bool isSurfaceValid() const; | 83 bool isSurfaceValid() const; |
84 bool restoreSurface() const; | 84 bool restoreSurface() const; |
85 void didDraw(const FloatRect& rect) const { m_surface->didDraw(rect); } | 85 void didDraw(const FloatRect&) const; |
| 86 bool wasDrawnToAfterSnapshot() const { return m_snapshotState == DrawnToAfte
rSnapshot; } |
86 | 87 |
87 void setFilterQuality(SkFilterQuality filterQuality) { m_surface->setFilterQ
uality(filterQuality); } | 88 void setFilterQuality(SkFilterQuality filterQuality) { m_surface->setFilterQ
uality(filterQuality); } |
88 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } | 89 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } |
89 | 90 |
90 // Called by subclasses of ImageBufferSurface to install a new canvas object | 91 // Called by subclasses of ImageBufferSurface to install a new canvas object |
91 void resetCanvas(SkCanvas*) const; | 92 void resetCanvas(SkCanvas*) const; |
92 | 93 |
93 SkCanvas* canvas() const; | 94 SkCanvas* canvas() const; |
94 void disableDeferral() const; | 95 void disableDeferral() const; |
95 | 96 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 PassRefPtr<Image> newImageSnapshot() const; | 132 PassRefPtr<Image> newImageSnapshot() const; |
132 | 133 |
133 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } | 134 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi
s); } |
134 String debugName() const { return "ImageBuffer"; } | 135 String debugName() const { return "ImageBuffer"; } |
135 | 136 |
136 void draw(GraphicsContext*, const FloatRect&, const FloatRect*, SkXfermode::
Mode); | 137 void draw(GraphicsContext*, const FloatRect&, const FloatRect*, SkXfermode::
Mode); |
137 | 138 |
138 private: | 139 private: |
139 ImageBuffer(PassOwnPtr<ImageBufferSurface>); | 140 ImageBuffer(PassOwnPtr<ImageBufferSurface>); |
140 | 141 |
| 142 enum SnapshotState { |
| 143 InitialSnapshotState, |
| 144 DidAcquireSnapshot, |
| 145 DrawnToAfterSnapshot, |
| 146 }; |
| 147 mutable SnapshotState m_snapshotState; |
141 OwnPtr<ImageBufferSurface> m_surface; | 148 OwnPtr<ImageBufferSurface> m_surface; |
142 ImageBufferClient* m_client; | 149 ImageBufferClient* m_client; |
143 }; | 150 }; |
144 | 151 |
145 struct ImageDataBuffer { | 152 struct ImageDataBuffer { |
146 ImageDataBuffer(const IntSize& size, unsigned char* data) : m_data(data), m_
size(size) { } | 153 ImageDataBuffer(const IntSize& size, unsigned char* data) : m_data(data), m_
size(size) { } |
147 String PLATFORM_EXPORT toDataURL(const String& mimeType, const double* quali
ty) const; | 154 String PLATFORM_EXPORT toDataURL(const String& mimeType, const double* quali
ty) const; |
148 unsigned char* pixels() const { return m_data; } | 155 unsigned char* pixels() const { return m_data; } |
149 int height() const { return m_size.height(); } | 156 int height() const { return m_size.height(); } |
150 int width() const { return m_size.width(); } | 157 int width() const { return m_size.width(); } |
151 unsigned char* m_data; | 158 unsigned char* m_data; |
152 IntSize m_size; | 159 IntSize m_size; |
153 }; | 160 }; |
154 | 161 |
155 } // namespace blink | 162 } // namespace blink |
156 | 163 |
157 #endif // ImageBuffer_h | 164 #endif // ImageBuffer_h |
OLD | NEW |