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

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

Issue 1295673003: Revert of 2D canvas: remain in deferred rendering mode with canvas to canvas drawImage (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months 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 | Annotate | Revision Log
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
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&) const; 85 void didDraw(const FloatRect& rect) const { m_surface->didDraw(rect); }
86 bool wasDrawnToAfterSnapshot() const { return m_snapshotState == DrawnToAfte rSnapshot; }
87 86
88 void setFilterQuality(SkFilterQuality filterQuality) { m_surface->setFilterQ uality(filterQuality); } 87 void setFilterQuality(SkFilterQuality filterQuality) { m_surface->setFilterQ uality(filterQuality); }
89 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); } 88 void setIsHidden(bool hidden) { m_surface->setIsHidden(hidden); }
90 89
91 // Called by subclasses of ImageBufferSurface to install a new canvas object 90 // Called by subclasses of ImageBufferSurface to install a new canvas object
92 void resetCanvas(SkCanvas*) const; 91 void resetCanvas(SkCanvas*) const;
93 92
94 SkCanvas* canvas() const; 93 SkCanvas* canvas() const;
95 void disableDeferral() const; 94 void disableDeferral() const;
96 95
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 PassRefPtr<Image> newImageSnapshot() const; 131 PassRefPtr<Image> newImageSnapshot() const;
133 132
134 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } 133 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); }
135 String debugName() const { return "ImageBuffer"; } 134 String debugName() const { return "ImageBuffer"; }
136 135
137 void draw(GraphicsContext*, const FloatRect&, const FloatRect*, SkXfermode:: Mode); 136 void draw(GraphicsContext*, const FloatRect&, const FloatRect*, SkXfermode:: Mode);
138 137
139 private: 138 private:
140 ImageBuffer(PassOwnPtr<ImageBufferSurface>); 139 ImageBuffer(PassOwnPtr<ImageBufferSurface>);
141 140
142 enum SnapshotState {
143 InitialSnapshotState,
144 DidAcquireSnapshot,
145 DrawnToAfterSnapshot,
146 };
147 mutable SnapshotState m_snapshotState;
148 OwnPtr<ImageBufferSurface> m_surface; 141 OwnPtr<ImageBufferSurface> m_surface;
149 ImageBufferClient* m_client; 142 ImageBufferClient* m_client;
150 }; 143 };
151 144
152 struct ImageDataBuffer { 145 struct ImageDataBuffer {
153 ImageDataBuffer(const IntSize& size, unsigned char* data) : m_data(data), m_ size(size) { } 146 ImageDataBuffer(const IntSize& size, unsigned char* data) : m_data(data), m_ size(size) { }
154 String PLATFORM_EXPORT toDataURL(const String& mimeType, const double* quali ty) const; 147 String PLATFORM_EXPORT toDataURL(const String& mimeType, const double* quali ty) const;
155 unsigned char* pixels() const { return m_data; } 148 unsigned char* pixels() const { return m_data; }
156 int height() const { return m_size.height(); } 149 int height() const { return m_size.height(); }
157 int width() const { return m_size.width(); } 150 int width() const { return m_size.width(); }
158 unsigned char* m_data; 151 unsigned char* m_data;
159 IntSize m_size; 152 IntSize m_size;
160 }; 153 };
161 154
162 } // namespace blink 155 } // namespace blink
163 156
164 #endif // ImageBuffer_h 157 #endif // ImageBuffer_h
OLDNEW
« no previous file with comments | « Source/modules/canvas2d/CanvasRenderingContext2D.cpp ('k') | Source/platform/graphics/ImageBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698