Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: Source/platform/graphics/ImageBuffer.h

Issue 562583002: Implement image-rendering:pixelated for accelerated 2D canvases. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove printfs, update test comments. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/ColorSpace.h" 35 #include "platform/graphics/ColorSpace.h"
36 #include "platform/graphics/GraphicsTypes.h" 36 #include "platform/graphics/GraphicsTypes.h"
37 #include "platform/graphics/GraphicsTypes3D.h" 37 #include "platform/graphics/GraphicsTypes3D.h"
38 #include "platform/graphics/ImageBufferSurface.h" 38 #include "platform/graphics/ImageBufferSurface.h"
39 #include "platform/transforms/AffineTransform.h" 39 #include "platform/transforms/AffineTransform.h"
40 #include "third_party/skia/include/core/SkPaint.h"
40 #include "wtf/Forward.h" 41 #include "wtf/Forward.h"
41 #include "wtf/OwnPtr.h" 42 #include "wtf/OwnPtr.h"
42 #include "wtf/PassOwnPtr.h" 43 #include "wtf/PassOwnPtr.h"
43 #include "wtf/PassRefPtr.h" 44 #include "wtf/PassRefPtr.h"
44 #include "wtf/Uint8ClampedArray.h" 45 #include "wtf/Uint8ClampedArray.h"
45 46
46 namespace blink { 47 namespace blink {
47 48
48 class DrawingBuffer; 49 class DrawingBuffer;
49 class GraphicsContext; 50 class GraphicsContext;
(...skipping 26 matching lines...) Expand all
76 77
77 ~ImageBuffer(); 78 ~ImageBuffer();
78 79
79 void setClient(ImageBufferClient* client) { m_client = client; } 80 void setClient(ImageBufferClient* client) { m_client = client; }
80 81
81 const IntSize& size() const { return m_surface->size(); } 82 const IntSize& size() const { return m_surface->size(); }
82 bool isAccelerated() const { return m_surface->isAccelerated(); } 83 bool isAccelerated() const { return m_surface->isAccelerated(); }
83 bool isSurfaceValid() const; 84 bool isSurfaceValid() const;
84 bool restoreSurface() const; 85 bool restoreSurface() const;
85 86
87 void setFilterLevel(SkPaint::FilterLevel filterLevel) { m_surface->setFilter Level(filterLevel); }
86 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } 88 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); }
87 89
88 GraphicsContext* context() const; 90 GraphicsContext* context() const;
89 91
90 // Called at the end of a task that rendered a whole frame 92 // Called at the end of a task that rendered a whole frame
91 void finalizeFrame(const FloatRect &dirtyRect); 93 void finalizeFrame(const FloatRect &dirtyRect);
92 void didFinalizeFrame(); 94 void didFinalizeFrame();
93 95
94 bool isDirty(); 96 bool isDirty();
95 97
96 const SkBitmap& bitmap() const; 98 const SkBitmap& bitmap() const;
97 99
100 void willAccessPixels() { m_surface->willAccessPixels(); }
101
98 PassRefPtr<Image> copyImage(BackingStoreCopy = CopyBackingStore, ScaleBehavi or = Scaled) const; 102 PassRefPtr<Image> copyImage(BackingStoreCopy = CopyBackingStore, ScaleBehavi or = Scaled) const;
99 // Give hints on the faster copyImage Mode, return DontCopyBackingStore if i t supports the DontCopyBackingStore behavior 103 // Give hints on the faster copyImage Mode, return DontCopyBackingStore if i t supports the DontCopyBackingStore behavior
100 // or return CopyBackingStore if it doesn't. 104 // or return CopyBackingStore if it doesn't.
101 static BackingStoreCopy fastCopyImageMode(); 105 static BackingStoreCopy fastCopyImageMode();
102 106
103 PassRefPtr<Uint8ClampedArray> getImageData(Multiply, const IntRect&) const; 107 PassRefPtr<Uint8ClampedArray> getImageData(Multiply, const IntRect&) const;
104 108
105 void putByteArray(Multiply, Uint8ClampedArray*, const IntSize& sourceSize, c onst IntRect& sourceRect, const IntPoint& destPoint); 109 void putByteArray(Multiply, Uint8ClampedArray*, const IntSize& sourceSize, c onst IntRect& sourceRect, const IntPoint& destPoint);
106 110
107 String toDataURL(const String& mimeType, const double* quality = 0) const; 111 String toDataURL(const String& mimeType, const double* quality = 0) const;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 155
152 IntSize m_size; 156 IntSize m_size;
153 RefPtr<Uint8ClampedArray> m_data; 157 RefPtr<Uint8ClampedArray> m_data;
154 }; 158 };
155 159
156 String PLATFORM_EXPORT ImageDataToDataURL(const ImageDataBuffer&, const String& mimeType, const double* quality); 160 String PLATFORM_EXPORT ImageDataToDataURL(const ImageDataBuffer&, const String& mimeType, const double* quality);
157 161
158 } // namespace blink 162 } // namespace blink
159 163
160 #endif // ImageBuffer_h 164 #endif // ImageBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698