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

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

Issue 16032003: Fixing Canvas2DLayerBridge to handle lost graphics contexts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixing gpu_test Canvas2DAllowed Created 7 years, 5 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 WebKit::WebLayer* platformLayer() const; 126 WebKit::WebLayer* platformLayer() const;
127 127
128 // FIXME: current implementations of this method have the restriction that t hey only work 128 // FIXME: current implementations of this method have the restriction that t hey only work
129 // with textures that are RGB or RGBA format, UNSIGNED_BYTE type and level 0 , as specified in 129 // with textures that are RGB or RGBA format, UNSIGNED_BYTE type and level 0 , as specified in
130 // Extensions3D::canUseCopyTextureCHROMIUM(). 130 // Extensions3D::canUseCopyTextureCHROMIUM().
131 bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, G C3Denum, GC3Dint, bool, bool); 131 bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, G C3Denum, GC3Dint, bool, bool);
132 132
133 void reportMemoryUsage(MemoryObjectInfo*) const; 133 void reportMemoryUsage(MemoryObjectInfo*) const;
134 134
135 private: 135 private:
136 bool isValid() const;
136 void clip(GraphicsContext*, const FloatRect&) const; 137 void clip(GraphicsContext*, const FloatRect&) const;
137 138
138 void draw(GraphicsContext*, const FloatRect&, const FloatRect& = FloatRect(0 , 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNorm al, bool useLowQualityScale = false); 139 void draw(GraphicsContext*, const FloatRect&, const FloatRect& = FloatRect(0 , 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNorm al, bool useLowQualityScale = false);
139 void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const FloatPoint&, CompositeOperator, const FloatRect&); 140 void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const FloatPoint&, CompositeOperator, const FloatRect&);
140 141
141 friend class GraphicsContext; 142 friend class GraphicsContext;
142 friend class GeneratedImage; 143 friend class GeneratedImage;
143 friend class CrossfadeGeneratedImage; 144 friend class CrossfadeGeneratedImage;
144 friend class GeneratorGeneratedImage; 145 friend class GeneratorGeneratedImage;
145 146
146 IntSize m_size; 147 IntSize m_size;
147 IntSize m_logicalSize; 148 IntSize m_logicalSize;
148 float m_resolutionScale; 149 float m_resolutionScale;
149 OwnPtr<SkCanvas> m_canvas; 150 OwnPtr<SkCanvas> m_canvas;
150 OwnPtr<GraphicsContext> m_context; 151 OwnPtr<GraphicsContext> m_context;
151 OwnPtr<Canvas2DLayerBridge> m_layerBridge; 152 OwnPtr<Canvas2DLayerBridge> m_layerBridge;
152 153
153 // This constructor will place its success into the given out-variable 154 // This constructor will place its success into the given out-variable
154 // so that create() knows when it should return failure. 155 // so that create() knows when it should return failure.
155 ImageBuffer(const IntSize&, float resolutionScale, RenderingMode, OpacityMod e, bool& success); 156 ImageBuffer(const IntSize&, float resolutionScale, RenderingMode, OpacityMod e, bool& success);
156 ImageBuffer(const IntSize&, float resolutionScale, const GraphicsContext*, b ool hasAlpha, bool& success); 157 ImageBuffer(const IntSize&, float resolutionScale, const GraphicsContext*, b ool hasAlpha, bool& success);
157 }; 158 };
158 159
159 String ImageDataToDataURL(const ImageData&, const String& mimeType, const double * quality); 160 String ImageDataToDataURL(const ImageData&, const String& mimeType, const double * quality);
160 161
161 } // namespace WebCore 162 } // namespace WebCore
162 163
163 #endif // ImageBuffer_h 164 #endif // ImageBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698