| 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 17 matching lines...) Expand all Loading... |
| 28 #ifndef ImageBuffer_h | 28 #ifndef ImageBuffer_h |
| 29 #define ImageBuffer_h | 29 #define ImageBuffer_h |
| 30 | 30 |
| 31 #include "platform/PlatformExport.h" | 31 #include "platform/PlatformExport.h" |
| 32 #include "platform/geometry/FloatRect.h" | 32 #include "platform/geometry/FloatRect.h" |
| 33 #include "platform/geometry/IntSize.h" | 33 #include "platform/geometry/IntSize.h" |
| 34 #include "platform/graphics/Canvas2DLayerBridge.h" | 34 #include "platform/graphics/Canvas2DLayerBridge.h" |
| 35 #include "platform/graphics/GraphicsTypes.h" | 35 #include "platform/graphics/GraphicsTypes.h" |
| 36 #include "platform/graphics/GraphicsTypes3D.h" | 36 #include "platform/graphics/GraphicsTypes3D.h" |
| 37 #include "platform/graphics/ImageBufferSurface.h" | 37 #include "platform/graphics/ImageBufferSurface.h" |
| 38 #include "platform/graphics/paint/PaintFlags.h" |
| 39 #include "platform/graphics/paint/PaintRecord.h" |
| 38 #include "platform/transforms/AffineTransform.h" | 40 #include "platform/transforms/AffineTransform.h" |
| 39 #include "third_party/skia/include/core/SkPaint.h" | |
| 40 #include "third_party/skia/include/core/SkPicture.h" | |
| 41 #include "third_party/skia/include/core/SkRefCnt.h" | 41 #include "third_party/skia/include/core/SkRefCnt.h" |
| 42 #include "wtf/Forward.h" | 42 #include "wtf/Forward.h" |
| 43 #include "wtf/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
| 44 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
| 45 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
| 46 #include "wtf/typed_arrays/Uint8ClampedArray.h" | 46 #include "wtf/typed_arrays/Uint8ClampedArray.h" |
| 47 #include <memory> | 47 #include <memory> |
| 48 | 48 |
| 49 namespace gpu { | 49 namespace gpu { |
| 50 namespace gles2 { | 50 namespace gles2 { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return m_snapshotState == DrawnToAfterSnapshot; | 102 return m_snapshotState == DrawnToAfterSnapshot; |
| 103 } | 103 } |
| 104 | 104 |
| 105 void setFilterQuality(SkFilterQuality filterQuality) { | 105 void setFilterQuality(SkFilterQuality filterQuality) { |
| 106 m_surface->setFilterQuality(filterQuality); | 106 m_surface->setFilterQuality(filterQuality); |
| 107 } | 107 } |
| 108 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } | 108 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } |
| 109 | 109 |
| 110 // Called by subclasses of ImageBufferSurface to install a new canvas object. | 110 // Called by subclasses of ImageBufferSurface to install a new canvas object. |
| 111 // Virtual for mocking | 111 // Virtual for mocking |
| 112 virtual void resetCanvas(SkCanvas*) const; | 112 virtual void resetCanvas(PaintCanvas*) const; |
| 113 | 113 |
| 114 SkCanvas* canvas() const; | 114 PaintCanvas* canvas() const; |
| 115 void disableDeferral(DisableDeferralReason) const; | 115 void disableDeferral(DisableDeferralReason) const; |
| 116 | 116 |
| 117 // Called at the end of a task that rendered a whole frame | 117 // Called at the end of a task that rendered a whole frame |
| 118 void finalizeFrame(const FloatRect& dirtyRect); | 118 void finalizeFrame(const FloatRect& dirtyRect); |
| 119 void didFinalizeFrame(); | 119 void didFinalizeFrame(); |
| 120 | 120 |
| 121 bool isDirty(); | 121 bool isDirty(); |
| 122 | 122 |
| 123 bool writePixels(const SkImageInfo&, | 123 bool writePixels(const SkImageInfo&, |
| 124 const void* pixels, | 124 const void* pixels, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 void flushGpu(FlushReason); // Like flush(), but flushes all the way down to | 162 void flushGpu(FlushReason); // Like flush(), but flushes all the way down to |
| 163 // the GPU context if the surface is accelerated. | 163 // the GPU context if the surface is accelerated. |
| 164 | 164 |
| 165 void notifySurfaceInvalid(); | 165 void notifySurfaceInvalid(); |
| 166 | 166 |
| 167 sk_sp<SkImage> newSkImageSnapshot(AccelerationHint, SnapshotReason) const; | 167 sk_sp<SkImage> newSkImageSnapshot(AccelerationHint, SnapshotReason) const; |
| 168 PassRefPtr<Image> newImageSnapshot( | 168 PassRefPtr<Image> newImageSnapshot( |
| 169 AccelerationHint = PreferNoAcceleration, | 169 AccelerationHint = PreferNoAcceleration, |
| 170 SnapshotReason = SnapshotReasonUnknown) const; | 170 SnapshotReason = SnapshotReasonUnknown) const; |
| 171 | 171 |
| 172 sk_sp<SkPicture> getPicture() { return m_surface->getPicture(); } | 172 sk_sp<PaintRecord> getPicture() { return m_surface->getPicture(); } |
| 173 | 173 |
| 174 void draw(GraphicsContext&, const FloatRect&, const FloatRect*, SkBlendMode); | 174 void draw(GraphicsContext&, const FloatRect&, const FloatRect*, SkBlendMode); |
| 175 | 175 |
| 176 void updateGPUMemoryUsage() const; | 176 void updateGPUMemoryUsage() const; |
| 177 static intptr_t getGlobalGPUMemoryUsage() { return s_globalGPUMemoryUsage; } | 177 static intptr_t getGlobalGPUMemoryUsage() { return s_globalGPUMemoryUsage; } |
| 178 static unsigned getGlobalAcceleratedImageBufferCount() { | 178 static unsigned getGlobalAcceleratedImageBufferCount() { |
| 179 return s_globalAcceleratedImageBufferCount; | 179 return s_globalAcceleratedImageBufferCount; |
| 180 } | 180 } |
| 181 intptr_t getGPUMemoryUsage() { return m_gpuMemoryUsage; } | 181 intptr_t getGPUMemoryUsage() { return m_gpuMemoryUsage; } |
| 182 | 182 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 int height() const { return m_size.height(); } | 217 int height() const { return m_size.height(); } |
| 218 int width() const { return m_size.width(); } | 218 int width() const { return m_size.width(); } |
| 219 | 219 |
| 220 const unsigned char* m_data; | 220 const unsigned char* m_data; |
| 221 const IntSize m_size; | 221 const IntSize m_size; |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 } // namespace blink | 224 } // namespace blink |
| 225 | 225 |
| 226 #endif // ImageBuffer_h | 226 #endif // ImageBuffer_h |
| OLD | NEW |