| 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 19 matching lines...) Expand all Loading... |
| 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/transforms/AffineTransform.h" | 38 #include "platform/transforms/AffineTransform.h" |
| 39 #include "third_party/skia/include/core/SkPaint.h" | 39 #include "third_party/skia/include/core/SkPaint.h" |
| 40 #include "third_party/skia/include/core/SkPicture.h" | 40 #include "skia/ext/cdl_picture.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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 void didDisableAcceleration() const; | 104 void didDisableAcceleration() const; |
| 105 | 105 |
| 106 void setFilterQuality(SkFilterQuality filterQuality) { | 106 void setFilterQuality(SkFilterQuality filterQuality) { |
| 107 m_surface->setFilterQuality(filterQuality); | 107 m_surface->setFilterQuality(filterQuality); |
| 108 } | 108 } |
| 109 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } | 109 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } |
| 110 | 110 |
| 111 // Called by subclasses of ImageBufferSurface to install a new canvas object. | 111 // Called by subclasses of ImageBufferSurface to install a new canvas object. |
| 112 // Virtual for mocking | 112 // Virtual for mocking |
| 113 virtual void resetCanvas(SkCanvas*) const; | 113 virtual void resetCanvas(CdlCanvas*) const; |
| 114 | 114 |
| 115 SkCanvas* canvas() const; | 115 CdlCanvas* canvas() const; |
| 116 void disableDeferral(DisableDeferralReason) const; | 116 void disableDeferral(DisableDeferralReason) const; |
| 117 | 117 |
| 118 // Called at the end of a task that rendered a whole frame | 118 // Called at the end of a task that rendered a whole frame |
| 119 void finalizeFrame(const FloatRect& dirtyRect); | 119 void finalizeFrame(const FloatRect& dirtyRect); |
| 120 void didFinalizeFrame(); | 120 void didFinalizeFrame(); |
| 121 | 121 |
| 122 bool isDirty(); | 122 bool isDirty(); |
| 123 | 123 |
| 124 bool writePixels(const SkImageInfo&, | 124 bool writePixels(const SkImageInfo&, |
| 125 const void* pixels, | 125 const void* pixels, |
| (...skipping 36 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<CdlPicture> 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 int height() const { return m_size.height(); } | 216 int height() const { return m_size.height(); } |
| 217 int width() const { return m_size.width(); } | 217 int width() const { return m_size.width(); } |
| 218 | 218 |
| 219 const unsigned char* m_data; | 219 const unsigned char* m_data; |
| 220 const IntSize m_size; | 220 const IntSize m_size; |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 } // namespace blink | 223 } // namespace blink |
| 224 | 224 |
| 225 #endif // ImageBuffer_h | 225 #endif // ImageBuffer_h |
| OLD | NEW |